Index Parent

Tablet class


The Tablet class is used to create an empty space to draw on.

Note that you may use the tablet only if the window is opened and that what you draw in the tablet is not saved: you have to redraw all your stuff anytime the redraw attribute is notified, if your tablet is x-y unlimited or anytime the window, the tablet risides in, is opened.

You may allocate up to 256 pen; they may be freed with TBReleasePen method, anyway they are freed anytime the window, the tablet risides in, is closed; so if you need some pens, wait for window Open attribute to be 1 and reserve them via TBAllocPen.

Note that a tablet is:

 

Attributes
Name Type Class Note
TBAPen M ISGN G2N A pen value:
  • A fixed pen, which means a number or one of:
    • 0 SHINE
    • 1 HALFSHINE
    • 2 BACKGROUND
    • 3 HALFSHADOW
    • 4 SHADOW
    • 5 TEXT
    • 6 FILL
    • 7 MARK
  • An integer rappresenting a pen allocated via AllocPen method
TBBPen M ISGN G2N B pen value. See TBAPen
TBDrMd M ISGN G2N Draw mode, a number or one of:
  • JAM1
  • JAM2
  • COMPLEMENT
  • INVERSVID
TBDrPt N ISGN Draw pattern
TBOPen M ISGN G2N O pen value. See TBAPen
TBRedraw B G If your tablet is s-y unlimited, you must setup a notification on this object with Everytime as trigger value. When you are notified, you must redraw the object. If your object is x-y limited, this is notified only when the window, the tablet resides in, is opened.

 

Methods
Name Parameters Note
TBAllocPen <spec> Allocate the best pen that matches the Poppen or Popimage specification and write the number of the allocated pen in pen. The pen returned may be used as value for TBAPen, TBBPen and TBOPen attributes. Up to 256 pens may be allocated. Note that pens are released anytime the window the tablet resides in is closed. Any pen may be released at any time via ReleasePen.
TBAreaDraw <sx>,<sy><dx>,<dy> Add a line from <sx,sy>the current position to <dx,dy> to the buffer
TBAreaEllipse <x>,<y>,<hr>,<yr> Add an ellipse with center in <x,y> and hr horiz radius, yr vert radius to the buffer; to draw a circle, set yr=hr
TBAreaEnd - Draw the shapes added to the buffer
TBAreaMove <x>,<y> Move the buffered raster to the position <x,y>
TBClear - Write the object background
TBDraw <sx>,<sy><dx>,<dy> Draw a line from <sx,sy>the current position to <dx,dy> to the buffer
TBDrawPic <file>[trans/N],[sx/N],[sy/N],
[dx/N],[dy/N],[width/N],[height/N]
Draw the rectangle <sx,sy> <sx+width-1,sy+height-1> from the picture specified to the tablet at <dx,dy>
TBDrawEllipse <x>,<y>,<hr>,<yr> Draw an ellipse with center in <x,y> and hr horiz radius, yr vert radius; to draw a circle, set yr=hr
TBFlood <mode>,<x>,<y> Flood an area starting at <x,y>, till a pixel that:
  • if mode is 0 or Outline - has not the same color of O pen
  • if mode is 1 or Color - has the same color of the pixel at <x,y>
TBRectFill <sx>,<sy>,<dx>,<dy> Draw a rectangle from <sx,sy> to <dx,dy>
TBReleasePen <pen> Release a pen allocated via TBAllocatePen
TBSetAfPt [stem] Set fill pattern. A fill pattern is supplied via a stem name, which contains in 0,...,n the words that defines the pattern. Note that only the first power of 2 number or considered. To clear the area pattern, omit the argument
TBSetOutlineOff - Set outline mode off
TBScroll <dx>,<dy>,<left>,<top>,<width>,<height>  
TBText <text>,<tx>,<ty> Draw the text at x,y position
TBTextSize <text>,<stem> Compute the dimension of text and writes in stem:
  • Width
  • Height
  • MinX
  • MaxX
TBWritePixel <penx> Write the pixel at <x,y>