Other Drawing Parameters
The following attributes affect drawing operations and are used in the IlvPalette class: Line Width, Fill Style, Fill Rule, Arc Mode, Draw Mode , Alpha Value , and Anti-Aliasing Mode .
These attributes are represented by C++ type definitions. Although they cannot be called “resources,” as they are not represented by subclasses of IlvResource, they operate in conjunction with the graphic resources to define the drawing attributes of Views drawings.
Line Width
The line width is an unsigned short integer. Zero (0) is a valid value, producing a line whose width is such that it can be drawn as thin and rapidly as possible.
Border Position (IlvBorderPosition)
IlvBorderPosition indicates where the border is drawn when creating a rectangle or a rounded rectangle. The IlvRect drawing methods determine the position of the border relative to the bounds of the rectangle. The possible values are:
-
centeredOnBounds — The border is drawn centered on bounds. If the line width is an odd number, the inner part of the border is one pixel larger than the outer part. This is the default behavior.
-
insideBounds — The border is drawn inside the bounds.
-
outsideBounds — The border is drawn inside the bounds.
Border Position
The border position is a property in IlvPalette. The value is specified either when getting the palette from IlvDisplay::getPalette or with IlvPalette::setBorderPosition(). The parameter affects drawings made with:
-
IlvPort::drawRectangle
-
IlvPort::drawRoundRectangle
-
IlvPort::drawRoundRectangleDifferentRadiuses
The other drawing methods are not affected by the border position: drawArc, drawPolyline, drawReliefRectangle, drawReliefDiamond, drawClosedBezier, drawOutlineRectangle, fillRectangle, and so forth.
Fill Style
The most complex of the graphic resources is that of patterns, where there are the simple masking patterns of the monochrome (two-color) domain, the rich pixel patterns of color and the gradient patterns. This aspect is referred to as the fill style.
The fill style indicates the way in which patterns are used to fill shapes. There are four possible cases represented in the IlvFillStyle enumeration type. A monochrome pattern is used when the fill mode is IlvFillPattern or IlvFillMaskPattern. Its value is an instance of IlvPattern, whether created by the user or returned by specific member functions of the IlvDisplay class. Color pattern refers to what is used to fill shapes when the fill mode is IlvFillColorPattern. Gradient pattern refers to what is used to fill shapes when the fill mode is IlvFillGradientPattern.
IlvFillPattern
With IlvFillPattern a shape is filled by being copied with the chosen pattern. In a Views object, there is a pattern property, which refers to an object of the IlvPattern class. To fill a shape with a given pattern:
-
Each “0” pixel in the relevant IlvPattern object produces a colored pixel with the current background color
-
Each “1” pixel in the IlvPattern object produces a colored pixel with the current foreground color.
This is the default value of the fill-style property of an IlvPalette object.
IlvFillMaskPattern
IlvFillMaskPattern is similar to the IlvFillPattern style, except that “0” pixels in the relevant IlvPattern object have no effect upon the corresponding pixels in the destination port. That is, the drawing masks its destination.
IlvFillColorPattern
In the case of IlvFillColorPattern, the pattern used to fill a shape is indicated, not by the pattern property of the IlvPalette object, but rather by its colored pattern property. It is used when you wish to fill a region with a full-color pattern; that is, an actual object of the IlvGradientPattern class. The pattern property plays no role in the case of this filling mode.
IlvFillGradientPattern
In the case of IlvFillGradientPattern, the pattern used to fill a shape is indicated by its gradient pattern property. It is used when you wish to fill a region with a gradient pattern; that is, an actual object of the IlvGradientPattern class. The pattern and color pattern properties play no role in the case of this filling mode.
Fill Rule
This attribute indicates how self-intersecting polygons are filled, since there is an ambiguity concerning what is meant by “fill” in the case of such surfaces.
The fill rule indicates which points are to be considered as inside a filled polygon, depending on the count of crossing segments that define the shape of the area to be filled. The IlvFillRule provides two possibilities:
-
IlvEvenOddRule According to this rule, in the case of the complex polygon shown below, the central area of the star is not considered to lie inside the polygon, and therefore, is not filled. This is the default value.
-
IlvWindingRule According to this rule, the central area of the star is considered to lie inside the polygon, and therefore, is filled.
IlvFillRule
Arc Mode
The arc mode indicates the way to close arcs in order to fill them, that is, the way in which filled arcs are to be drawn: either by radii that form a wedge-shaped “pie” or by a simple “chord” line segment. There are two possible cases that are handled by the IlvArcMode enumeration type.
-
IlvArcPie The arc is closed by adding two lines, from the center of the complete circle to the start and end points of the arc. This is the default mode.
-
IlvArcChord The arc is closed by adding a line from the start point to the end point.
Arc Modes
Draw Mode
The draw mode specifies the operation to be performed on pixels when they are sent to the destination port. The operation is the one that affects the destination pixel value when the source pixel value is to be drawn at that place. The draw mode has several possible values, which are handled by the IlvDrawMode enumeration type. Except for the IlvModeXor value, used in temporary drawings, these types produce no significant graphic result when drawing in color.
-
IlvModeOr The resulting pixel is the result of an OR operation on the source and destination pixels.
-
IlvModeAnd The resulting pixel is the result of an AND operation on the source and destination pixels.
-
IlvModeXor The resulting pixel is the result of an XOR (exclusive or) operation on the source and destination pixels. This mode can be used a second time to delete a drawing.
-
IlvModeNot The resulting pixel is the result of the NOT operation on the destination pixel. The source pixel value is not used.
-
IlvModeNotOr The resulting pixel is the result of a NOT OR operation upon the source and destination pixels.
-
IlvModeNotAnd The resulting pixel is the result of a NOT AND operation upon the source and destination pixels.
-
IlvModeNotXor The resulting pixel is the result of an NOT XOR operation upon the source and destination pixels. When you draw the same object twice with IlvModeNotXor set, the drawing disappears.
Alpha Value
The alpha value indicates the amount of transparency the drawing will be given. A value of 0 means that the drawing will be completely transparent, that is, nothing will be drawn. A value of IlvFullIntensity means that the drawing will be opaque.
Drawing involves the use of two objects:
-
An IlvPort object. This is the port where the drawing will be done. See Drawing Ports for details.
-
An IlvPalette object. This is a set of graphic resources that will be used to draw. See IlvPalete for details.
It is possible to control transparency at both levels: For example, you can set an alpha value on the port (using IlvPort::setAlpha) and also on the palette you are going to draw with (setAlpha). In this case, the resulting drawing will use the composition of the two alpha values.
Note
This attribute is currently being supported only on Windows platforms using GDI+ and on X Window systems using Cairo. See the sections Using GDI+ Features with Views and Using Cairo Features with Views for details. |
Anti-Aliasing Mode
The anti-aliasing mode indicates whether smooth lines are drawn using anti-aliasing. The possible values for this mode are:
-
IlvDefaultAntialiasingMode The anti-aliasing mode is not explicitly specified. It will be inherited using a default value.
-
IlvNoAntialiasingMode No anti-aliasing will be used to draw.
-
IlvUseAntialiasingMode Drawings will be done using anti-aliasing.
The anti-aliasing mode can be specified at different levels:
-
IlvDisplay To set the default anti-aliasing mode of the display (setAntialiasingMode).
-
IlvPalette To set the anti-aliasing mode of a palette (setAntialiasingMode).
The following rules are applied to determine if the final drawing will use anti-aliasing or not:
-
For the palette:
-
If the anti-aliasing mode of the palette has been set (using the member function IlvPalette::setAntialiasingMode) then this mode is used.
-
Otherwise, the palette has the IlvDefaultAntialiasingMode, and the mode of the port in which the drawing is done is used.
-
-
For the port:
-
If the anti-aliasing mode of the port has been set (using the member function IlvPort::setAntialiasingMode) then this mode is used.
-
Otherwise, the port has the IlvDefaultAntialiasingMode, and the mode of the display is used.
-
-
For the display, the default anti-aliasing mode is IlvNoAntialiasingMode. This setting can be changed by either:
-
Using the member function IlvDisplay::setAntialiasingMode.
-
Setting the resource Antialiasing to true.
-
Setting the environment variable ILVANTIALIASING to true.
-
Note
This attribute is currently being supported only on Windows platforms using GDI+ and on X Window systems using Cairo. See the sections Using GDI+ Features with Views and Using Cairo Features with Views for details. |