Fill |
Bitmaps | |
Aptilis 1 |
Fill(BitmapHandle, x, y, Colour, StopColour)
Fill is the command to use to fill a region with
a particular colour.
The 'stopColour' parameter indicates the border of
the zone to fill. But Fill won't go over a line drawn
in 'colour' either.
Fill tends to be slower than ClearBitmap,
and requires much more memory, so to fill an entire bitmap, ClearBitmap is
a better choice.
Return Value:
0 if everything was OK or -1 if you indicated a non-valid
bitmap.
Example:
b = createBitmap(200, 200) if b = -1 print("Ooops, could not create the bitmap....\n") else // White background clearBitmap(b, RGB(255, 255, 255)) // The body ax = 30 pi = 3.141593654 st = pi * 2 / 150 black = RGB(0, 0, 0) white = RGB(255, 255, 255) ellipse(b, 100, 100, 75, 75, black) oy = 25 ox = 100 a = 0 for i=0 to 149 nx = 100 + sin(a) * ax ny = 100 - cos(a / 2) * 75 line(b, ox, oy, nx, ny, black) ox = nx oy = ny a = a + st end for // The small black circle ellipse(b, 90, 55, 18, 18, black) fill(b, 90, 55, black, black) // The small white circle // We could do a black circle first, but I want to illustrate the stop colour. fill(b, 100, 120, black, black) ellipse(b, 110, 145, 18, 18, white) fill(b, 110, 145, white, white) saveGIFFile("yy.gif", b) end ifResult:
For more details see the Bitmaps topic.