Drawing ======= The drawing file holds TMufasaBitmap drawing functions to aid drawing onto bitmaps. The source for this file can be found `here `. ------------ const __SHADOW_COLOR ~~~~~~~~~~~~~~~~~~~~ Integer constant that stores the shadow color for adding a shadow for text drawing. ------------ TMufasaBitmap.FromClient ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.FromClient(Area: TBox); Copy client to bitmap. ------------ TMufasaBitmap.Clear ~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.Clear(); Will clear the entire TMufasaBitmap .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.Clear(); ------------ TMufasaBitmap.ClearArea ~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.ClearArea(area: TBox); Will clear the desired area of the TMufasaBitmap .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.ClearArea(intToBox(5, 5, 10, 10)); ------------ TMufasaBitmap.ClearAllBut ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.ClearAllBut(Area: TBox); Will clear the image, except for the given area. ------------ TMufasaBitmap.AvgBrightness ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.AvgBrightness(); Returns a value between 0 and 100 that defines how bright the image is. ------------ TMufasaBitmap.PeakBrightness ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.PeakBrightness(); Returns the maximum brightness in the image in the range `0..100`. ------------ TMufasaBitmap.DrawBox ~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawBox(box: TBox; fill: boolean; color: TColor); Draws a TBox onto the TMufasaBitmap .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawBox(intToBox(50, 50, 345, 345), false, clLime); ------------ TMufasaBitmap.DrawBox ~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawBox(pt:TPoint; Radius:UInt32; Fill: Boolean; color: TColor); Draws a TBox onto the TMufasaBitmap ------------ TMufasaBitmap.DrawBox ~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawBox(box:TBox; color:TColor = clRed); overload; Overloaded function, will draw the outline of the "box" and includes a optional color parameter (default red). .. note:: - by Ollybest - Last Updated: 19 August 2013 by Ollybest Example: .. code-block:: pascal bmp.DrawBox(IntToBox(50, 50, 345, 345)); ------------ TMufasaBitmap.DrawBox; overload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawBox(x1,y1,x2,y2:Integer; fill:Boolean; color:TColor); overload; Draws a box using the x1, y1, x2, y2 parameters, will fill if 'fill' is set to true using color 'color'. .. note:: - by Olly - Last Updated: 29 October 2013 by Olly Example: .. code-block:: pascal bmp.DrawBox(Box(50, 50, 345, 345)); ------------ TMufasaBitmap.DrawClippedBox ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawClippedBox(box: TBox; fill: boolean; color: TColor); overload; Same as the other TMufasaBitmap.DrawBox but is clipped so it won't draw off the bounds of the bitmap. .. note:: - by Olly - Last Updated: 29 October 2013 by Olly Example: .. code-block:: pascal image.DrawClippedBox(Box(50, 50, 100, 100), true, clLime); ------------ TMufasaBitmap.DrawBoxes ~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawBoxes(boxArr: TBoxArray; fill: boolean; color: TColor); Draws a TBoxArray onto the TMufasaBitmap. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawBoxes([Box(10, 10, 20, 20), Box(50, 50, 250, 250), Box(440, 440, 600, 600)], true, clRed); ------------ TMufasaBitmap.DrawBoxes; overload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawBoxes(boxArr: TBoxArray; fill: boolean; colors: TColorArray); overload; Same as TMufasaBitmap.DrawBoxes() but accepts a extra paramter that allows a color for each box. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawBoxes([Box(10, 10, 20, 20), Box(50, 50, 250, 250), Box(440, 440, 600, 600)], true, [clRed, clLime, clOrange]); ------------ TMufasaBitmap.DrawRect ~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawRect(Rect: TRectangle; color: TColor); Draws a TRectangle onto the TMufasaBitmap ------------ TMufasaBitmap.DrawPoly ~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawPoly(Poly: TPointArray; color: TColor); Draws a polygon onto the TMufasaBitmap ------------ TMufasaBitmap.DrawBitmap ~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawBitmap(bmp: Integer; pnt: TPoint); Draws a bitmap onto the TMufasaBitmap at the desired point. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawBitmap(bmp, point(50, 50)); ------------ TMufasaBitmap.DrawBitmap; overload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function TMufasaBitmap.DrawBitmap(path: string; pt: TPoint): boolean; overload; Same as TMufasaBitmap.DrawBitmap but will load a bitmap from a file specified by the paramter "path", will return if succesful or not. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawBitmap('simba/scripts/foo.png', point(11, 11)); ------------ TMufasaBitmap.DrawCross ~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawCross(pt: TPoint; size: Integer; color: TColor); Draws a cross on the TMufasaBitmap at the TPoint ``pt`` with the desired size. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawCross(Point(200, 200), 4, clLime); ------------ TMufasaBitmap.DrawEllipse ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawEllipse(const pnt: TPoint; const xRadius, yRadius: Integer; const fill: boolean; const color: TColor); Draws an ellipse on the TMufasaBitmap defined by 'pnt', 'xRadius', and 'yRadius'. If 'fill' is true it will fill the ellipse, otherwise it draws just the border. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawEllipse(point(500, 500), 20, 50, true, clLime); ------------ TMufasaBitmap.DrawCircle ~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawCircle(pnt: TPoint; radius: Integer; fill: boolean; color: TColor); Draws a circle on the TMufasaBitmap defined by 'pnt' and 'radius'. If 'fill' is true it will fill the circle, otherwise it draws just the border. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawCircle(point(500, 500), 50, false, clLime); ------------ TMufasaBitmap.DrawPolygon ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawPolygon(polygonPnts: TPointArray; color: TColor); Draws a line between all the points(polygonPnts) to draw a polygon-like shape on the TMufasaBitmap. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawPolygon([point(10, 10), point(100, 100), point(500, 500), point(230, 555)], clLime); ------------ TMufasaBitmap.DrawClippedText ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawClippedText(txt: string; pt: TPoint; font: string; shadow: boolean; color: TColor); Same as drawText, but is clipped so it won't draw off the bounds of the bitmap. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DrawClippedText('hello world!', point(55, 55), 'StatChars', true, clLime); ------------ TMufasaBitmap.DrawTextArray ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawTextArray(txtArr: TStringArray; pts: TPointArray; font: string; shadow: boolean; color: TColor); Draws an array of text on the TMufasaBitmap, each index in the textArr will be be drawn at the same point in the pnt array. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.drawTextArray(['hello', 'world'], [point(50, 50), point(100, 111)], bigchars, false, clBlue); ------------ TMufasaBitmap.DrawTextLines ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DrawTextLines(txtArr: TStringArray; pnt: TPoint; font: string; shadow: boolean; color: TColor); Draws text onto the TMufasaBitmap, each index in the txtArr is put on a different line. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest **Example:** .. code-block:: pascal image.drawTextLines(['olly', 'is', 'the', 'best', ':D'], point(2, 2), statChars, false, clRed); ------------ TMufasaBitmap.Debug ~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.Debug(); Will display the TMufasaBitmap in Simba's debug image form. Note: will only work if the bitmap is managed by Simba .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest **Example:** .. code-block:: pascal Image.Debug(); // or for a non TMufasaBitmap GetMufasaBitmap(bitmap).Debug(); ------------ TMufasaBitmap.DebugEx ~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DebugEx(SetManaged: Boolean=True; MinSize: Int32=128); constref; Will display the TMufasaBitmap in Simba's debug image form. Note that if the bitmap isn't managed by Simba it will be added if ``SetManaged`` is ``True``. Alterantive parameter ``MinSize`` is used to better display small images. **Example:** pascal:: Image.DebugEx(); // or for a non TMufasaBitmap GetMufasaBitmap(bitmap).DebugEx(); ------------ TMufasaBitmap.UpdateDebugImage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.UpdateDebugImage(); Will update Simba's debug image form with the current image. ------------ TMufasaBitmap.DebugTPA ~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DebugTPA(tpa: TPointArray; drawPoints: boolean = true); Will debug a TPointArray onto the TMufasaBitmap, parameter drawPoints is a optional parameter and by default is enabled, if enabled it will draw the points in the array. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DebugTPA(tpa); ------------ TMufasaBitmap.DebugATPA ~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DebugATPA(const ATPA: T2DPointArray); Will debug a T2DPointArray onto the TMufasaBitmap. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DebugATPA(ATPA); ------------ TMufasaBitmap.DebugDTM ~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal procedure TMufasaBitmap.DebugDTM(dtm: Integer; area: TBox; color: TColor); Will search for the dtm in the desired area, drawing a cross at each point that is found. .. note:: - by Ollybest - Last Updated: 19 July 2013 by Ollybest Example: .. code-block:: pascal image.DebugDTM(myDTM, mainScreen.getBounds(), clRed); ------------