plot a visible pixel on any image

BlitzMax Forums/BlitzMax Beginners Area/plot a visible pixel on any image

hub(Posted 2007) [#1]
Hi !
in my game editor i want plot a pixel on an image to mark the image center. Just by draw the image (drawimage) and next plot the point. How to choose a color for the plotted point so it always visible ? if i manually choose a colour, for example white point, and next have a white picture i don't see it !
Thanks !


Moraldi(Posted 2007) [#2]
I am not sure if it works because they have past many years since I used it: XOR the underneath color with 0xFFFF value


BlackSp1der(Posted 2007) [#3]
easy code for your understand.

Local image:TImage=LoadImage(...)
Local frame:Int=0
Local pixmap:TPixmap=LockImage(Image,frame)

Local color:Int=ReadPixel(pixmap,image.Handle_X,image.Handle_Y)
Local r:Int=255-((color Shr 16) & 255)
Local g:Int=255-((color Shr 8) & 255)
Local b:Int=255-(color & 255)
color=(255 Shl 24) | (r Shl 16) | (g Shl 8) | b

UnlockImage(Image,frame)
DrawImage image,400,300
SetColor r,g,b
Plot(400,300)
Flip
WaitKey



Derron(Posted 2007) [#4]
I would suggest to use more than one pixel instead.

000
010
000

or

010
111
010

For one pixel (even with xor) being mostly invisible it's better to make a bright pixel surrounded by very dark pixels... or a very dark pixel surrounded by very bright pixels.

Using this you won't need to read the underlying pixels color, just draw your "cross" or "shaded dot".


bye
MB


Moraldi(Posted 2007) [#5]
I would suggest not to use pixels at all.
Its better to handle a cursor with a few set of functions


hub(Posted 2007) [#6]
my last idea is to use another image (a cross) drawn on the image with a blendmode ? What do you think about that ?


QuietBloke(Posted 2007) [#7]
or you could have the cursor flash between 2 colours.
or select a random colour each frame.


hub(Posted 2007) [#8]
finally i use an image with setblend lightblend


ImaginaryHuman(Posted 2007) [#9]
You could do something like a hue shift to make sure the hue is never the same, and then some kind of brightness inversion or something