int DrawAdd(int x, int y, int width, int height);


Creates a drawing surface.


Return Value


Returns a handle to the Draw surface created.





The x coordinate of the Draw surface.



The y coordinate of the Draw surface.



The width of the Draw surface.



The height of the Draw surface.




DrawAdd() adds a rectangular surface to the screen where you can perform primitive drawing functions such as DrawArc(), DrawCircle(), DrawCircleFill(), DrawLine(), DrawLineTo(), DrawSquare(), and DrawSquareFill().  Use the DrawClear() function to erase any drawing that may have been performed on the surface.  Use DrawSetColor() to specify the color of lines and shape outlines.  Use DrawSetPenWidth() to specify the thickness of lines and shape outlines.  Use DrawSetFillColor() to specify the color of filled shapes.


DrawAdd() sets the default values for line and fill colors to 0x88888888, it resets the pen width to one pixel and it sets the current pen position to 0, 0.  You should always provide the values for these properties any time you call this function, or after calling DrawClear().


NOTE:  Draw surfaces are unaffected by calls to WorldSetxy().  If you need your Draw surface to move, you will need to do so manually by calling DrawSetxy().




Available in DragonFireSDK 1.3 and later.




#include "DragonFireSDK.h"


int MyDraw;


void AppMain()


  MyDraw = DrawAdd(0, 0, 320, 480);

  // Set up my draw colors and pen width...

  DrawSetColor(MyDraw, 0xFF0000);

  DrawSetFillColor(MyDraw, 0x00FF00FF);

  DrawSetPenWidth(MyDraw, 2);

  //Draw a line...

  DrawMoveTo(MyDraw, 10, 10);

  DrawLineTo(MyDraw, 20, 20);

  //Draw another line...

  DrawLine(MyDraw, 20, 20, 10, 20);

  //Draw a hollow circle...

  DrawCircle(MyDraw, 10, 50, 50, 50);

  //Draw a filled circle...

  DrawCircleFill(MyDraw, 10, 110, 50, 50);

  //Draw a hollow square...

  DrawSquare(MyDraw, 80, 50, 50, 50);

  //Draw a fillerd square...

  DrawSquareFill(MyDraw, 80, 110, 50, 50);

  //Draw an arc...

  DrawArc(MyDraw, 140, 75, 25, 0, 90);



void AppExit()





void OnTimer()