plot a visible pixel on any image
BlitzMax Forums/BlitzMax Beginners Area/plot a visible pixel on any image
| ||
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 ! |
| ||
I am not sure if it works because they have past many years since I used it: XOR the underneath color with 0xFFFF value |
| ||
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 |
| ||
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 |
| ||
I would suggest not to use pixels at all. Its better to handle a cursor with a few set of functions |
| ||
my last idea is to use another image (a cross) drawn on the image with a blendmode ? What do you think about that ? |
| ||
or you could have the cursor flash between 2 colours. or select a random colour each frame. |
| ||
finally i use an image with setblend lightblend |
| ||
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 |