linesmooth(3G) linesmooth(3G)
linesmooth - specify antialiasing of lines
void linesmooth(mode)
unsigned long mode;
mode expects one of two values:
SML_OFF, defeats antialiasing of lines (default).
SML_ON enables antialiasing of lines. SML_ON can be modified by
either or both of two additional symbolic constants:
SML_SMOOTHER indicates that a higher quality filter should be used
during line drawing. This filter typically requires that more
pixels be modified, and therefore potentially reduces the rate at
which antialiased lines are rendered.
SML_END_CORRECT indicates that the endpoints of antialiased lines
should be trimmed to the exact length specified by the subpixel
position of each line.
The constants SML_SMOOTHER and SML_END_CORRECT are specified with SML_ON
by bitwise ORing them, or by adding them. For example,
linesmooth(SML_ON + SML_SMOOTHER + SML_END_CORRECT);
enables antialiased line drawing with the highest quality, and
potentially lowest performance, algorithm. These modifiers are hints,
not directives, and are therefore ignored by systems that do not support
the requested feature.
Antialiased lines can be drawn in both color map and RGB modes.
linesmooth controls this capability. In both modes, for antialiased
lines to draw properly:
o linestyle must be 0xFFFF,
o lsrepeat must be 1.
For color map antialiased lines to draw correctly, a 16-entry colormap
block (whose lowest entry location is a multiple of 16) must be
initialized to a ramp between the background color (lowest index) and the
line color (highest index). Before drawing lines, clear the area to the
background color.
Page 1
linesmooth(3G) linesmooth(3G)
The linesmooth hardware replaces the least significant 4 bits of the
current color index with bits that represent pixel coverage. Therefore,
by changing the current color index (only the upper 8 bits are
significant) you can select among many 16-entry color ramps, representing
different colors and intensities. You can draw depthcued, antialiased
lines in this manner.
The z-buffer hardware can be used to improve the quality of color map
antialiased line images. Enabled in the standard depth-comparison mode,
it ensures that lines nearer the viewer obscure more distant lines.
Alternately, the z-buffer hardware can be used to compare color values by
issuing:
zbuffer(TRUE);
zsource(ZSRC_COLOR);
zfunction(ZF_GREATER);
Pixels are then replaced only by 'brighter' values, resulting in better
intersections between lines drawn using the same ramp.
RGB antialiased lines can be drawn only on machines that support
blending. For these lines to draw correctly, the blendfunction must be
set to merge new pixel color components into the framebuffer using the
incoming (source) alpha values. Incoming color components should always
be multiplied by the source alpha (BF_SA). Current (destination) color
components can be multiplied either by one minus the source alpha
(BF_MSA), resulting in a weighted average blend, or by one (BF_ONE),
resulting in color accumulation to saturation; issue:
blendfunction(BF_SA, BF_MSA); /* weighted average */
or
blendfunction(BF_SA, BF_ONE); /* saturation */
The linesmooth hardware scales incoming alpha components by an 8-bit
computed coverage value. Therefore reducing the incoming source alpha
results in transparent, antialiased lines.
RGB antialiased lines draw correctly over any background image. It is
not necessary to clear the area in which they are to be drawn.
Both color map and RGB mode antialiased lines can be drawn with
subpixel-positioned vertexes (see subpixel). Subpixel positioning of
line vertexes results in higher quality lines. On some models subpixel
positioning may reduce performance.
Page 2
linesmooth(3G) linesmooth(3G)
The width of antialiased lines is controlled by linewidth and linewidthf.
Although line width can be arbitrarily specified, only a small, hardware
specific number of line widths is actually supported. (Refer to the
linewidth manpage.)
The modifier SML_SMOOTHER can be ORed or ADDed to the symbolic constant
SML_ON when antialiased lines are enabled. When this is done, a higher
quality and potentially lower performance filter is used to scan convert
antialiased lines. SML_SMOOTHER is a hint, not a directive. Thus a
higher quality filter is used only if it is available.
The modifier SML_END_CORRECT can ba ORed or ADDed to the symbolic
constant SML_ON when antialiased lines are enabled. When this is done,
the endpoints of antialiased lines are scaled to the exact length
specified by their subpixel-positioned endpoints, rather than drawn to
the nearest integer length. SML_END_CORRECT is a hint, not a directive.
Thus antialiased lines are drawn with corrected endpoints only if support
is available in the hardware.
bgnline, blendfunction, deflinestyle, linewidth, lsrepeat, pntsmooth,
setlinestyle, subpixel, v, zbuffer, zfunction, zsource
This subroutine does not function on IRIS-4D B or G models.
IRIS-4D GT and GTX models, as well as the Personal Iris, Personal Iris
Turbo and Iris Entry, do not support SML_SMOOTHER and SML_END_CORRECT.
Both hints are ignored on these systems.
XS, XS24, XZ, Elan and Extreme systems do not support SML_SMOOTHER
On Iris Entry, Personal Iris, and Personal Iris Turbo linesmooth support
is only valid for color index mode. Personal Iris and Personal Iris Turbo
require that subpixel positioning is enabled when drawing smooth
lines.
IRIS-4D VGX models adjust the antialiasing filter for each line based on
its slope when SML_SMOOTHER is requested. They support SML_END_CORRECT
only in RGB mode.
On the IRIS-4D GT and GTX models ZSRC_COLOR z-buffering is supported only
for non-subpixel positioned color map mode lines.
Before ZSRC_COLOR z-buffering is used on IRIS-4D GT and GTX models, bitplanes
12 through 23 must be explicitly cleared to zero. This must be
done in RGB mode, with a code sequence such as:
Page 3
linesmooth(3G) linesmooth(3G)
RGBmode();
doublebuffer();
gconfig();
frontbuffer(TRUE);
cpack(0);
clear();
cmode();
frontbuffer(FALSE);
gconfig();
body of program
The clear operation must be repeated only after bitplanes 12 through 23
are modified, which can result only from interaction with another window
running in RGB mode.
PPPPaaaaggggeeee 4444 [ Back ]
|