1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-28 12:02:15 -05:00

Documentation: Add bitmaps references. (<3 vim)

This commit is contained in:
Merlijn Wajer 2011-07-22 15:02:27 +02:00
parent c06304d834
commit e63dcbccb1

View File

@ -21,6 +21,7 @@ an integer:
bmp := CreateBitmap(10, 10); // Create a bitmap of size (10, 10) bmp := CreateBitmap(10, 10); // Create a bitmap of size (10, 10)
if FindBitmapIn(bmp, x, y, 0, 0, 300, 300) then if FindBitmapIn(bmp, x, y, 0, 0, 300, 300) then
writeln('Found it!'); writeln('Found it!');
FreeBitmap(bmp); // Don't forget to free it when we are done.
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,
@ -79,6 +80,7 @@ then call this function to get the class reference.
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.
.. _scriptref-createbitmapstring:
CreateBitmapString CreateBitmapString
------------------ ------------------
@ -87,7 +89,11 @@ CreateBitmapString
function CreateBitmapString(bmp : integer) : string; function CreateBitmapString(bmp : integer) : string;
Creates a string for the given bitmap. Creates a string for the given bitmap, you can use this to save a bitmap for
later us, for example loading it again using :ref:`scriptref-bitmapfromstring`.
.. _scriptref-createbitmap:
CreateBitmap CreateBitmap
------------ ------------
@ -96,8 +102,10 @@ CreateBitmap
function CreateBitmap(w,h :integer) : integer; function CreateBitmap(w,h :integer) : integer;
Create a bitmap with width *h* and height *h*. Returns the bitmap reference. Create a bitmap with width *h* and height *h*.
Returns the reference to the created bitmap.
.. _scriptref-freebitmap:
FreeBitmap FreeBitmap
---------- ----------
@ -111,6 +119,8 @@ Be careful when working with bitmaps: not freeing it when you no longer need it
leads to memory leaks, which will eventually make your script crash. (Unless you leads to memory leaks, which will eventually make your script crash. (Unless you
stop it in time, in which case Simba will free the bitmaps for you) stop it in time, in which case Simba will free the bitmaps for you)
.. _scriptref-savebitmap:
SaveBitmap SaveBitmap
---------- ----------
@ -120,7 +130,6 @@ SaveBitmap
Save the given bitmap to the specified path. Save the given bitmap to the specified path.
.. _scriptref-bitmapfromstring: .. _scriptref-bitmapfromstring:
BitmapFromString BitmapFromString
@ -133,7 +142,6 @@ BitmapFromString
Load a bitmap from the given string. This command is usually generated with the Load a bitmap from the given string. This command is usually generated with the
Bitmap to String feature in Simba. Bitmap to String feature in Simba.
.. _scriptref-loadbitmap: .. _scriptref-loadbitmap:
LoadBitmap LoadBitmap
@ -143,8 +151,10 @@ LoadBitmap
function LoadBitmap(Path : string) : integer; function LoadBitmap(Path : string) : integer;
Load a bitmap from a path to a file. Known formats are .bmp and .png. (Possibly Load a bitmap from a path to a file. Formats known to work are BMP and PNG
others, don't know for sure) images.
.. _scriptref-setbitmapsize:
SetBitmapSize SetBitmapSize
------------- -------------
@ -153,7 +163,12 @@ SetBitmapSize
procedure SetBitmapSize(Bmp,NewW,NewH : integer); procedure SetBitmapSize(Bmp,NewW,NewH : integer);
Change the size of the bitmap. Previous data will be preserved (if possible). Change the size of the bitmap.
Previous data will be preserved (if possible), so enlarging the bitmap won't
destroy the old data, but shrinking it will inevitably destroy some data.
(Everything that falls out of the new bounds)
.. _scriptref-getbitmapsize:
GetBitmapSize GetBitmapSize
------------- -------------
@ -164,6 +179,8 @@ GetBitmapSize
Returns the size of the bitmap in *BmpW*, *BmpH*. Returns the size of the bitmap in *BmpW*, *BmpH*.
.. _scriptref-stretchbitmapresize:
StretchBitmapResize StretchBitmapResize
------------------- -------------------
@ -172,6 +189,8 @@ StretchBitmapResize
procedure StretchBitmapResize(Bmp,NewW,NewH : integer); procedure StretchBitmapResize(Bmp,NewW,NewH : integer);
.. _scriptref-createmirroredbitmap:
CreateMirroredBitmap CreateMirroredBitmap
-------------------- --------------------
@ -180,6 +199,8 @@ CreateMirroredBitmap
function CreateMirroredBitmap(Bmp : integer) : integer; function CreateMirroredBitmap(Bmp : integer) : integer;
.. _scriptref-createmirroredbitmapex:
CreateMirroredBitmapEx CreateMirroredBitmapEx
---------------------- ----------------------
@ -188,6 +209,8 @@ CreateMirroredBitmapEx
function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer; function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer;
.. _scriptref-fastsetpixel:
FastSetPixel FastSetPixel
------------ ------------
@ -197,6 +220,8 @@ FastSetPixel
Set the pixel on the bitmap at position x, y to *color*. Set the pixel on the bitmap at position x, y to *color*.
.. _scriptref-fastsetpixels:
FastSetPixels FastSetPixels
------------- -------------
@ -206,6 +231,7 @@ FastSetPixels
Set the pixels on the bitmap at position TPA[index] to Colors[index]. Set the pixels on the bitmap at position TPA[index] to Colors[index].
.. _scriptref-fastgetpixel:
FastGetPixel FastGetPixel
------------ ------------
@ -216,6 +242,8 @@ FastGetPixel
Return the colour of pixel on the bitmap, position specified by x, y. Return the colour of pixel on the bitmap, position specified by x, y.
.. _scriptref-fastgetpixels:
FastGetPixels FastGetPixels
------------- -------------
@ -225,6 +253,7 @@ FastGetPixels
Return an array of the colours on the bitmap; positions specified by *TPA*. Return an array of the colours on the bitmap; positions specified by *TPA*.
.. _scriptref-getbitmapareacolors:
GetBitmapAreaColors GetBitmapAreaColors
------------------- -------------------
@ -236,6 +265,8 @@ GetBitmapAreaColors
Returns all the colours in the area defined by (*xs*, *xy*, *xe*, *ye*) on the Returns all the colours in the area defined by (*xs*, *xy*, *xe*, *ye*) on the
bitmap in a two dimensions integer array. bitmap in a two dimensions integer array.
.. _scriptref-fastdrawclear:
FastDrawClear FastDrawClear
------------- -------------
@ -245,6 +276,8 @@ FastDrawClear
Draw *Color* on every pixel on the bitmap. Draw *Color* on every pixel on the bitmap.
.. _scriptref-fastdrawtransparent:
FastDrawTransparent FastDrawTransparent
------------------- -------------------
@ -253,6 +286,8 @@ FastDrawTransparent
procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer); procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer);
.. _scriptref-setransparentcolor:
SetTransparentColor SetTransparentColor
------------------- -------------------
@ -260,6 +295,7 @@ SetTransparentColor
procedure SetTransparentColor(bmp : integer; Color : TColor); procedure SetTransparentColor(bmp : integer; Color : TColor);
.. _scriptref-getransparentcolor:
GetTransparentColor GetTransparentColor
------------------- -------------------
@ -268,6 +304,7 @@ GetTransparentColor
function GetTransparentColor(bmp: integer) : TColor; function GetTransparentColor(bmp: integer) : TColor;
.. _scriptref-fastreplacecolor:
FastReplaceColor FastReplaceColor
---------------- ----------------
@ -276,6 +313,7 @@ FastReplaceColor
procedure FastReplaceColor(Bmp : integer; OldColor,NewColor : TColor); procedure FastReplaceColor(Bmp : integer; OldColor,NewColor : TColor);
.. _scriptref-copyclienttobitmap:
CopyClientToBitmap CopyClientToBitmap
------------------ ------------------
@ -286,6 +324,8 @@ CopyClientToBitmap
Copy client area *xs, ys, xe, ye* to specified bitmap. Copy client area *xs, ys, xe, ye* to specified bitmap.
.. _scriptref-bitmapfromclient:
BitmapFromClient BitmapFromClient
---------------- ----------------
@ -295,6 +335,8 @@ BitmapFromClient
Create a bitmap from the client. Area specified by *xs, ye, xe, ye*. Create a bitmap from the client. Area specified by *xs, ye, xe, ye*.
.. _scriptref-setbitmapname:
SetBitmapName SetBitmapName
------------- -------------
@ -305,6 +347,20 @@ SetBitmapName
Assign a name to the bitmap. Mainly for debugging purposes. (It will write the Assign a name to the bitmap. Mainly for debugging purposes. (It will write the
name of the bitmap if it hasn't been freed.) name of the bitmap if it hasn't been freed.)
.. code-block:: pascal
program new;
var bmp: integer;
begin
bmp := CreateBitmap(10, 10);
SetBitmapName(bmp, 'We will not free this bitmap');
end.
// Simba will print what bitmap has not been freed (along with his long
// name)
.. _scriptref-findbitmap:
FindBitmap FindBitmap
---------- ----------
@ -315,6 +371,8 @@ FindBitmap
Searches for the Bitmap *bmp* on the entire client. Returns true if found. Searches for the Bitmap *bmp* on the entire client. Returns true if found.
If found, *x, y* specifies the position where the bitmap was found. If found, *x, y* specifies the position where the bitmap was found.
.. _scriptref-findbitmapin:
FindBitmapIn FindBitmapIn
------------ ------------
@ -327,6 +385,8 @@ Searches for the Bitmap *bmp* on the client in the area defined by *xs,ys,xe,ye*
Returns true if found. If found, *x, y* specifies the position where the bitmap Returns true if found. If found, *x, y* specifies the position where the bitmap
was found. was found.
.. _scriptref-findbitmaptolerancein:
FindBitmapToleranceIn FindBitmapToleranceIn
--------------------- ---------------------
@ -340,6 +400,8 @@ Tolerance defines the tolerance per pixel when matching bitmaps. See
Returns true if found. If found, *x, y* specifies the position where the bitmap Returns true if found. If found, *x, y* specifies the position where the bitmap
was found. was found.
.. _scriptref-findbitmapspiral:
FindBitmapSpiral FindBitmapSpiral
---------------- ----------------
@ -352,6 +414,8 @@ Returns true if found. If found, *x, y* specifies the position where the bitmap
was found. Search starts from a point defined by *x, y*. was found. Search starts from a point defined by *x, y*.
.. _scriptref-findbitmapsspiraltolerance:
FindBitmapsSpiralTolerance FindBitmapsSpiralTolerance
-------------------------- --------------------------
@ -366,6 +430,8 @@ Tolerance defines the tolerance per pixel when matching bitmaps. See
Search starts from a point defined by *x, y*. Search starts from a point defined by *x, y*.
Returns true if found. If found, each point in *TPA* specifies a match. Returns true if found. If found, each point in *TPA* specifies a match.
.. _scriptref-findbitmapspiraltolerance:
FindBitmapSpiralTolerance FindBitmapSpiralTolerance
------------------------- -------------------------
@ -380,6 +446,8 @@ Search starts from a point defined by *x, y*.
Returns true if found. If found, *x, y* specifies the position where the bitmap Returns true if found. If found, *x, y* specifies the position where the bitmap
was found. was found.
.. _scriptref-rotatebitmap:
RotateBitmap RotateBitmap
------------ ------------
@ -388,6 +456,8 @@ RotateBitmap
function RotateBitmap(bitmap: Integer; angle: Extended): Integer; function RotateBitmap(bitmap: Integer; angle: Extended): Integer;
.. _scriptref-desaturatebitmap:
DesaturateBitmap DesaturateBitmap
---------------- ----------------
@ -396,6 +466,8 @@ DesaturateBitmap
function DesaturateBitmap(Bitmap : integer) : integer; function DesaturateBitmap(Bitmap : integer) : integer;
.. _scriptref-invertbitmap:
InvertBitmap InvertBitmap
------------ ------------
@ -404,6 +476,8 @@ InvertBitmap
procedure InvertBitmap(Bitmap : integer); procedure InvertBitmap(Bitmap : integer);
.. _scriptref-copybitmap:
CopyBitmap CopyBitmap
---------- ----------
@ -413,6 +487,8 @@ CopyBitmap
Creates a copy of the *Bitmap*. Returns the bitmap copy. Creates a copy of the *Bitmap*. Returns the bitmap copy.
.. _scriptref-greyscalebitmap:
GreyScaleBitmap GreyScaleBitmap
--------------- ---------------
@ -422,6 +498,7 @@ GreyScaleBitmap
Creates a copy of the bitmap, greyscaled. Creates a copy of the bitmap, greyscaled.
.. _scriptref-brightnessbitmap:
BrightnessBitmap BrightnessBitmap
---------------- ----------------
@ -436,6 +513,8 @@ Returns a new bitmap with the brightness applied.
If you instead want to apply brightness to the current bitmap, see If you instead want to apply brightness to the current bitmap, see
:ref:`filter_apply_bitmap` :ref:`filter_apply_bitmap`
.. _scriptref-contrastbitmap:
ContrastBitmap ContrastBitmap
-------------- --------------
@ -446,6 +525,7 @@ ContrastBitmap
Changes the constrast of a bitmap, returns a new bitmap with the contrast Changes the constrast of a bitmap, returns a new bitmap with the contrast
applied. applied.
.. _scriptref-posterizebitmap:
PosterizeBitmap PosterizeBitmap
--------------- ---------------
@ -477,6 +557,8 @@ Applying a filter on the current bitmap
FreeBitmap(b); FreeBitmap(b);
end. end.
.. _scriptref-createmaskfrombitmap:
CreateMaskFromBitmap CreateMaskFromBitmap
-------------------- --------------------
@ -485,6 +567,8 @@ CreateMaskFromBitmap
function CreateMaskFromBitmap(Bitmap : integer) : TMask; function CreateMaskFromBitmap(Bitmap : integer) : TMask;
.. _scriptref-findmasktolerance:
FindMaskTolerance FindMaskTolerance
----------------- -----------------
@ -493,6 +577,8 @@ FindMaskTolerance
function FindMaskTolerance(const mask: TMask; var x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; function FindMaskTolerance(const mask: TMask; var x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;
.. _scriptref-findbitmapmasktolerance:
FindBitmapMaskTolerance FindBitmapMaskTolerance
----------------------- -----------------------
@ -501,6 +587,8 @@ FindBitmapMaskTolerance
function FindBitmapMaskTolerance(mask: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; function FindBitmapMaskTolerance(mask: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;
.. _scriptref-finddeformedbitmaptolerancein:
FindDeformedBitmapToleranceIn FindDeformedBitmapToleranceIn
----------------------------- -----------------------------
@ -509,6 +597,8 @@ FindDeformedBitmapToleranceIn
function FindDeformedBitmapToleranceIn(bitmap: integer; var x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean; function FindDeformedBitmapToleranceIn(bitmap: integer; var x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;
.. _scriptref-drawtpabitmap:
DrawTPABitmap DrawTPABitmap
------------- -------------
@ -520,6 +610,7 @@ DrawTPABitmap
on the bitmap by setting the pixel on the bitmap (position defined by tpa point) on the bitmap by setting the pixel on the bitmap (position defined by tpa point)
to *color*. to *color*.
.. _scriptref-drawatpabitmap:
DrawATPABitmap DrawATPABitmap
-------------- --------------
@ -533,6 +624,8 @@ Each point in the TPointArray is *painted* on the bitmap by setting
the pixel on the bitmap (position defined by tpa point) the pixel on the bitmap (position defined by tpa point)
to a color. Colors differ per TPointArray (group). to a color. Colors differ per TPointArray (group).
.. _scriptref-drawatpabitmapex:
DrawATPABitmapEx DrawATPABitmapEx
---------------- ----------------
@ -545,6 +638,7 @@ Each point in the TPointArray is *painted* on the bitmap by setting
the pixel on the bitmap (position defined by tpa point) the pixel on the bitmap (position defined by tpa point)
to a color. Colors are defined by *Colors*. to a color. Colors are defined by *Colors*.
.. _scriptref-drawbitmap:
DrawBitmap DrawBitmap
---------- ----------
@ -555,6 +649,8 @@ DrawBitmap
Draw the bitmap to a TCanvas. Draw the bitmap to a TCanvas.
.. _scriptref-rectanglebitmap:
RectangleBitmap RectangleBitmap
--------------- ---------------
@ -563,6 +659,8 @@ RectangleBitmap
procedure RectangleBitmap(bitmap : integer; const box : TBox; Color : TColor); procedure RectangleBitmap(bitmap : integer; const box : TBox; Color : TColor);
.. _scriptref-floodfillbitmap:
FloodFillBitmap FloodFillBitmap
--------------- ---------------
@ -571,6 +669,8 @@ FloodFillBitmap
procedure FloodFillBitmap(bitmap : integer; const StartPoint : TPoint; const SearchCol,ReplaceCol : TColor); procedure FloodFillBitmap(bitmap : integer; const StartPoint : TPoint; const SearchCol,ReplaceCol : TColor);
.. _scriptref-calculatepixelshift:
CalculatePixelShift CalculatePixelShift
------------------- -------------------
@ -579,6 +679,8 @@ CalculatePixelShift
function CalculatePixelShift(Bmp1,Bmp2 : Integer; CompareBox : TBox) : integer; function CalculatePixelShift(Bmp1,Bmp2 : Integer; CompareBox : TBox) : integer;
.. _scriptref-calculatepixeltolerance:
CalculatePixelTolerance CalculatePixelTolerance
----------------------- -----------------------
@ -586,4 +688,3 @@ CalculatePixelTolerance
function CalculatePixelTolerance(Bmp1,Bmp2 : Integer; CompareBox : TBox; CTS : integer) : extended;') function CalculatePixelTolerance(Bmp1,Bmp2 : Integer; CompareBox : TBox; CTS : integer) : extended;')