Re: Manipulating Raw Picture Data

2008-06-27 Thread Jim Lambert


On Jun 26, 2008, at 8:47 PM, [EMAIL PROTECTED]  
wrote:



I have an image where different regions consist of known colors. I
would like to fill a region with color at runtime as a sort of
highlight. The situation does not lend itself to using separate
transparent png images


In addition to the earlier suggestions, take a long look at inkmode.
By cleverly overlaying a colored graphic on top of your image and  
adjusting inkmode, it should be possible to make specific colored  
areas change color.
You can do this very quickly and without resorting to polygons or  
imagedata.

An old trick from the 8-bit monitor days!

Jim Lambert
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Manipulating Raw Picture Data

2008-06-26 Thread Wilhelm Sanke

Mark Greenberg markgreenberg at cox.net wrote:

I have an image where different regions consist of known colors. I  
would like to fill a region with color at runtime as a sort of  
highlight. The situation does not lend itself to using separate  
transparent png images. I have been using the floodfill bucket tool  
to achieve this, but it is slow and doesn't work right when I compile  
to standalone.


(snip)

Two questions:  
would sampling every pixel in a 600x400 image and possibly changing  
the pixel's color be fast enough to seem like a highlight to the  
user? and how would I go about doing that?


Thanks in Advance,

Mark Greenberg




I assume that with highlighting specific regions you mean

- changing the image for a short moment and then revert to the original 
picture?


Chipp's suggestion


I doubt it will be fast enough for you. Why don't you try using a graphic
rectangle on top using an ink effect?



seems to me a good starting point.
I have found that for such a rectangle a usable color would be 
236,233,88 with the ink set to "srcAnd" (on Windows, on MacOS you need a 
different ink).


If you want to hilite only specific parts - and maybe regions at the 
same time that are not connected - then create appropriate polygons and 
show/hide them.


I have as one example implemented such an approach in my sample stack 
"Image and Words"




Another suggestion:

Change the colors of the image you want to change and save its imagedata 
in a custom property.

Set another custom property to the imagedata of the original image.

Then use a script like this:

on mouseUp
 set the imagedata of img 1 to the cpcolors2 of this card # changed colors
 wait 200 milliseconds # or any time you choose
 set the imagedata of img 1 to the cpcolors1 of this card # original image
end mouseUp

This "highlighting" is instantaneous, but you need to set the 
paintcompression to RLE before (There is definitely no need to set the 
paintcompression to RLE at the time you import the image, the faster 
tempo of RLE will be working any time after you have set it - I think 
this may read differently in the docs, but then the docs are wrong here)


Regards,

Wilhelm Sanke


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Manipulating Raw Picture Data

2008-06-26 Thread viktoras didziulis
just played around a little with this handler on 600x500 image (MS 
Windows XP, RR 2.9, Intel Celeron 1500 MHz):


on  repColor
local myData
local myTimer
local myColor1
local myColor2

put binaryEncode("C3",myRed,myGreen,myBlue) into myColor1  
put binaryEncode("C3",myRed2,myGreen2,myBlue2) into myColor2


 put the milliseconds into myTimer
 put the imageData of img "im1" into myData 
 replace myColor1 with myColor2 in myData

 set the imageData of img "im1" to myData
 put (the milliseconds) - myTimer & return after fld "fTimer"
end repColor

in development environment with paintcompression set to default ("PNG") 
it takes around 635 milliseconds.
If before loading your image you do this: set the paintcompression to 
"RLE" (which is the default in standalones)
the same color replacement handler takes just 77 milliseconds, which is 
~ 9 times faster!


Now if only we'd know what exactly rle format is used by RR, then we 
should be able to do:
put the text of img "im1" into myData 
replace myColor1 with myColor2 in myData

set the text of img "im1" to myData

unfortunately now this damages the image but otherwise it would take 
only ~25 milliseconds.


All the best!
Viktoras


Mark Greenberg wrote:
I have an image where different regions consist of known colors. I 
would like to fill a region with color at runtime as a sort of 
highlight. The situation does not lend itself to using separate 
transparent png images. I have been using the floodfill bucket tool to 
achieve this, but it is slow and doesn't work right when I compile to 
standalone.


I've read various threads on manipulating the raw picture data and 
seen a couple of stacks like that. It seems a bit beyond my skills as 
a casual programmer, but I may need to give it a try. Two questions: 
would sampling every pixel in a 600x400 image and possibly changing 
the pixel's color be fast enough to seem like a highlight to the user? 
and how would I go about doing that?


Thanks in Advance,

Mark Greenberg
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution




___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Manipulating Raw Picture Data

2008-06-25 Thread Chipp Walters
I doubt it will be fast enough for you. Why don't you try using a graphic
rectangle on top using an ink effect?
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Manipulating Raw Picture Data

2008-06-25 Thread Mark Schonewille

Hi Mark,

I believe you want something like this:

put NULL & numToChar(red) & numToChar(green) & numToChar(blue) into  
myColor1
put NULL & numToChar(red2) & numToChar(green2) & numToChar(blue2) into  
myColor2

put the imageData of img 1 into myData
replace myColor1 with myColor2 in myData
set the imageData of img 1 to myData

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
 for more info.


On 26 jun 2008, at 01:29, Mark Greenberg wrote:

I have an image where different regions consist of known colors. I  
would like to fill a region with color at runtime as a sort of  
highlight. The situation does not lend itself to using separate  
transparent png images. I have been using the floodfill bucket tool  
to achieve this, but it is slow and doesn't work right when I  
compile to standalone.


I've read various threads on manipulating the raw picture data and  
seen a couple of stacks like that. It seems a bit beyond my skills  
as a casual programmer, but I may need to give it a try. Two  
questions: would sampling every pixel in a 600x400 image and  
possibly changing the pixel's color be fast enough to seem like a  
highlight to the user? and how would I go about doing that?


Thanks in Advance,

Mark Greenberg




___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Manipulating Raw Picture Data

2008-06-25 Thread Mark Greenberg
I have an image where different regions consist of known colors. I  
would like to fill a region with color at runtime as a sort of  
highlight. The situation does not lend itself to using separate  
transparent png images. I have been using the floodfill bucket tool  
to achieve this, but it is slow and doesn't work right when I compile  
to standalone.


I've read various threads on manipulating the raw picture data and  
seen a couple of stacks like that. It seems a bit beyond my skills as  
a casual programmer, but I may need to give it a try. Two questions:  
would sampling every pixel in a 600x400 image and possibly changing  
the pixel's color be fast enough to seem like a highlight to the  
user? and how would I go about doing that?


Thanks in Advance,

Mark Greenberg
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution