Ultimate Amiga
Network Boards => AMOS Programming Environment => AMOS Factory => AMOS BASIC => Topic started by: Ionise on September 25, 2008, 05:13:58 AM
-
Hi,
Im having a major headache i wondered if anyone could solve this little problem im having.
Right what im looking to do is to find a way of switching colour indexes around.
For example i would like to be able to switch index 1 with index 5 so any graphic originaly drawn using colour index 1 is now using colour index 5 so when i manipulate colour 5 it now changes the $RGB of anything originaly drawn using colour index 1.
Hope you understand what i mean.
Im not looking to simply swap the contents/values im looking to swap the actual index.
???
-
I guess you want to replace indexes of some colors without any changes on screen.
For example:
You have yellow circle on black background. The color index 0 is $000 (black) and the color index 1 is $FF0 (yellow). If you switch values to both indexes you will see black circle on yellow background. The only way is to replace the pixels like this
for i=0 to 319
for j=0 to 199
If point(x+i,y+j)=1
plot x+i,y+j,5
else
if point(x+i,y+j)=5
plot x+i,y+j,1
end if
..
...
end if
next j
next i
...also you can switch colors in Deluxe Paint. Load image ,chose one color, switch it by option "Ex" with another color then chose option "Remap" from "Color" menu. Now the colors are replaced without any changes on screen.
-
Interesting solution but it would be painfuly slow for the requirements of my program as i have over 700 images in memory and would have to swap the pixels on each one.
Thanks anyway its given me some ideas
-
Ionise,
Did you solve your problem in the end?
Regards,
Lonewolf10
-
No i gave up in disgust >:(
-
I've done something similar myself in the past; I can't remember the specifics (it was about 10 years ago!) but it involved creating a bob the same size and bit depth as the screen and with all bits set to 1 then running a few passes of drawing the bob with various bitmasking options, copying the resulting image as a new bob, and repeating a couple of times depending on what the desired effect is with other options. I could probably recreate the code if you still want to do it, but I've only just started playing with AMOS again after a loooong break so I've more or less forgotten everything I ever learned. :D
-
Ok, give me a day or so while I refamiliarise myself with it and I'll see what I can do. :)