[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

Pen Package

NOTE: This package is under construction. The features have not been finalized.

The pen package is the SparForte drawing environment. It is based on the Simple DirectMedia Layer portable drawing environment originally created by Loki Games, a Linux games company. However, the SDL is strictly a hardware interface: it contains few drawing primitives. The pen package extends the SDL for useful drawing.

The drawing surface is called a canvas. The canvas can be a window or the hardware screen, but it can also be an off-screen area in memory. The drawing area is divided up into a number of rectangular pixels.

To open a new canvas in a X Windows window, use:

=> pen.new_window_canvas( 256, 256, 16, canvas_id )
=> (Assuming canvas_id is a new pen.canvas_id variable)

=> pen.set_title( canvas_id, "Drawing Area" )

This canvas will be 256 pixels wide, 256 pixels high, a minimum of 16-bit colour and it will have an X windows title of "Drawing Area". canvas_id is the id number referring to the canvas.

[A Window Canvas]

The coordinate system of the canvas has an origin point at the top-left corner of the drawing surface. The coordinate lines actually fall between the pixels so that coordinate (0,0) is actually to the upper-left of the first pixel. The coordinates are floating point numbers representing a percentage of the canvas. The canvas ranges from (0,0) to (100,100).

The pen package draws on the canvas using an imaginary pen. The pen has several properties:

  • Position - the location of the pen on the canvas
  • Direction - the angle of rotation of the pen
  • Ink - the solid colour used drawing with the pencil brush
  • Pattern - multi-colour ink used for drawing
  • Brush - how the ink is spread on the canvas
  • Mode - how the ink is combined with the canvas pixels

Pen modes include:

  • Off - the pen moves but no drawing takes place
  • Copy - the ink overwrites the existing pixels on the canvas. This is the normal pen mode. (default)
  • Invert - the ink is exclusive-or'd with the pixels. Where the ink is 0%, the canvas is unchanged. Where the ink is 100%, the canvas pixels are transformed to the opposite colour. This is useful for simple hilighting that doesn't lose information on the canvas.
  • Add - adds the canvas pixels to the ink pixels
  • Subtract - removes the canvas pixels from the ink pixels
  • Average - blends the canvas and ink pixels, taking the average value
  • Fade - brighten or darken the canvas pixels (unfinished)
  • Min - where the ink is not 0, choose the darker pixel between the ink and the canvas. If the ink is 0, leave the canvas unchanged. (unfinished)
  • Max - where the ink is not 0, choose the brighter pixel between the ink and the canvas. If the ink is 0, leave the canvas unchanged. (unfinished)

The brush describes the pattern the pen will draw with:

  • Pencil - drawing by single pixels of a solid colour ink (default)
  • Smear - (Not complete)
  • Stamp - draw with a pattern aligned to the shape
  • Stretch - (Not complete) Resize the pattern to fit a shape
  • Tile - draw with a pattern aligned to the canvas

Not all pen modes are available on all kinds of canvas.

pen_brush.tile
pen_brush.tile
pen_mode.copy
pen_mode.copy
pen_mode.invert
pen_mode.invert
pen_mode.invert
pen_mode.add
pen_mode.invert
pen_mode.average
pen_mode.invert
pen_mode.subtract

Colors are made of percentages of red, green and blue. pen.color_name is an enumerated type with the standard X windows color names.

=> pen.set_pen_mode( canvas_id, pen_mode.copy )
=> pen.set_pen_brush( canvas_id, pen_brush.pencil)
=> pen.set_pen_ink( canvas_id, 100, 0, 0 )

These commands set the pen brush to a pencil (single pixels) and the mode to copy (the pencil pixels will overwrite whatever pixels currently on the canvas background). The pen pixels will be bright red.

This is how you would load and draw an image. (Not all features are supported yet.)

=> pen.set_rect( r, 0, 0, 100, 100 )
=> (Assuming r is a new pen.rect variable)
=> pen.new_window_canvas( 100,100, 32, c )
=> (Assuming c is a new pen.canvas_id variable)
=> pen.new_canvas("i.png", img )
=> (Assuming img is a new pen.canvas_id variable)
=> pen.set_pen_pattern( c, img )
=> pen.set_pen_brush( c, pen_brush.tile )
=> pen.set_pen_mode( c, pen_mode.copy )
=> pen.paint_rect(c, r )
  set_rect(r, l, t, r, b)   b := is_empty_rect( r )  offset_rect( r, dx, dy )
  inset_rect( r, dx, dy )   intersect_rect( r,r1,r2) b := inside_rect( ir, or )
  b := in_rect( x, y, r )                                                     

  frame_ellipse( id, r )    frame_rect( id, r )      fill_ellipse( id, r )    
  paint_rect( id, r )       fill_rect(id,rct,r,g,b)  fill_rect(id,r,cn)       
  line_to( id, x, y )       line( id, dx, dy )       hline( id, x1, x2, y )   
  vline( id, x, y1, y2 )    move_to( id, x, y )      move( id, dx, dy )       
  clear                     clear( r, g, b)          clear( cn )              

  get_pen_mode( id )        get_pen_brush( id )      set_pen_ink(id,r,g,b)    
  set_pen_ink(id,cn)        set_pen_mode( id, m)     set_pen_pattern( id,pid) 
  set_pen_brush( id,brush ) set_font( c, f, p )*     put( c, s )*              
  p := greyscale( r,g,b) blend(r1,g1,b1,r2,g2,b2,r,g,b) fade(r1,g1,b1,p,r,g,b)

  new_canvas(h,v,c,id) new_screen_canvas(h,v,c,id) new_window_canvas(h,v,c,id)
  new_canvas(p,id)     new_gl_screen_canvas(h,v,c,id)  save_canvas(p,id) 
  close_canvas( id )        wait_to_reveal( id )     reveal( id )             
  reveal_now( id )
 
Help Command: Contents of the pen package

pen.blend( r1, g1, b1, r2 ,g2 ,b2 ,r, g, b )

 

Compute the average for the two RGB colours and return the resulting RGB colour.

Example

pen.blend( 0, 0, 0, 100, 100, 100, r, g, b ); -- RGB will be 50;

Parameters

Param Mode Type Default Description
r1 in pen.rgbcomponent required percentage of red in the first color
g1 in pen.rgbcomponent required percentage of green in the first color
b1 in pen.rgbcomponent required percentage of blue in the first color
r2 in pen.rgbcomponent required percentage of red in the second color
g2 in pen.rgbcomponent required percentage of red in the second color
b2 in pen.rgbcomponent required percentage of red in the second color
r out pen.rgbcomponent required percentage of red in the averaged color
g out pen.rgbcomponent required percentage of green in the averaged color
b out pen.rgbcomponent required percentage of blue in the averaged color

Exceptions

-

See Also

pen.fade
pen.greyscale

Compare With

-

pen.clear( c )
pen.clear( c, r, g, b)
pen.clear( c, cn )

 

Fill the drawing area with the specified color. The color may be specified as a color name or an RGB percentage value. If the color name is omitted, the current pen color is used. It is the equivalent of paint_rect/fill_rect on the entire canvas, or the built-in clear command for a terminal session.

Example

pen.clear( my_canvas, pen_color_name.turquoise );

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
r in pen.rgbcomponent required percentage of red in the color
g in pen.rgbcomponent required percentage of green in the color
b in pen.rgbcomponent required percentage of blue in the color

OR

cn in pen_color_name required the name of the colour to clear with

Exceptions

-

See Also

pen.paint_rect
pen.fill_rect
pen.frame_rect

Compare With

-

pen.fade( r1, g1, b1, p, r, g, b )

 

Brighten or darken a color by percentage p and return the resulting RGB colour. The color will be brightened if the percentage is negative. The resulting color will never have components more than 100.0 or less than 0.0.

Example

pen.fade( 100, 100, 50, 50, r, g, b); -- RGB will be 50/50/25

Parameters

Param Mode Type Default Description
r1 in pen.rgbcomponent required percentage of red in the color
g1 in pen.rgbcomponent required percentage of green in the color
b1 in pen.rgbcomponent required percentage of blue in the color
p in float required percentage to fade or brighten by
r out pen.rgbcomponent required percentage of red in the faded color
g out pen.rgbcomponent required percentage of green in the faded color
b out pen.rgbcomponent required percentage of blue in the faded color

Exceptions

-

See Also

pen.blend
pen.greyscale

Compare With

-

pen.fill_ellipse( c, rt, r, g, b )
pen.fill_ellipse( c, rt, cn )

 

Fill ellipse bounded by rectangle r in canvas c using the specified RGB color or color name. If wait_to_reveal is used, the results will not appear until revealed.

Example

=> pen.new_window_canvas( 100, 100, 32, c )
=> (Assuming c is a new pen.canvas_id variable)
=> pen.set_rect( r, 10, 10, 90, 90 );
=> (Assuming r is a new pen.rect variable)
=> pen.fill_ellipse( c, r, pen_color_name.yellow )
[Ellipse screehshot]

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
rt in pen.rect required the rectangle surrounding ellipse to fill
r in pen.rgbcomponent required percentage of red in the color
g in pen.rgbcomponent required percentage of green in the color
b in pen.rgbcomponent required percentage of blue in the color

OR

cn in pen.color_name required the name of the color

Exceptions

-

See Also

pen.frame_rect
pen.paint_rect
pen.clear

Compare With

-

Known Bugs

An ellipse in a (0,0,100,100) rectangle throws an exception due to a rounding error.

pen.fill_rect( c, rt, r, g, b )
pen.fill_rect( c, rt, cn )

 

Fill rectangle rt in canvas c using the specified RGB color or color name. If wait_to_reveal is used, the results will not appear until revealed.

Example

=> pen.new_window_canvas( 100, 100, 32, c )
=> (Assuming c is a new pen.canvas_id variable)
=> pen.set_rect( r, 10, 10, 90, 90 );
=> (Assuming r is a new pen.rect variable)
=> pen.fill_rect( c, r, 0, 100, 100 )
[Ellipse screehshot]

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
rt in pen.rect required the rectangle to fill
r in pen.rgbcomponent required percentage of red in the color
g in pen.rgbcomponent required percentage of green in the color
b in pen.rgbcomponent required percentage of blue in the color

OR

cn in pen.color_name required the name of the color

Exceptions

-

See Also

pen.frame_rect
pen.paint_rect
pen.clear

Compare With

-

pen.frame_ellipse( c, r )

 

Draw an outline around ellipse bounded by rectangle r in canvas c using the current pen. If wait_to_reveal is used, the results will not appear until revealed.

Example

pen.frame_ellipse( canvas_id, pie_graph_rect );

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
r in pen.rect required the rectangle surrounding ellipse to border

Exceptions

-

See Also

pen.fill_ellipse
pen.paint_ellipse

Compare With

-

Bugs

An ellipse in a (0,0,100,100) rectangle throws an exception due to a rounding error.

pen.frame_rect( c, r )

 

Draw an outline around rectangle r in canvas c using the current pen. If wait_to_reveal is used, the results will not appear until revealed.

Example

pen.frame_rect( canvas_id, background_rect );

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
r in pen.rect required the rectangle to border

Exceptions

-

See Also

pen.clear
pen.fill_rect
pen.paint_rect

Compare With

-

b := pen.get_pen_brush( c )

 

Return the current pen brush for canvas c.

Example

pen_brush := pen.get_pen_brush( canvas_id );

Parameters

Param Mode Type Default Description
b return value pen.pen_brush required the pattern application mode
c in pen.canvas_id required the drawing area canvas

Exceptions

-

See Also

pen.set_pen_brush

Compare With

-

pen.get_pen_ink( c, r, g, b )

 

Return the current pen solid drawing colour in canvas c.

Example

pen.get_pen_ink( canvas_id, red, green, blue );

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
r out pen.rgbcomponent required percentage of red in the ink color
g out pen.rgbcomponent required percentage of green in the ink color
b out pen.rgbcomponent required percentage of blue in the ink color

Exceptions

-

See Also

pen.set_pen_ink

Compare With

-

m := pen.get_pen_mode( c )

 

Return the current pen mode for canvas c.

Example

pen_mode := pen.get_pen_mode( canvas_id );

Parameters

Param Mode Type Default Description
b return value pen.pen_mode required the pen mode
c in pen.canvas_id required the drawing area canvas

Exceptions

-

See Also

pen.set_pen_mode

Compare With

-

p := pen.greyscale( r, g, b )

 

Compute the greyscale for the RGB color and return the RGB percentage (where RGB will be the same). This is weighted for the human eye.

Example

p := pen.greyscale( 10, 20, 30 );

Parameters

Param Mode Type Default Description
p return value pen.rgbcomponent required percentage to use for red, green and blue in the grey color
r in pen.rgbcomponent required percentage of red in the color
g in pen.rgbcomponent required percentage of green in the color
b in pen.rgbcomponent required percentage of blue in the color

Exceptions

-

See Also

pen.blend
pen.fade

Compare With

-

pen.hline( c, x1, x2, y )

 

Draw a horizontal line between (x1,y) and (x2,y) on canvas c in the current pen. Ignores clipping region. If wait_to_reveal is used, the results will not appear until revealed.

Example

pen.hline( canvas_id, 0, 100, 50);

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
x1 in pen.coordinate required the left-most x coordinate
x2 in pen.coordinate required the right-most x coordinate
y in pen.coordinate required the y coordinate

Exceptions

-

See Also

pen.line
pen.vline

Compare With

-


b := pen.in_rect( x, y, r )

True if point (x, y) is inside of rectangle r.
Example: b := pen.in_rect( mouse_x, mouse_y, icon_rect );
Ada Equivalent: N/A - Pen.in_rect (SparForte package)
Parameters:
b result boolean required true if ir is contained in or
x in pen.coordinate required the horizontal position
yr in pen.coordinate required the vertical position
 


pen.inset_rect( r, dx, dy )

Change the size of the rectangle by dx horizontal and dy vertical. Negative values cause the rectangle to grow. The center of the rectangle remains unchanged.
Example: pen.inset_rect( shrinking_rect, 10, 10 ); -- shrink by 10% of canvas
Ada Equivalent: N/A - Pen.inset_rect (SparForte package)
Parameters:
r in out pen.rect required the rectangle to shift
dx in pen.coordinate required the horizontal change to the left and right
dy in pen.coordinate required the vertical change to the top and bottom
 


b := pen.inside_rect( ir, or )

True if ir is a rectangle inside of rectangle or.
Example: b := pen.inside_rect( small_rect, big_rect );
Ada Equivalent: N/A - Pen.inside_rect (SparForte package)
Parameters:
b result boolean required true if ir is contained in or
ir in pen.rect required the inner rectangle
or in pen.rect required the outer rectangle
 


pen.intersect_rect( r, r1, r2 )

Calculate the overlap rectangle (if any) between rectangles r1 and r2.
Example: pen.intersect_rect( overlap_rect, player_sprite, monster_sprite );
Ada Equivalent: N/A - Pen.intersect_rect (SparForte package)
Parameters:
r out pen.rect required the intersection rect or empty rect if none
r1 in pen.rect required a rectangle
r2 in pen.rect required a rectangle
 


b := pen.is_empty_rect( r )

True if r is a rectangle that contains nothing.
Example: bool := pen.is_empty_rect( some_rect );
Ada Equivalent: N/A - Pen.isEmptyRect (SparForte package)
Parameters:
c result boolean required true if rectangle is empty
r in pen.rect required the rectangle to test
 


pen.line( c, dx, dy )

Draw a line in the current pen from the current pen position to a new relative position offset by dx and dy. If wait_to_reveal is used, the results will not appear until revealed.
Example: pen.line( canvas_id, 0, 10 );
Ada Equivalent: N/A - Pen.line (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
dx in pen.coordiante required the horizontal change from the current pen position
dy in pen.coordiante required the vertical change from the current pen position
 


pen.line_to( c, x, y )

Draw a line with the pen from the current pen position to a new position (x,y). If wait_to_reveal is used, the results will not appear until revealed.
Example: pen.line_to( canvas_id, 75, 10 );
Ada Equivalent: N/A - Pen.line (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
x in pen.coordiante required the new horizontal position
y in pen.coordiante required the new vertical position
 


pen.move( c, dx, dy )

Move the pen from the current pen position to a new relative position offset by dx and dy. No line will be drawn.
Example: pen.move( canvas_id, 0, 10 );
Ada Equivalent: N/A - Pen.move (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
dx in pen.coordiante required the horizontal change from the current pen position
dy in pen.coordiante required the vertical change from the current pen position
 


pen.move_to( c, x, y )

Move the pen from the current pen position to a new position (x,y). No line will be drawn.
Example: pen.move_to( canvas_id, 75, 10 );
Ada Equivalent: N/A - Pen.move (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
x in pen.coordiante required the new horizontal position
y in pen.coordiante required the new vertical position
 


pen.new_canvas( h, v, c, id )
pen.new_canvas( s, id )

Create a new drawing area canvas that does not appear on the display. If the first parameter is a string, load the image file from path s into a canvas big enough to hold it. Otherwise, the parameters are the horizontal and vertical dimensions of the new canvas and the canvas id of an existing on-screen canvas to copy over any additional settings. To apply the contents of the canvas to the on-screen canvas, use set_pen_pattern.
Example: pen.new_canvas( 100, 100, main_canvas_id, hidden_canvas_id );
Example: pen.new_canvas( "company_logo.png", logo_id );
Ada Equivalent: N/A - Pen.newCanvas (SparForte package)
Parameters:
h in positive required the minimum horizontal size in pixels
v in positive required the minimum vertical size in pixels
c in positive required the existing on-screen canvas to use as a basis for the new canvas
id out pen.canvas_id required the identification number for the off-screen canvas
s in universal_string required the path to a file that SDL_image can load
(JPEG, GIF, PNG, etc.)

An exception may be thrown if the existing canvas does not exist.

 


pen.new_gl_screen_canvas( h, v, c, id )

Create a new OpenGL drawing area canvas that covers the entire display screen.
Example: pen.new_screen_canvas( 100, 100, 16, canvas_id );
Ada Equivalent: N/A - Pen.newGLScreenCanvas (SparForte package)
Parameters:
h in positive required the minimum horizontal size in pixels
v in positive required the minimum vertical size in pixels
c in positive required the minimum pixel bits (8, 16, 24 or 32)
id out pen.canvas_id required the identification number for the new canvas
 


pen.new_gl_window_canvas( h, v, c, id )

Create a new OpenGL drawing area canvas in a separate operating system window. Multiple windows may not be supported by the SDL library.
Example: pen.new_gl_window_canvas( 100, 100, 16, canvas_id );
Ada Equivalent: N/A - Pen.newGLWindowCanvas (SparForte package)
Parameters:
h in positive required the minimum horizontal size in pixels
v in positive required the minimum vertical size in pixels
c in positive required the minimum pixel bits (8, 16, 24 or 32)
id out pen.canvas_id required the identification number for the new canvas
 


pen.new_screen_canvas( h, v, c, id )

Create a new drawing area canvas that covers the entire display screen.
Example: pen.new_screen_canvas( 100, 100, 16, canvas_id );
Ada Equivalent: N/A - Pen.newScreenCanvas (SparForte package)
Parameters:
h in positive required the minimum horizontal size in pixels
v in positive required the minimum vertical size in pixels
c in positive required the minimum pixel bits (8, 16, 24 or 32)
id out pen.canvas_id required the identification number for the new canvas
 


pen.new_window_canvas( h, v, c, id )

Create a new drawing area canvas in a separate operating system window. Multiple windows may not be supported by the SDL library.
Example: pen.new_window_canvas( 100, 100, 16, canvas_id );
Ada Equivalent: N/A - Pen.newWindowCanvas (SparForte package)
Parameters:
h in positive required the minimum horizontal size in pixels
v in positive required the minimum vertical size in pixels
c in positive required the minimum pixel bits (8, 16, 24 or 32)
id out pen.canvas_id required the identification number for the new canvas
 


pen.offset_rect( r, dx, dy )

Move rectangle by dx horizontal and dy vertical. The size of the rectangle remains unchanged.
Example: pen.offset_rect( player_sprite, 1, 0 );
Ada Equivalent: N/A - Pen.offset_rect (SparForte package)
Parameters:
r in out pen.rect required the rectangle to shift
dx in pen.coordinate required the horizontal change to the left and right
dy in pen.coordinate required the vertical change to the top and bottom
 

pen.paint_ellipse( c, r )

 

Fill ellipse bounded by rectangle r in canvas c using the current pen. If wait_to_reveal is used, the results will not appear until revealed.

Example

pen.paint_ellipse( canvas_id, pie_graph_rect );

Parameters

Param Mode Type Default Description
c in pen.canvas_id required the drawing area canvas
r in pen.rect required the rectangle surrounding ellipse to fill

Exceptions

-

See Also

pen.frame_ellipse
pen.fill_ellipse

Compare With

-

Known Bugs

An ellipse in a (0,0,100,100) rectangle throws an exception due to a rounding error.


pen.paint_rect( c, r )

Fill rectangle r in canvas c using the current pen. If wait_to_reveal is used, the results will not appear until revealed.
Example: pen.frame_rect( canvas_id, background_rect );
Ada Equivalent: N/A - Pen.fillRect (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
r in pen.rect required the rectangle to border
 


pen.reveal( c )

Undo a wait_to_reveal. The time of hiding the drawing has been completed and the results are ready to be shown. Repeated use of this function decrements a counter and the results are not shown until all reveals are performed (to allow the drawing to be nested).
Example: pen.reveal( c )
Ada Equivalent: N/A - Pen (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
 


pen.reveal_now( c )

Undo all wait_to_reveal calls and immediately show the results of any hidden drawing. Further drawing will be immediately visible. This is intended for debugging or use at the command prompt. Further reveal's will have no effect.
Example: pen.reveal_now( c )
Ada Equivalent: N/A - Pen (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
 


pen.save_canvas( s, id )


Save the canvas as a BMP image file. An exception is raised if the image cannot be saved.
Example: pen.save_canvas( "company_logo.png", logo_id );
Ada Equivalent: N/A - Pen
Parameters:
s in universal_string required the path to a file to save the image as
id out pen.canvas_id required the identification number for the offscreen canvas

Restrictions

Not allowed in a restricted shell

 


pen.set_pen_brush( c, b )

Change the current pen brush (pattern application mode) for canvas c.
Example: pen.set_pen_brush( canvas_id );
Ada Equivalent: N/A - Pen.setPenBrush (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
b result pen.brush required the new pattern application mode
 


pen.set_pen_ink( c, r, g, b )
pen.set_pen_ink( c, n )

Change the current pen solid drawing colour in canvas c.
Example: pen.set_pen_ink( canvas_id, red, green, blue );
pen.set_pen_ink( canvas_id, pen.color_name.skyblue );
Ada Equivalent: N/A - Pen.setPenInk (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
r in pen.rgbcomponent required percentage of red in the color
g in pen.rgbcomponent required percentage of green in the color
b in pen.rgbcomponent required percentage of blue in the color
n in pen.color_name required the name of the colour
 


m := pen.set_pen_mode( c )

Change the current pen mode for canvas c.
Example: pen_mode := pen.get_pen_mode( canvas_id );
Ada Equivalent: N/A - Pen.getPenMode (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
m in pen.pen_mode required the pen mode
 


pen.set_pen_pattern( c, pid )

Change the drawing pattern of canvas c to canvas pid.
Example: pen.set_pen_pattern( canvas_id, company_logo_canvas_id );
Ada Equivalent: N/A - Pen.setPenPattern (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
pid in pen.canvas_id required the canvas to use as the drawing pattern
 


pen.set_rect( r, l, t, r, b )

Assign coordinates to a rectangle.
Example: set_rect( full_canvas, 0, 0, 100, 100 );
Ada Equivalent: N/A - Pen.setRect (SparForte package)
Parameters:
r in pen.rect required the rectangle
l in pen.coordinate required the left coordinate
t in pen.coordinate required the top coordinate
r in pen.coordinate required the right coordinate
b in pen.coordinate required the bottom coordinate
 


pen.set_title( c, t )

Change the title of canvas c to string t. On a window canvas, update the window title bar.
Example: set_title( canvas_id, "Graph of Results" );
Ada Equivalent: N/A - Pen.setTitle (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
t in universal_string required the new title
 


pen.wait_to_reveal( c )

Begin to hide the results of the drawing commands. Continue to hide until revealed when the final results are shown. Repeated use of this function increments a counter and the results are not shown until all reveals are performed (to allow the drawing to be nested). This call speeds drawing in two ways (1) it only shows the final result in the case of overlapping drawing, (2) the display will not have to be refreshed after each drawing operation.
Example: pen.wait_to_reveal( c )
Ada Equivalent: N/A - Pen (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
 


pen.vline( c, x, y1, y2 )

Draw a vertical line between (x,y1) and (x,y2) on canvas c in the current pen. Ignores clipping region. If wait_to_reveal is used, the results will not appear until revealed.
Example: pen.set_vline( canvas_id, 50, 0, 100);
Ada Equivalent: N/A - Pen.vline (SparForte package)
Parameters:
c in pen.canvas_id required the drawing area canvas
x in pen.coordinate required the x coordinate
y1 in pen.coordinate required the top-most y coordiante
y2 in pen.coordinate required the bottom-most y coordinate
 
[Right Submenu]

 Summary

 arrays

 btree_io

 calendar

 cgi

 chains

 command_line

 db/ postgresql

 dbm

 directory_operations

 doubly_linked...

 dynamic_hash_...

 enums

 exceptions

 files

 gnat.cgi

 gnat.crc32

 hash_io

 lock_files

 memcache

 memcache.highread

 mysql

 mysqlm

 numerics

 os

 pen

 pen (OpenGL)

 records

 sound

 source_info

 stats

 strings

 System

 teams

 templates

 text_io

 units

[Back to Top] Back To Top [Small Forte Symbol]