Is there a way to draw lines on an image?
Blitz3D Forums/Blitz3D Programming/Is there a way to draw lines on an image?
| ||
trying to draw some lines directly on an image. |
| ||
Yes - set the buffer to the imagebuffer, then use the line command and it will be performed on the image. Graphics 512,512,0,2 image=LoadImage("myimage.bmp");CreateImage(128,128) SetBuffer ImageBuffer(image) Color 255,0,255 Line 0,0,ImageWidth(image)-1,ImageHeight(image)-1 SetBuffer BackBuffer() DrawImage image Flip WaitKey End |
| ||
I sort of remember that there were issues when drawing onto images directly. But maybe I'm confusing images and textures here? In case of these issues, it could be safer to use GrabImage instead of SetBuffer:Graphics 800,600,0,2 image=CreateImage(128, 128) DrawBlock image, 0, 0 Color 255,0,255 Line 0,0,ImageWidth(image)-1,ImageHeight(image)-1 GrabImage image, 0, 0 ;<----grabimage instead of buffer commands Cls For i = 0 To 10 DrawImage image, Rand(800),Rand(600) Next Flip WaitKey End I used that technique when creating a texture painting program a few years ago. |
| ||
I sort of remember that there were issues when drawing onto images directly. But maybe I'm confusing images and textures here? In case of these issues, it could be safer to use GrabImage instead of SetBuffer: I'm pretty sure that was just for drawing direct to texture buffers. Image Buffers should be fine :) |