RaspberryPi Stacks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: RaspberryPi Stacks
Hermann, you are amazing, and brilliant, and brilliantly amazing!
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Thanks SparkOut.
Four years ago I started 'LiveCoding'. You were (and still are) one of these wonderful community members who help beginners to learn fast. So you are partially praising yourself.![Wink ;-)](./images/smilies/icon_wink.gif)
Four years ago I started 'LiveCoding'. You were (and still are) one of these wonderful community members who help beginners to learn fast. So you are partially praising yourself.
![Wink ;-)](./images/smilies/icon_wink.gif)
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #94 = Cuboid.livecode
(v1.0.1 of Apr 04/2017)
(Thanks to the LC-Team for removing the "layering-bug" in LC 8/9)
Cuboid ('pure' LiveCode script) = LC-Magick #7
A Cuboid is a cubic form that allows different width, height and depth. Some call it simpler "3d-box".
We use "Perspective Image Distortion" for all 6 faces of a cuboid. The base shape is a unit cube (which has 1.00 = baseWidth = baseHeight = baseDepth). Use other values of baseWidth, baseHeight and baseDepth to set other size relations of your box.
The antialiasing uses, once again, Bernd's gradient-technique. Thanks BerndN!
(v1.0.1 of Apr 04/2017)
(Thanks to the LC-Team for removing the "layering-bug" in LC 8/9)
Cuboid ('pure' LiveCode script) = LC-Magick #7
A Cuboid is a cubic form that allows different width, height and depth. Some call it simpler "3d-box".
We use "Perspective Image Distortion" for all 6 faces of a cuboid. The base shape is a unit cube (which has 1.00 = baseWidth = baseHeight = baseDepth). Use other values of baseWidth, baseHeight and baseDepth to set other size relations of your box.
- Each of the six faces may use a colored rect or an image as input.
- Faces can be made 0-100 % transparent, so that you can also look through to 'back' faces (=early iMac effect, we could call our object an "iCube").
- You have the arrowkeys and buttons zoom/rotateX/rotateY/rotateZ for fine-tuning. Fast animation is done by clicking (hold mouse down) at an "in/out-ring" at topLeft and and a "windrose" at topRight.
- Clicking button 'Cube' (re-)starts the cuboid with your current size settings. RightClick for a cube with 2.00 = baseWidth = baseHeight = baseDepth.
The antialiasing uses, once again, Bernd's gradient-technique. Thanks BerndN!
- Use LC 6.0.5 (or slower: 7.0.4) on Raspi.
- Use LC 6.7.11/ 7.1.4 and 8.1.4/ 9.0.0-dp7 or later on Mac/Win/linux (LC 8.1.3 and 9.0.0-dp6 contain a layering bug)
- by opening an LC IDE, version as denoted above, then type in or copy-paste to msg:
[EU] go stack url ("http://hyperhh.org/xstacks/cuboid_101.livecode")
[US] go stack url ("http://hh.on-rev.com/xstacks/cuboid_101.livecode")
_or_ - by downloading in your browser
[EU] http://hyperhh.org/xstacks/cuboid_101.livecode.zip
[US] http://hh.on-rev.com/xstacks/cuboid_101.livecode.zip
[You may use Raspi stack #33 to check the sums:
md5=5eda09e792cdcc2f75f880ab19c18586
sha1=fd7cf2a50489aa2484b2045d88aed28cc8de426e]
Then open in an LC IDE, version as denoted above.
Last edited by [-hh] on Wed Apr 26, 2017 1:46 pm, edited 1 time in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #95 = MoonEffect.livecode
MoonEffect (Elliptical distortion/Fisheye) = LC-Magick #8
[By Hermann Hoch and Bernd Niggemann]
This is our "easter-egg" for the community"!
You have
(a) A full moon.
A rectangular image is elliptical distorted (kind of "fisheye display").
Moreover you can 'animate':
The stack has 2 MByte (incl. images), too large for the forum. You can have it
(5M) [EU] EasterEggJ-anim, (5M) [EU] HeadRed-anim, (2M) [EU] LCInfinity-anim,
_or_
(5M) [US] EasterEggJ-anim, (5M) [US] HeadRed-anim, (2M) [US] LCInfinity-anim.
Just put the folders into the folder where your stack resides. The animations are antialiased only, adding effects increases the size.
p.s. The eastereggs in our stack are alike the ones in bn's stack Eastergg of livecodeshare.
MoonEffect (Elliptical distortion/Fisheye) = LC-Magick #8
[By Hermann Hoch and Bernd Niggemann]
This is our "easter-egg" for the community"!
You have
(a) A full moon.
A rectangular image is elliptical distorted (kind of "fisheye display").
- You can add 'Effects': a bright moonshadow.
- Choose horizontal/ vertical radius ('RadiusX'/ 'RadiusY') of the oval.
- Choose a fixed 'Relation' between them, based on the selected one of X or Y.
- Choose an 'Angle' for the display.
- Choose a (proportional) 'Scale' for the display.
- Set 'Percentage %'
- Choose by btn ">" the increasing/ waxing phase
- Choose by btn "<" the decreasing/ waning phase
Moreover you can 'animate':
- 'Animate' is slow, but can be done in selectable percentage steps.
- 'SaveAnim' creates a 1-step animation with the current settings in the folder of your stack (= 201 PNGs = if 300x300 around 14 MByte). Before saving an animation the stack should be saved to your local disk to have a folder for saving the image-series.
- 'ShowAnim' selects such a collection for replaying (works only correctly if loaded from the stacks folder). You choose the refresh rate in millisecs, so it is much more flexible than a gif animation .
- Use LC 6.0.5 (or slower: 7.0.4) on Raspi.
- Use LC 6.7.11/ 7.1.4/ 8.1.4/ 9.0.0 on Mac/Win/linux
The stack has 2 MByte (incl. images), too large for the forum. You can have it
- by opening one of LC 6/7/8/9 IDE and type or copy and paste in msg:
[EU] go stack url ("http://hyperhh.org/xstacks/moonEffect_101.livecode")
[US] go stack url ("http://hh.on-rev.com/xstacks/moonEffect_101.livecode")
_or_ - by downloading in your browser
[EU] http://hyperhh.org/xstacks/moonEffect_101.livecode.zip
[US] http://hh.on-rev.com/xstacks/moonEffect ... vecode.zip
[You may use Raspi stack #33 to check the sums:
md5=12f3383ff9f3f8135dd88d8e50613d93
sha1=ac1c618924da950016f79083aa45ed59660697fa]
Then unpack and open in one of 6/7/8/9 LC IDE.
(5M) [EU] EasterEggJ-anim, (5M) [EU] HeadRed-anim, (2M) [EU] LCInfinity-anim,
_or_
(5M) [US] EasterEggJ-anim, (5M) [US] HeadRed-anim, (2M) [US] LCInfinity-anim.
Just put the folders into the folder where your stack resides. The animations are antialiased only, adding effects increases the size.
p.s. The eastereggs in our stack are alike the ones in bn's stack Eastergg of livecodeshare.
- Attachments
-
- moonEffectWaning.png (24.38 KiB) Viewed 25110 times
-
- moonEffectFull.png (33.86 KiB) Viewed 25110 times
-
- moonEffectWaxing.png (25.09 KiB) Viewed 25110 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #96 = Legofy67.livecode
Legofy (is 'pure' LiveCode script)
This is a special (and partially improved) form of pixelate/pointillize, see
Stack #72 = LC-Magick 2
Choose the size of the lego-1x1-brick that is then used to build the 'plate' colored (overlayed) by your image.
Legofy (is 'pure' LiveCode script)
This is a special (and partially improved) form of pixelate/pointillize, see
Stack #72 = LC-Magick 2
Choose the size of the lego-1x1-brick that is then used to build the 'plate' colored (overlayed) by your image.
- Use LC 6.0.5/7.0.4 on Raspi.
- Use any stable version of LC 6/7/8/9 on Mac/Win/linux
- Attachments
-
- legofy67.livecode.zip
- (215.66 KiB) Downloaded 624 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #97 = rangeSlider.livecode
The stack is a builder utility for rangeSlider controls.
A rangeSlider is a self-contained group that represents a horizontal or vertical Slider that has one, two or three knobs:
The usual slider knob and/or knobs for the lower and upper bounds of a range.
Example.
Say you have a slider base that represents the values 0-100.
You define the range 20-85 out of that by setting the lower thumb to 20 and the upper thumb to 85.
Optionally you can now set a slider thumb selecting values within that range 20-85.
(Or you use, like with 'usual' sliders, only a slider thumb, no lower or upper thumb, and select from the base range 0-100).
The stack shows as examples 15 of the possible variations of rangeSlider and lets you variate all these:
= Choose one slider thumb, two range thumbs or both.
= Choose the orientation (vertical/horzontal) of the rangeSlider.
= Choose the baseColor, the thumb colors and the text color.
= Choose which values to display as text (incl. percentages).
You can get and set the sliderValues by script (see the documentation/help in the attached "builder" stack).
p.s. I'll make a corresponding LC 8/9 widget as soon as the widget format is fixed, so that that we need to build only ONE version for LC 8/9 widgets.
The stack is a builder utility for rangeSlider controls.
A rangeSlider is a self-contained group that represents a horizontal or vertical Slider that has one, two or three knobs:
The usual slider knob and/or knobs for the lower and upper bounds of a range.
Example.
Say you have a slider base that represents the values 0-100.
You define the range 20-85 out of that by setting the lower thumb to 20 and the upper thumb to 85.
Optionally you can now set a slider thumb selecting values within that range 20-85.
(Or you use, like with 'usual' sliders, only a slider thumb, no lower or upper thumb, and select from the base range 0-100).
The stack shows as examples 15 of the possible variations of rangeSlider and lets you variate all these:
= Choose one slider thumb, two range thumbs or both.
= Choose the orientation (vertical/horzontal) of the rangeSlider.
= Choose the baseColor, the thumb colors and the text color.
= Choose which values to display as text (incl. percentages).
You can get and set the sliderValues by script (see the documentation/help in the attached "builder" stack).
- Use LC 6.0.5/7.0.4 on Raspi.
- Use any stable version of LC 6/7/8/9 on Mac/Win/linux.
p.s. I'll make a corresponding LC 8/9 widget as soon as the widget format is fixed, so that that we need to build only ONE version for LC 8/9 widgets.
- Attachments
-
- rangeSlider_v100.livecode.zip
- The builder stack: Copy ready-made groups from it.
- (17.39 KiB) Downloaded 639 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #98 = GuessImage.livecode
GuessImage = SundayGameNb7
This is a basic usage of different paint tools in order to reveal ("unpaint") an image by painting. It required a not so simple blending technique to have this working on Mac/Win/linux and Raspi:
An image in back is covered by an (empty) image that is the "drawing canvas" and has ink "blendDstIn". On linux (and Raspi) this opens the stack window to look through to desktop, so we had to cover it (on top) by a disabled opaque graphic of ink "noOp".
I tried to have this stack also running as a HTML5 standalone but there the _only_ paint tool that works is the pencil.
GuessImage = SundayGameNb7
This is a basic usage of different paint tools in order to reveal ("unpaint") an image by painting. It required a not so simple blending technique to have this working on Mac/Win/linux and Raspi:
An image in back is covered by an (empty) image that is the "drawing canvas" and has ink "blendDstIn". On linux (and Raspi) this opens the stack window to look through to desktop, so we had to cover it (on top) by a disabled opaque graphic of ink "noOp".
I tried to have this stack also running as a HTML5 standalone but there the _only_ paint tool that works is the pencil.
- Use LC 6.0.5/7.0.4 on Raspi.
- Use any stable version of LC 6/7/8/9 on Mac/Win/linux
- Attachments
-
- guessImage.livecode.zip
- (237.17 KiB) Downloaded 610 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #99 = SelectiveGray.livecode
SelectiveGray = LC-Magick #9
is a special technique to display selective colored grayLevel images typical is the"redLips effect" (also called "Pleasantville-effect" or Sin-City-effect" after movies that used it).
The effect is attained by overlaying an image by its own grayLevel version and then colorizing parts by creating transparent regions (setting the mask). We do this by
Or you can use URLs given above, add ".zip" and download the zipped version of the stacks.
All stacks have help and let you import images and export your artwork.
The filesizes (incl. demo images) are 2.1 MByte each and 1.8 MByte each for their zips.
SelectiveGray = LC-Magick #9
is a special technique to display selective colored grayLevel images typical is the"redLips effect" (also called "Pleasantville-effect" or Sin-City-effect" after movies that used it).
The effect is attained by overlaying an image by its own grayLevel version and then colorizing parts by creating transparent regions (setting the mask). We do this by
- using paint tools (mostly for the 'fine' adjustments)
- selecting parts by a polygon for masking its enclosed region or the complement of the enclosed region
- selecting parts that have in the original image a color-distance (the 3D-euclidian distance) of at most a selectable value.
The euclidian 3D-distance of two colors (r1,g1,b1) and (r0,g0,b0) is
sqrt((r1-r0)^2+(g1-g0)^2+(b1-b0)^2).
- a pure LC Script-version (fast enough for Raspi):
[EU] go stack url ("http://hyperhh.org/xstacks/selectiveGra ... 0.livecode")
[US] go stack url ("http://hh.on-rev.com/xstacks/selectiveG ... 0.livecode")
Usable with LC 6.0.5/7.0.4 on Raspi.
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
- a LC Script-version that optionally uses revBrowser's canvas2d:
[EU] go stack url ("http://hyperhh.org/xstacks/selectiveGra ... 0.livecode")
[US] go stack url ("http://hh.on-rev.com/xstacks/selectiveG ... 0.livecode")
Usable with any stable version of LC 6/7/8/9 on Mac only.
- a LC Script-version that optionally uses browser widget's canvas2d:
[EU] go stack url ("http://hyperhh.org/xstacks/selectiveGray89_100.livecode")
[US] go stack url ("http://hh.on-rev.com/xstacks/selectiveG ... 0.livecode")
Usable with any stable version of LC 8/9 on Mac/Win/linux.
Or you can use URLs given above, add ".zip" and download the zipped version of the stacks.
All stacks have help and let you import images and export your artwork.
The filesizes (incl. demo images) are 2.1 MByte each and 1.8 MByte each for their zips.
- Attachments
-
- final selectiveGray
- final.png (91.06 KiB) Viewed 24487 times
-
- UsePoly: Inside distance 290 to magenta
- polyselect.png (51.7 KiB) Viewed 24487 times
-
- original
- original.png (140.34 KiB) Viewed 24487 times
Last edited by [-hh] on Sun Feb 11, 2018 11:53 am, edited 1 time in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #100 = mapGoogle.livecode
This basic map stack was made in April 2017 on base of a discussion in the use-list,
mapGoogle2.livecode is an update according to the current discussion (shows coordinates of the SW and NE edges of the map).
Usable with LC 6.0.5/7.0.4 on Raspi.
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
This basic map stack was made in April 2017 on base of a discussion in the use-list,
mapGoogle2.livecode is an update according to the current discussion (shows coordinates of the SW and NE edges of the map).
Usable with LC 6.0.5/7.0.4 on Raspi.
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
- Attachments
-
- mapGoogle2.livecode.zip
- (81.36 KiB) Downloaded 610 times
-
- mapGoogle.livecode.zip
- (39.14 KiB) Downloaded 618 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #101 = rotationControl2.livecode
(updated to v2)
This is a *very basic* stack that shows how to build a custom "rotation"-control:
Attach the button as behavior to any LC object that has an angle property.
Click anywhere on the target, a bit away from it's location and drag the mouse at about along a circle around the location of the target.
Then select one of two methods for the result of the dragging: (second method new in v2)
Then click far from that clock at the hand at ...
... 12 o'clock to have a value around 0 degrees,
... 3 o'clock to have a value around 90 degrees,
... 6 o'clock to have a value around 180 degrees,
... 9 o'clock to have a value around 270 degrees.
The essential part of script is short but the attached demo images make it too large for posting it here.
So download it: (sorry, currently not available)
Usable with LC 6.0.5/7.0.4 on RaspberryPi 2/3.
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
For mobile (or at any rate ...) you may have to adjust the layout of the slider-group (basics are already in the behavior script).
(updated to v2)
This is a *very basic* stack that shows how to build a custom "rotation"-control:
- How to get the angle of a click on an object relative to the loc of the object.
- How to display the angle with two ovals and use of startangle and arcangle, running clockwise and starting at 12 o'clock.
- How to use a behavior property.
Attach the button as behavior to any LC object that has an angle property.
Click anywhere on the target, a bit away from it's location and drag the mouse at about along a circle around the location of the target.
Then select one of two methods for the result of the dragging: (second method new in v2)
- TO ANGLE: gets the angle of the mouseloc relative to the loc of the target and sets the angle of the target accordingly.
- BY ANGLE: gets the angle of the mouseloc relative to the loc of the target as baseAngle and sets the angle of the target additive to the current angle of the target. Variant "diff" displays the difference to the current angle, variant "full" displays the resulting angle.
Then click far from that clock at the hand at ...
... 12 o'clock to have a value around 0 degrees,
... 3 o'clock to have a value around 90 degrees,
... 6 o'clock to have a value around 180 degrees,
... 9 o'clock to have a value around 270 degrees.
The essential part of script is short but the attached demo images make it too large for posting it here.
So download it: (sorry, currently not available)
Usable with LC 6.0.5/7.0.4 on RaspberryPi 2/3.
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
For mobile (or at any rate ...) you may have to adjust the layout of the slider-group (basics are already in the behavior script).
- Attachments
Last edited by [-hh] on Wed Dec 11, 2019 11:55 pm, edited 1 time in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #102 = JPNG.livecode
JPNG (named using JPEG and PNG) is not an image format but a compression method.
When saving it to files we use the file ending ".lcjpng" for that.
It takes features from both JPEG (setting JPEGquality to compress the imageData) and from the PNG compression (the alphaData/transparency). It saves the alphaData, optionally the maskData, and the JPEG-compressed imageData in one file. The JPNG-compressed image has here, using a JPEGquality of 80, around 25% of the PNG-compressed size.
So this may be interesting for people who wish to compress (significantly in size) the PNG-images containing transparency in their stack/standalone and decompress only some images for "current" use, at runtime.
Compression/Decompression is very fast.
The compress/decompress scripts are short ( < 30 lines each) so you can use it in your own stack.
Usable with LC 6.5.1/7.0.4 on RaspberryPi 2/3 (7.0.4 has a few bugs).
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
Recommended use on Mac/Win/linux: LC 9
which is significantly fastest (probably the upgraded Skia library 'pushes').
JPNG (named using JPEG and PNG) is not an image format but a compression method.
When saving it to files we use the file ending ".lcjpng" for that.
It takes features from both JPEG (setting JPEGquality to compress the imageData) and from the PNG compression (the alphaData/transparency). It saves the alphaData, optionally the maskData, and the JPEG-compressed imageData in one file. The JPNG-compressed image has here, using a JPEGquality of 80, around 25% of the PNG-compressed size.
So this may be interesting for people who wish to compress (significantly in size) the PNG-images containing transparency in their stack/standalone and decompress only some images for "current" use, at runtime.
Compression/Decompression is very fast.
The compress/decompress scripts are short ( < 30 lines each) so you can use it in your own stack.
- The stacks can export JPNG to files and reimport it from such files.
- It shows how to save compressed images into numbered properties and how to decompress them.
- As part of the JPNG-compressions: How to apply JPEG compression at different qualities.
Download the stack "JPNG": (sorry, currently not available)Mark Waddingham wrote: ...the JPNG idea exploits the fact that color images tend to withstand data-loss, but alpha data (masks) do not - JPEG is lossy, it removes information which our eyes cannot see. PNG compression (a variant of gzip IIRC) is loss-less, it preserves the exact values of the inputs.
So you use the lossy method (JPEG) on the part of the image which makes no difference to our eyes, and the loss-less method (PNG) on the part of the image which our eyes would notice a difference in.
Usable with LC 6.5.1/7.0.4 on RaspberryPi 2/3 (7.0.4 has a few bugs).
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
Recommended use on Mac/Win/linux: LC 9
which is significantly fastest (probably the upgraded Skia library 'pushes').
- Attachments
-
- JPNG.png (19.02 KiB) Viewed 23773 times
Last edited by [-hh] on Wed Dec 11, 2019 11:54 pm, edited 1 time in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #103 = SimplifyPoly.livecode
(Ramer-Douglas-Peucker algorithm)
Often I have the situation of too many points in a polygon, slowing down the post processing of these graphics. Examples are auto-traced opaque region of images or outlines coming from a map ("coastlines"), or simply a signature or "curves" from freehand-drawings (do it in the attached stack).
So the question arises how to reduce the number of points of such polygons and preserve the "visual shape" as good as possible, according to a "tolerance" given for deviations.
Ramer and Douglas&Peucker found independently a simplification algorithm for this problem. I translated that to LC Script. It is fast enough for use on RaspberryPi and is very effective.
The algorithm is currently for a "connected" polygon only (no empty lines in it). If you have a polygon which is separated into parts by empty lines then simply apply the algorithm to each part of connected points (containing more than 2 points each).
Usable with LC 6.5.1/7.0.4 on RaspberryPi 2/3.
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
(Ramer-Douglas-Peucker algorithm)
Often I have the situation of too many points in a polygon, slowing down the post processing of these graphics. Examples are auto-traced opaque region of images or outlines coming from a map ("coastlines"), or simply a signature or "curves" from freehand-drawings (do it in the attached stack).
So the question arises how to reduce the number of points of such polygons and preserve the "visual shape" as good as possible, according to a "tolerance" given for deviations.
Ramer and Douglas&Peucker found independently a simplification algorithm for this problem. I translated that to LC Script. It is fast enough for use on RaspberryPi and is very effective.
The algorithm is currently for a "connected" polygon only (no empty lines in it). If you have a polygon which is separated into parts by empty lines then simply apply the algorithm to each part of connected points (containing more than 2 points each).
Usable with LC 6.5.1/7.0.4 on RaspberryPi 2/3.
Usable with any stable version of LC 6/7/8/9 on Mac/Win/linux.
- Attachments
-
- simplifyPoly.livecode.zip
- (39.99 KiB) Downloaded 588 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #104 = ColorToneCurve.livecode
(Updated to version 1.0.2: Added RGB channel option and improved speed by 20%)
Color tonality curve for images = LC-Magick #10
A "color tonality curve" is a color function that is applied to the color values of your input image. The input values are on the horizontal axis (x) the output values are on the vertical axis (y).
We set here the curve
Once again, the result is surprisingly fast if the input image is not too large. Using LC 6 (which is 4-5 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1-2 seconds for a medium sized image, acceptable for me.
[For use with LC 8/9 we 'outsource' the application of the tone curve to Javascript, done in a browser widget. By that we are very fast (usually < 500 ms for an image of size 1920x1080 pixels, depends on your CPU/GPU). See stack "colorToneCurve89" : (sorry, currently not available)
The current stack is also too large for a forum post. Find "ColorToneCurve6789" : (sorry, currently not available)
This "pure" LC-Script stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704. Use it best with LC 6 (from speed reasons).
(Updated to version 1.0.2: Added RGB channel option and improved speed by 20%)
Color tonality curve for images = LC-Magick #10
A "color tonality curve" is a color function that is applied to the color values of your input image. The input values are on the horizontal axis (x) the output values are on the vertical axis (y).
We set here the curve
- by an editable formula or
- by 2 up to 9 handles (control points) that determine either
- a polygon chain (linear pieces between the control points)
- a bezier curve of order 1=linear, 2= square ... up to order 8
(usually most control points are not on the curve) - a natural spline curve (control points are on the curve)
- a clamped spline curve (control points are on the curve)
Once again, the result is surprisingly fast if the input image is not too large. Using LC 6 (which is 4-5 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1-2 seconds for a medium sized image, acceptable for me.
[For use with LC 8/9 we 'outsource' the application of the tone curve to Javascript, done in a browser widget. By that we are very fast (usually < 500 ms for an image of size 1920x1080 pixels, depends on your CPU/GPU). See stack "colorToneCurve89" : (sorry, currently not available)
The current stack is also too large for a forum post. Find "ColorToneCurve6789" : (sorry, currently not available)
This "pure" LC-Script stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704. Use it best with LC 6 (from speed reasons).
- Attachments
-
- original image
- tonecurve1.jpg (42.45 KiB) Viewed 22405 times
-
- tone curve example
- tonecurve2.jpg (35.44 KiB) Viewed 22405 times
-
- applied tone curve
- tonecurve0.jpg (42.54 KiB) Viewed 22405 times
Last edited by [-hh] on Wed Dec 11, 2019 11:54 pm, edited 1 time in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #105 = reflectImage.livecode
ReflectImage = LC-Magick #11
version 1.0.1 of Feb 13, 2018
ReflectImage mirrors (a part of) an image and blends the transparency of the mirrored part. This shows, compared to lengthy techniques in "full" image apps, how easy it is to have such effects with LiveCode.
You can select
ReflectImage = LC-Magick #11
version 1.0.1 of Feb 13, 2018
ReflectImage mirrors (a part of) an image and blends the transparency of the mirrored part. This shows, compared to lengthy techniques in "full" image apps, how easy it is to have such effects with LiveCode.
You can select
- the position of the mirror (top or bottom)
- the percentage of the image to be mirrored
- Use LC 6.0.5 (or slower: 7.0.4) on Raspi.
- Use LC 6.7.11 / 7.1.4 and 8.1.6/ 9.0.0 or later on Mac/Win/linux
- by opening an LC IDE, version as denoted above, then type in or copy-paste to msg:
[EU] go stack url ("http://hyperhh.org/xstacks/reflectImage_101.livecode")
[US] go stack url ("http://hh.on-rev.com/xstacks/reflectImage_101.livecode")
_or_ - by downloading in your browser
[EU] http://hyperhh.org/xstacks/reflectImage ... vecode.zip
[US] http://hh.on-rev.com/xstacks/reflectIma ... vecode.zip
Then open in an LC IDE, version as denoted above.
- Attachments
-
- Bottom mirror and top mirror (both 42%)
- reflectImage.png (148.48 KiB) Viewed 22307 times
shiftLock happens