Rectangle drawing command
Posted: Sat Oct 28, 2006 5:59 am
I just had need to draw a single-pixel red border around an image, but was
surprised to see that PureBasic had no "rectangle" command to do it.
So
I ended up doing it like this, but perhaps a "rectangle" command could be
put in for a future release? ("Box" is no use here because it's filled in).
surprised to see that PureBasic had no "rectangle" command to do it.

I ended up doing it like this, but perhaps a "rectangle" command could be
put in for a future release? ("Box" is no use here because it's filled in).
Code: Select all
; w and h are image width/height.
StartDrawing(ImageOutput(#MyImage))
LineXY(0,0,w,0,#Red) ; Top.
LineXY(w-1,0,w-1,h,#Red) ; Right.
LineXY(w,h-1,0,h-1,#Red) ; Bottom.
LineXY(0,h,0,0,#Red) ; Left.
StopDrawing()