Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Palette Woe / Switching Colour Indexes  (Read 4289 times)

0 Members and 1 Guest are viewing this topic.

Ionise

  • Guest
Palette Woe / Switching Colour Indexes
« 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.

 ???
Logged

selur

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 83
Re: Palette Woe / Switching Colour Indexes
« Reply #1 on: September 25, 2008, 01:37:05 PM »

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.
Logged

Ionise

  • Guest
Re: Palette Woe / Switching Colour Indexes
« Reply #2 on: September 25, 2008, 03:30:20 PM »

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
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Palette Woe / Switching Colour Indexes
« Reply #3 on: October 04, 2008, 09:29:08 PM »


Ionise,

Did you solve your problem in the end?


Regards,
Lonewolf10

Logged

Ionise

  • Guest
Re: Palette Woe / Switching Colour Indexes
« Reply #4 on: October 05, 2008, 06:53:49 AM »

No i gave up in disgust  >:(
Logged

ElB

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Recoverable Alert
Re: Palette Woe / Switching Colour Indexes
« Reply #5 on: November 22, 2008, 12:37:04 PM »

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
Logged

ElB

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Recoverable Alert
Re: Palette Woe / Switching Colour Indexes
« Reply #6 on: November 22, 2008, 05:41:35 PM »

Ok, give me a day or so while I refamiliarise myself with it and I'll see what I can do. :)
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022