Colour Manipulation

hh hh at hyperhh.de
Sun Mar 26 16:37:10 EDT 2017


Now this is also available, very fast, with the same speed, for LC 6/7/8/9
on Mac using Canvas2d in a revBrowser instance (on Win revBrowser doesn't 
support Canvas2d) in LC-ImageToolBox-67: Basics.

Get it via "Sample Stacks" of the LC-Toolbar or from
http://livecodeshare.runrev.com/stack/827/LCImageToolBox67%3A-Basics-v102

Somehow I missed the possibility of LC 6/7's revBrowser to use Canvas2D on
Mac until now, the gain in speed compared to 'ordinary' LCScript is terrific.
Just try in LC 7!

It was Jonathan's transform-demo for the browser widget that opened my eyes.
Thanks again for that example, Jonathan.

There's still a fast working solution for linux missing and for Raspi (which
sadly inherits the linux bugs with web browssing). Within the next weeks I
will publish LC-ImageToolBox-JIT for that (uses luaJIT), I have it already
running.

> hh wrote:
> Today I implemented this as part of LC-ImageToolBox-89: Basics.
> Get it _from LC 8/9_ via "Sample Stacks" of the LC-Toolbar or from
> 
> http://livecodeshare.runrev.com/stack/826/LC-ImageToolBox89%3A-Basics-v102
> 
> Uses Canvas2D (no webGL because of issues with some graphic cards)
> in a hidden browser widget. Your method gives nice Effects and works
> with a decent graphic card pretty fast. Needs here with LC 8/9 on a
> Mac mini 2.5 GHz/IntelHD4000 for a 1920x1080 image < 500 millisecs.
> 
>> Peter R. wrote:
>> I've got an app that allows the user to display an image using a
>> variable number of colours (2-24 colours).  In addition, the user
>> can specify upper and lower thresholds so that all pixels below a
>> specified value are displayed using a colour such as black and all
>> pixels with values above a specified value are displayed using a
>> colour such as red. 
>> Pixels with values between the thresholds are displayed using the
>> specified colour range of 2-24 colours. The images can consist of
>> up to 8-10 million pixels, they are rectangular and can be in a
>> landscape or portrait orientation.
>> 
>> Whilst I have this working the code that manages the changing of
>> the number and use of colours in an image is rather slow. This is
>> despite me using the "repeat for each" loop structure and lock the
>> screen wherever possible to get the maximum speed!
>> 
>> Does anyone have any clever algorithms, code, add-ons, etc that can
>> do this kind of thing in a flash?!





More information about the use-livecode mailing list