Drawing

The drawing file holds TMufasaBitmap drawing functions to aid drawing onto bitmaps.

The source for this file can be found here.

TMufasaBitmap.clear

procedure TMufasaBitmap.clear();

Will clear the entire TMufasaBitmap

Note

  • by Ollybest
  • Last Updated: 19 July 2013 by Ollybest

Example:

tmb.clear();

TMufasaBitmap.clearArea

procedure TMufasaBitmap.clearArea(area: TBox);

Will clear the desired area of the TMufasaBitmap

Note

  • by Ollybest
  • Last Updated: 19 July 2013 by Ollybest

Example:

tmb.clearArea(intToBox(5, 5, 10, 10));

TMufasaBitmap.drawBox

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:

tmb.drawBox(intToBox(50, 50, 345, 345), false, clLime);

TMufasaBitmap.drawBox

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:

tmb.drawBox(intToBox(50, 50, 345, 345));

TMufasaBitmap.drawBox; overload

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:

tmb.drawBox(intToBox(50, 50, 345, 345));

TMufasaBitmap.drawClippedBox

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:

tmb.drawClippedBox(intToBox(50, 50, 100, 100), true, clLime);

TMufasaBitmap.drawBoxes

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:

tmb.drawBoxes([intToBox(10, 10, 20, 20), intToBox(50, 50, 250, 250),
               intToBox(440, 440, 600, 600)], true, clRed);

TMufasaBitmap.drawBoxes; overload

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:

tmb.drawBoxes([intToBox(10, 10, 20, 20), intToBox(50, 50, 250, 250),
               intToBox(440, 440, 600, 600)], true, [clRed, clLime, clOrange]);

TMufasaBitmap.drawRoundBox

procedure TMufasaBitmap.drawRoundBox(const box: TBox; const roundness: integer; const fill: boolean; const color: TColor);

Draws a box with “round” corners onto the TMufasaBitmap, parameter roundness will judge curved the corners are.

Note

  • by Ollybest
  • Last Updated: 19 July 2013 by Ollybest

Example:

tmb.drawRoundBox(intToBox(222, 222, 666, 666), 111, true, clOrange);

TMufasaBitmap.drawBitmap

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:

tmb.drawBitmap(bmp, point(50, 50));

TMufasaBitmap.drawBitmap; overload

function TMufasaBitmap.drawBitmap(path: string; pnt: 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:

tmb.drawBitmap('simba/scripts/foo.png', point(11, 11));

TMufasaBitmap.drawCross

procedure TMufasaBitmap.drawCross(pnt: TPoint; size: integer; color: TColor);

Draws a cross on the TMufasaBitmap at the TPoint(pnt) with the desired size.

Note

  • by Ollybest
  • Last Updated: 19 July 2013 by Ollybest

Example:

tmb.drawCross(point(200, 200), 4, clLime);

TMufasaBitmap.drawEllipse

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:

tmb.drawEllipse(point(500, 500), 20, 50, true, clLime);

TMufasaBitmap.drawCircle

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:

tmb.drawCircle(point(500, 500), 50, false, clLime);

TMufasaBitmap.drawPolygon

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:

tmb.drawPolygon([point(10, 10), point(100, 100), point(500, 500), point(230, 555)], clLime);

TMufasaBitmap.drawText

procedure TMufasaBitmap.drawText(txt: string; pnt: TPoint; font: string; shadow: boolean; color: TColor);

Draws a string(text) with the desired font onto the TMufasaBitmap at the TPoint(pnt).

Note

  • by Ollybest
  • Last Updated: 19 July 2013 by Ollybest

Example:

tmb.drawText('hello world!', point(55, 55), upchars, false, clRed);

TMufasaBitmap.drawText; overload

procedure TMufasaBitmap.drawText(txt: string; pnt: TPoint; color: TColor); overload;

Same as TMufasaBitmap.drawText, but no shadow boolean (enabled), and no font parameter(will use statchars).

Note

  • by Ollybest
  • Last Updated: 19 July 2013 by Ollybest

Example:

tmb.drawText('hello world!', point(55, 55), clLime);

TMufasaBitmap.drawClippedText

procedure TMufasaBitmap.drawClippedText(txt: string; pnt: 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:

tmb.drawClippedText('hello world!', point(55, 55), 'StatChars', true, clLime);

TMufasaBitmap.drawTextArray

procedure TMufasaBitmap.drawTextArray(txtArr: TStringArray; pnts: 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:

tmb.drawTextArray(['hello', 'world'], [point(50, 50), point(100, 111)], bigchars, false, clBlue);

TMufasaBitmap.drawTextLines

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:

tmb.drawTextLines(['olly', 'is', 'the', 'best', ':D'], point(2, 2), statChars, false, clRed);

TMufasaBitmap.debug

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:

tmb.debug();
// or for a non TMufasaBitmap
getMufasaBitmap(bitmap).debug();

TMufasaBitmap.debugTPA

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:

tmb.debugTPA(tpa);

TMufasaBitmap.debugATPA

procedure TMufasaBitmap.debugATPA(const atpa: T2DPointArray);

Will debug a T2DPointArray onto the TMufasaBitmap.

Note

  • by Ollybest
  • Last Updated: 19 July 2013 by Ollybest

Example:

tmb.debugATPA(atpa);

TMufasaBitmap.debugDTM

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:

tmb.debugDTM(myDTM, mainScreen.getBounds(), clRed);