1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-27 19:42:22 -05:00

Bitmaps.rst: Change code examples a bit.

This commit is contained in:
Merlijn Wajer 2011-09-28 13:17:01 +02:00
parent d6117264d2
commit c7a6f55b66

View File

@ -18,10 +18,12 @@ an integer:
.. code-block:: pascal .. code-block:: pascal
var bmp, x, y: integer; var bmp, x, y: integer;
bmp := CreateBitmap(10, 10); // Create a bitmap of size (10, 10) begin
if FindBitmapIn(bmp, x, y, 0, 0, 300, 300) then bmp := CreateBitmap(10, 10); // Create a bitmap of size (10, 10)
writeln('Found it!'); if FindBitmapIn(bmp, x, y, 0, 0, 300, 300) then
FreeBitmap(bmp); // Don't forget to free it when we are done. writeln('Found it!');
FreeBitmap(bmp); // Don't forget to free it when we are done.
end;
Note that the previous example doesn't make a lot of sense as the bitmap has Note that the previous example doesn't make a lot of sense as the bitmap has
only been created and not filled with any colours, they are as of yet, only been created and not filled with any colours, they are as of yet,
@ -46,7 +48,9 @@ free it again)
.. code-block:: pascal .. code-block:: pascal
var bmp: TMufasaBitmap; var bmp: TMufasaBitmap;
bmp := TMufasBitmap.Create; begin
bmp := TMufasBitmap.Create;
end;
Because there is no way to get a *handle* to this bitmap; as it will not be Because there is no way to get a *handle* to this bitmap; as it will not be
managed by Simba internally. (All Bitmaps created by *CreateBitmap* are managed managed by Simba internally. (All Bitmaps created by *CreateBitmap* are managed
@ -75,10 +79,12 @@ then call this function to get the class reference.
var bmp: TMufasaBitmap; var bmp: TMufasaBitmap;
bmph: integer; bmph: integer;
bmph := CreateBitmap(100, 100); begin;
bmp := GetMufasaBitmap(bmph); bmph := CreateBitmap(100, 100);
bmp := GetMufasaBitmap(bmph);
bmp.SetSize(150,150); // also changes bmph, as they are the same bitmap. bmp.SetSize(150,150); // also changes bmph, as they are the same bitmap.
end;
.. _scriptref-createbitmapstring: .. _scriptref-createbitmapstring: