Changing color of already plotted pixel

BlitzMax Forums/BlitzMax Beginners Area/Changing color of already plotted pixel

lotonah(Posted 2008) [#1]
Hi there! Kinda stumped on something...I've already gotten my graphics plotted on screen, now I'm just wondering how I would change the color of one or more of the pixels.

This was relatively easy back on the Atari, using the COLOR and SETCOLOR commands (allowing you to define and re-define what the palette was for an individual color.

Any help would be great!


Brucey(Posted 2008) [#2]
Plot it again in the new colour :-)


Amon(Posted 2008) [#3]
I think you would use setcolor 125,255,255 etc but when I tested that it would change the color of all the plotted stuff on screen.


lotonah(Posted 2008) [#4]
Sorry, Brucey...too complicated to do that, considering I want to do the effect over and over, but not on the same color or the same pixel locations.

I'm thinking it's sort of like changing the alpha channel, but instead of changing the alpha, I'd be changing the RGB values instead.


Amon(Posted 2008) [#5]
Sorry if this won't help, just remebering what others have posted, have you tried PIXMAPS?

Maybe copy the screen to a PIXMAP and edit it there???


lotonah(Posted 2008) [#6]
Hi Amon,

The image is already in a pixmap...of course this is the first time I've used one, so I'm stupid at the moment.

Still don't know how to do it though. Any thoughts, links, examples?

Thanks!


Amon(Posted 2008) [#7]
Try looking up Readpixel and writepixel in the command reference.

I've seen people do some cool stuff with those commands.


Bremer(Posted 2008) [#8]
Blitzmax does not work with fixed palette, so you will have to run through all pixels, find the ones with the value you want to change and plot them again. Using the PixmapPixelPtr() command you can get a pointer to the pixmap and then manipulate the pixels directly, which is somewhat faster than using read/writepixels.


ImaginaryHuman(Posted 2008) [#9]
Yah the graphics hardware these days is `true color` so instead of having an index color like say a palette of 256 colors which you can change and automatically update, you instead store the actual palette value in the pixel, so what you're looking at is like one giant palette. That means even if you have the same color on more than one pixel the pixels are not connected together in any way via the color, so changing the color on one pixel will only change that pixel. As Zawran said you have to manually go through all the pixels in the image, find those which have the color value you want, and then change them to what you want.


kochOn(Posted 2008) [#10]
With Blitsmax, you should do things like this: