A pen is a drawing tool for drawing outlines. It is used for drawing
lines and painting the outline of rectangles, ellipses, etc. It has a
colour, a width and a style. The style defines what dash pattern, if
any, should be applied. The default is a solid line, but a set of
predefined dashes or a custom pattern can be used.
The following standard pens are available to all applications:
Wx::NULL_PEN Wx::RED_PEN Wx::CYAN_PEN Wx::GREEN_PEN Wx::BLACK_PEN Wx::WHITE_PEN Wx::TRANSPARENT_PEN Wx::BLACK_DASHED_PEN Wx::GREY_PEN Wx::MEDIUM_GREY_PEN Wx::LIGHT_GREY_PENOn a monochrome display, wxRUby shows all non-white pens as black.
Do not initialize Pens before the application commences, since other
required structures may not have been set up yet. Instead, define
methods which return Pens, and initialize them on first call.
PenList, DC, DC#set_pen, Brush
Wx::SOLID
)
Constructs a pen from a colour object, pen width and style.
Pen.new(%(arg-type)String% colourName, Integer width, Integer style)Constructs a pen from a colour name, pen width and style.
Pen.new(%(arg-type)Bitmap% stipple, Integer width)Constructs a stippled pen from a stipple bitmap and a width.
SOLID | Solid style. |
TRANSPARENT | No pen is used. |
DOT | Dotted style. |
LONG_DASH | Long dashed style. |
SHORT_DASH | Short dashed style. |
DOT_DASH | Dot and dash style. |
STIPPLE | Use the stipple bitmap. |
USER_DASH | Use a custom dash pattern: see set_dashes. |
BDIAGONAL_HATCH | Backward diagonal hatch. |
CROSSDIAG_HATCH | Cross-diagonal hatch. |
FDIAGONAL_HATCH | Forward diagonal hatch. |
CROSS_HATCH | Cross hatch. |
HORIZONTAL_HATCH | Horizontal hatch. |
VERTICAL_HATCH | Vertical hatch. |
Different versions of Windows and different versions of other platforms
support very different subsets of the styles above – there is no
similarity even between Windows95 and Windows98 – so handle with care,
and test across platforms.
If the named colour form is used, an appropriate
Wx::Colour structure is found in the colour database.
Pen#set_style, Pen#set_colour, Pen#set_width, Pen#set_stipple
Returns the pen cap style, which may be one of Wx::CAP_ROUND
,
Wx::CAP_PROJECTING
and Wx::CAP_BUTT
. The default is Wx::CAP_ROUND
.
Returns the pen’s colour
Returns an Array of Integers representing the current dashing pattern
being used by this pen. See set_dashes for a
description of the Array format used to represent dashes.
Returns the pen join style, which may be one of Wx::JOIN_BEVEL
,
Wx::JOIN_ROUND
and Wx::JOIN_MITER
. The default is Wx::JOIN_ROUND
.
Gets the stipple bitmap.
Returns the pen style, for example Wx::SOLID
.
Returns the pen width.
Returns true if the pen is initialised.
Sets the pen cap style, which may be one of Wx::CAP_ROUND
,
Wx::CAP_PROJECTING
and Wx::CAP_BUTT
. The default is
Wx::CAP_ROUND
.
Specifies the colour of the pen by using a Colour, a
colour name (see Colour for more details), or a set of
red, green and blue values.
Sets the lengths of a custom dash pattern. dashes should be an Array
of Integers each of which specifies the length of an on (drawn) or off
(blank) section of the line. For example, passing [4, 1, 4, 2] as an
argument would draw a line with 4 pixels dash, 1 pixel blank, 4 pixels
dash, 2 pixels blank.
Note that the pen should have been created with the style
Wx::USER_DASH
in order to define custom dashing styles.
Returns the pen join style, which may be one of Wx::JOIN_BEVEL
,
Wx::JOIN_ROUND
and Wx::JOIN_MITER
. The default is Wx::JOIN_ROUND
.
Sets the bitmap for stippling.
Sets the pen style; see Pen.new for valid styles.
Sets the pen width, in pixels.
[This page automatically generated from the Textile source at 2023-06-13 21:31:36 +0000]