You can only writepixel to a pixmap so you'd have to lock the image to get a pixmap and then convert back to an image.
However, the colours for writepixel and setcolor should be the same.
I *think* it's possible the colour might not be exactly the same as the same RGB values in a paint package
if you're using a 'shallower' colour depth in BMax.
However, the ARGB converted to R,G,B and setcolor should always be the same.
This *might* make sense...
Graphics 640 , 480
SetColor 100 , 100 , 100
DrawRect 0,0,100,100
mypixmap:TPixmap = GrabPixmap(0 , 0 , 100 , 100)
Cls
DrawPixmap mypixmap,0,0
For x = 0 To 99
For y = 0 To 99
WritePixel(mypixmap , x , y , intcolour(50 , 255 , 100))
Next
Next
DrawPixmap mypixmap , 100 , 0
SetColor 50,255,100
For x = 0 To 99
For y = 0 To 99
Plot 200 + x , y
Next
Next
SetColor 255,255,255
myimage:TImage = LoadImage(mypixmap)
DrawImage myimage , 300 , 0
DrawText "Orig pixmap" , 0,110
DrawText "Pixmap" , 100,110
DrawText "Plot " , 200,110
DrawText "Pix2image", 300,110
Flip
WaitKey()
Function intcolour(r , g , b , a = 255)
Return A Shl 24 | R Shl 16 | G Shl 8 | B Shl 0
End Function
and this is a bit overkill...
Graphics 640 , 480
SetColor 100 , 100 , 100
DrawRect 0,0,100,100
mypixmap:TPixmap = GrabPixmap(0 , 0 , 100 , 100)
For r = 0 To 255 Step 16
For g = 0 To 255 Step 16
For b = 0 To 255 Step 16
Cls
For x = 0 To 99
For y = 0 To 99
WritePixel(mypixmap , x , y , intcolour(r,g,b))
Next
Next
DrawPixmap mypixmap , 100 , 0
SetColor r,g,b
For x = 0 To 99
For y = 0 To 99
Plot 200 + x , y
Next
Next
SetColor 255,255,255
myimage:TImage = LoadImage(mypixmap)
DrawImage myimage , 300 , 0
DrawText "Pixmap" , 100,110
DrawText "Plot " , 200,110
DrawText "Pix2image", 300,110
Flip
Next
Next
Next
Function intcolour(r , g , b , a = 255)
Return A Shl 24 | R Shl 16 | G Shl 8 | B Shl 0
End Function