Modify material settings
Rendering attributes (like color, pattern, blendmodes) are stored inside a context. A context is a collection of material attributes and must not be mistaken with a device handle. A device handle (see: Device management) is the root of all process dependant data and is passed as first parameter to every function. This construct allows the driver functions to be reentrant in case of a multiple drawing engine units.
A device handle contains information about displaylists, framebuffers,etc... Everything that the drawing engine will require. It also includes pointers to contexts.
Each device has at all times pointers to three relevant context’s :
selected context | This one is changed (written to) by the set commands shown below (see: d2_selectcontext) |
solid context | Used as a source (read from) when rendering interior regions (see: d2_solidcontext) |
outline context | Used as a source (read from) when rendering outlines or shadows (see: d2_outlinecontext) |
All three (selected, solid and outline) can point to the same context. Every driver function that starts with get or set will work on the currently selected context (with the obvious exception of geterror and getversion).
There is always a default context that can not be freed by the application and is used for everything per default.
Context Functions | Modify material settings |
Context Management | |
d2_newcontext | Create new context (used to store render settings). |
d2_freecontext | Release Context. |
d2_getcontext | Get a pointer to an currently active context. |
d2_selectcontext | Make a rendering context active (all following property set operations will use it) |
d2_solidcontext | Define the solid rendering context. |
d2_outlinecontext | Define the outline rendering context. |
Context Attribute Writes | |
d2_setfillmode | Select fillmode (solid,patter,texture,..) |
d2_setcolor | Set color registers. |
d2_setalpha | set constant alpha value |
d2_setalphaex | set constant alpha value |
d2_setalphamode | Choose alpha source. |
d2_setalphagradient | Define an alpha gradient. |
d2_setblendmode | Choose blendmode for RGB. |
d2_setalphablendmode | Choose blendmode for alpha channel. |
d2_setalphablendmodeex | Choose blendmode for alpha channel. |
d2_setantialiasing | Globally disable or enable antialiasing. |
d2_setblur | Set global blurring factor. |
d2_setlinecap | Specify lineend style. |
d2_setlinejoin | Specify polyline connection style. |
d2_setmiterlimit | Clipping distance for miter polyline connections. |
d2_setpattern | Specify pattern bitmask. |
d2_setpatternalpha | Specify pattern transparency. |
d2_setpatternparam | Define mapping of pattern to geometry. |
d2_setlinepattern | Specify parameters for aligned patterns. |
d2_setpatternmode | Define pattern addressing details. |
d2_setpatternsize | Define pattern size. |
d2_setclipgradient | Define an alpha gradient for clipping. |
d2_setcircleextend | Increase bbox of circles. |
Context Attribute Queries | |
d2_getfillmode | Query fillmode from selected context. |
d2_getcolor | Query a color from selected context. |
d2_getalpha | Query constant alpha from selected context. |
d2_getalphaex | Query constant alpha from selected context. |
d2_getalphamode | Query alpha source from selected context. |
d2_getblendmodesrc | Query source blend factor from selected context. |
d2_getblendmodedst | Query destination blend factor from selected context. |
d2_getalphablendmodesrc | Query source blend factor for alpha channel blending from selected context. |
d2_getalphablendmodedst | Query destination blend factor for alpha channel blending from selected context. |
d2_getalphablendmodeflags | Query alpha blend flags from selected context. |
d2_getantialiasing | Query antialiasing setting from selected context. |
d2_getblur | Query blurring factor from selected context. |
d2_getlinecap | Query lineend style from selected context. |
d2_getlinejoin | Query polyline connection style from selected context. |
d2_getpattern | Query pattern bitmask from selected context. |
d2_getpatternmode | Query pattern addressing details. |
d2_getpatternsize | Query pattern bitmask size. |
d2_getpatternalpha | Query pattern transparency from selected context. |
d2_context * d2_newcontext( d2_device * handle )
Create new context (used to store render settings).
Note that every context is bound to the device it is created for and can not be used in another process or selected into any other device. Every new context is reset to a default state, it does not reflect the currently selected context.
handle | device pointer (see: d2_opendevice) |
context pointer or NULL in case of an error
d2_s32 d2_freecontext( d2_device * handle, d2_context * ctx )
Release Context.
Free the memory associated with a context. If the context is still selected or an active source for rendering it is deselected (by selecting the default context instead) before destruction.
All contexts assigned to a device are freed automatically when the device is closed.
handle | device pointer (see: d2_opendevice) |
ctx | context pointer |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_context * d2_getcontext( d2_device * handle, d2_s32 mode ) /* PRQA S 3673 */ /* $Misra: #NOT_CONST_IN_DEBUG_BUILD $*/
Get a pointer to an currently active context.
handle | device pointer (see: d2_opendevice) |
mode | getcontext mode determines what context should be returned |
d2_context_default | return the default context |
d2_context_selected | return the currently selected context (see: d2_selectcontext) |
d2_context_solid | return current solid context (see: d2_solidcontext) |
d2_context_outline | return current outline context (see: d2_outlinecontext) |
context pointer or NULL in case of an error
d2_s32 d2_selectcontext( d2_device * handle, d2_context * ctx )
Make a rendering context active (all following property set operations will use it)
Selecting a context has no direct effect on how geometry is rendered (reading is done from solid and outline contexts) and is a very fast operation.
handle | device pointer (see: d2_opendevice) |
ctx | context pointer |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_solidcontext( d2_device * handle, d2_context * ctx )
Define the solid rendering context.
handle | device pointer (see: d2_opendevice) |
ctx | context pointer |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_outlinecontext( d2_device * handle, d2_context * ctx )
Define the outline rendering context.
handle | device pointer (see: d2_opendevice) |
ctx | context pointer |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setfillmode( d2_device * handle, d2_u32 mode )
Select fillmode (solid,patter,texture,..)
handle | device pointer (see: d2_opendevice) |
mode | fillmode |
d2_fm_color | single color (default) |
d2_fm_twocolor | blending between color1 and color2 instead of color1 and background |
d2_fm_pattern | fill with pattern |
d2_fm_texture | fill with texture |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setcolor( d2_device * handle, d2_s32 index, d2_color color )
Set color registers.
Set one of the two color registers, color1 and color2. Second register (index 1) is used for pattern rendering and during d2_fm_twocolor fillmode only.
handle | device pointer (see: d2_opendevice) |
index | color register index (0 or 1) |
color | 24bit rgb color value |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setalpha( d2_device * handle, d2_alpha alpha )
set constant alpha value
handle | device pointer (see: d2_opendevice) |
alpha | alpha value (0 is totally transparent, 255 is fully opaque) |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setalphaex( d2_device * handle, d2_s32 index, d2_alpha alpha )
set constant alpha value
handle | device pointer (see: d2_opendevice) |
index | alpha register index (0 or 1) |
alpha | alpha value (0 is totally transparent, 255 is fully opaque) |
if index is 0 this function does the same as d2_setalpha. if index is 1 alpha is set for color register 2 (see: d2_setalphablendmodeex).
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setalphamode( d2_device * handle, d2_u32 mode )
Choose alpha source.
Defines how alpha (transparency) is defined. As a constant value, a gradient or a mixture to both. Gradients are defined using d2_setalphagradient.
Note that per pixel alpha (e.g. texture alpha channel) information is not disabled by setting the alphamode to opaque. To disable texture alpha look at d2_settextureoperation.
handle | device pointer (see: d2_opendevice) |
mode | alpha mode, several values can be or’ed together |
d2_am_opaque | no transparency (equal to constant alpha of 0xff) |
d2_am_constant | constant transparency (see: d2_setalpha) |
d2_am_gradient1 | alpha gradient1 is active |
d2_am_gradient2 | alpha gradient2 is active |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setalphagradient( d2_device * handle, d2_s32 index, d2_point x, d2_point y, d2_point dx, d2_point dy )
Define an alpha gradient.
Instead or in addition to a constant alpha (transparency) value the hardware can also apply one or more alpha gradients to the rendered geometry. Gradients have to be enabled using d2_setalphamode in order to become visible.
handle | device pointer (see: d2_opendevice) |
index | alpha gradient index (0 or 1) |
x,y | startpoint of gradient (point of alpha 0) (fixedpoint) |
dx,dy | direction and length of gradient (distance to point of alpha 255) |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setblendmode( d2_device * handle, d2_u32 srcfactor, d2_u32 dstfactor )
Choose blendmode for RGB.
Blendmode defines how the RGB channels of new pixels (source) are combined with already existing data in the framebuffer (destination). Blend modes for alpha channel are set by d2_setalphablendmode.
The most common blending (and also the default) is a direct linear blend :
d2_bm_alpha , d2_bm_one_minus_alpha
Additive blending is also pretty common :
d2_bm_alpha , d2_bm_one
Note that antialiasing is not possible without blending (because partly covered pixels are represented by transparency). Therefore antialiasing is impossible with blendmodes that ignore alpha entirely.
If d2_mode_alpha8 is used, alpha is treated as color.
handle | device pointer (see: d2_opendevice) |
srcfactor | source blend factor (see available blend factors) |
dstfactor | destination blend factor (see available blend factors) |
d2_bm_zero | constant 0 |
d2_bm_one | constant 1 |
d2_bm_alpha | current alpha |
d2_bm_one_minus_alpha | inverted alpha |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setalphablendmode( d2_device * handle, d2_u32 srcfactor, d2_u32 dstfactor )
Choose blendmode for alpha channel.
Blendmode defines how new alpha values (source) are combined with already existing data in the framebuffer (destination).
d2_bm_one, d2_bm_zero
d2_bm_one, d2_bm_one_minus_alpha
d2_bm_zero, d2_bm_one
handle | device pointer (see: d2_opendevice) |
srcfactor | source blend factor (see available blend factors) |
dstfactor | destination blend factor (see available blend factors) |
d2_bm_zero | constant 0 |
d2_bm_one | constant 1 |
d2_bm_alpha | current alpha |
d2_bm_one_minus_alpha | inverted alpha |
If the framebuffer format is set to d2_mode_alpha8 (d2_framebuffer) then alpha blend mode should be set to write src alpha. For d2_mode_alpha8 the blend modes set by d2_setblendmode do apply.
the blend flags of the selected context is set to d2_blendf_default (see: d2_setalphablendmodeex)
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setalphablendmodeex( d2_device * handle, d2_u32 srcfactor, d2_u32 dstfactor, d2_u32 blendflags )
Choose blendmode for alpha channel.
Blendmode defines how new alpha values (source) are combined with already existing data in the framebuffer (destination).
d2_bm_one, d2_bm_zero
d2_bm_one, d2_bm_one_minus_alpha
d2_bm_zero, d2_bm_one
handle | device pointer (see: d2_opendevice) |
srcfactor | source blend factor (see available blend factors) |
dstfactor | destination blend factor (see available blend factors) |
blendflags | blend flags (see available blend flags) |
d2_bm_zero | constant 0 |
d2_bm_one | constant 1 |
d2_bm_alpha | current alpha |
d2_bm_one_minus_alpha | inverted alpha |
d2_blendf_blenddst | use framebuffer alpha as dst alpha (is d2_blendf_default) |
d2_blendf_blendcolor2 | use color2 alpha as dst alpha as input for the blending formula (see: d2_setalphaex) |
If the framebuffer format is set to d2_mode_alpha8 (d2_framebuffer) the alpha blend mode should be set to write src alpha: For d2_mode_alpha8 the blend modes set by d2_setblendmode do apply.
On older D/AVE 2D hardware revisions without alpha channel blending (see: d2_getrevisionhw, D2FB_ALPHACHANNELBLENDING) only the following two blend combinations can be used for the alpha channel:
These modes also require that the same source blend factor is configured for RGB and A.
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setantialiasing( d2_device * handle, d2_s32 enable )
Globally disable or enable antialiasing.
When antialiasing is enabled all geometry is blended with the background according to its coverage value.
handle | device pointer (see: d2_opendevice) |
enable | boolean value (set 1 to enable antialiasing) |
If antaliasing is disabled blurring will also be disabled (see: d2_setblur).
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setblur( d2_device * handle, d2_width blur )
Set global blurring factor.
The blurring factor is a fixed point (4 bit fraction) number of pixels during which the edge opacity changes from 0 (no coverage) to 1 (fully covered). The intended use is a finetuning of the antialiasing. The default is a value of 1.0 equals a single pixel wide region around each primitive for antialiasing.
A lower value is not useful (and not supported). A higher value will produce results similar to an additional lowpass filter (hence the name). Extending the AA region above 2 or 3 pixels is not recommended and should be used for special effects only.
Note that blurring will not work when antialiasing is disabled (see: d2_setantialiasing). If blurring factor is > 1 then antialiasing will be enabled (see: d2_setantialiasing).
In order to disable blurring set a value of 1 (fixed point)
handle | device pointer (see: d2_opendevice) |
blur | fixed point |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setlinecap( d2_device * handle, d2_u32 mode )
Specify lineend style.
Linecaps are applied when rendering lines using d2_renderline or d2_renderline2
handle | device pointer (see: d2_opendevice) |
mode | linecap mode |
d2_lc_butt | lines end directly at endpoints |
d2_lc_round | lines end with halfcircles |
d2_lc_square | line ends are extended by the half linewidth |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setlinejoin( d2_device * handle, d2_u32 mode )
Specify polyline connection style.
Linejoins are applied when rendering polylines using d2_renderpolyline
handle | device pointer (see: d2_opendevice) |
mode | linejoin mode |
d2_lj_none | no connection is applied |
d2_lj_miter | lines meet in a sharp angle (see also d2_setmiterlimit) |
d2_lj_round | line are connected by circle segments |
d2_lj_bevel | lines meet in a flat angle |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setmiterlimit( d2_device * handle, d2_width miter )
Clipping distance for miter polyline connections.
When using sharp linejoin’s (d2_lj_miter) with d2_renderpolyline the sharp edge has to be clipped at some point. Otherwise it would extend to infinity when the two segments meet at 180�.
handle | device pointer (see: d2_opendevice) |
miter | maximum pixel distance the join can extend beyond bevel edge |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setpattern( d2_device * handle, d2_pattern pattern )
Specify pattern bitmask.
When patterns are used to fill a primitive an index into the bitmask is generated for each pixel (see: d2_setpatternparam for mapping details). The pattern wraps around after N bits (N can be set using d2_setpatternsize).
Depending on the bit color1 or color2 and patternalpha1 or patternalpha2 are used. Fractional indices are interpolated between those two values.
handle | device pointer (see: d2_opendevice) |
pattern | N bit pattern mask |
errorcode (D2_OK if successful) see list of Errorcodes for details
The following figure shows a rendered line filled with an 8 bit pattern. Color1 is blue and color2 is green, the bitstring is 0101 1001. For the upper line filtering is off, the lower line is rendered with filtering enabled (flag: d2_pm_filter).
d2_s32 d2_setpatternalpha( d2_device * handle, d2_s32 index, d2_alpha alpha )
Specify pattern transparency.
Pattern alpha is mixed with global alpha (gradient or constant). Pattern alpha index 0 is used where 0bits occur in the pattern bitmask.
handle | device pointer (see: d2_opendevice) |
index | register index (0 or 1 as patterns are always twocolor) |
alpha | alphavalue (0 is totally transparent, 255 is fully opaque) |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setpatternparam( d2_device * handle, d2_point x, d2_point y, d2_width dx, d2_width dy )
Define mapping of pattern to geometry.
Pattern mapping is defined by specifying a line segment (startpoint and vector to endpoint) along which the pattern is mapped. The startpoint maps to bit0 of the pattern bitmask (see: <set_pattern>). With the bitmask extending along the direction vector.
Note that the pattern is repeated infinitely along the defined line.
Free pattern directions apply to line based geometry only when pattern mode (see: d2_setpatternmode) is not set to auto align.
handle | device pointer (see: d2_opendevice) |
x, y | pattern startpoint (fixedpoint) |
dx, dy | pattern direction and size (fixedpoint) |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setlinepattern( d2_device * handle, d2_width scale, d2_s32 offset )
Specify parameters for aligned patterns.
When rendering line based geometry it is very often required to align the pattern perpendicular to the line direction. For single elements it can be done using d2_setpatternparam but this is not efficient and sometimes (e.g. with polylines) not even possible.
When enabled by setting the patternmode to contain d2_pm_autoalign this function can be used to describe the pattern relative to any line geometry by scale and offset.
The offset can be incremented automatically after rendering an element if d2_pm_advance is set using d2_setpatternmode. Calling d2_setlinepattern resets the internally managed offset to the specified value.
handle | device pointer (see: d2_opendevice) |
scale | number of screenpixels one pattern bit is mapped onto |
offset | pattern offset in pixels (fixedpoint format equal to d2_point) |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setpatternmode( d2_device * handle, d2_u32 mode )
Define pattern addressing details.
Filtering (interpolation) of pattern data can be disabled by passing 0 as patternmode.
Patterns can be aligned to run perpendicular to rendered lines automatically when d2_pm_autoalign mode is enabled (works only when rendering line based geometry). In this case calling d2_setpatternparam is unnecessary but additional data has to be passed using <d2_linepattern>.
handle | device pointer (see: d2_opendevice) |
mode | any combination of pattern mode bits (see below) |
d2_pm_filter | use linear interpolation between colors (default) |
d2_pm_autoalign | map pattern to line direction (see: d2_setlinepattern) |
d2_pm_advance | increase offset automatically (see: d2_setlinepattern) |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setpatternsize( d2_device * handle, d2_s32 size )
Define pattern size.
Patterns are defined as a bitvector. This function can be used to define the number of valid bits. The size may not exceed the maximum size supported by the hardware (currently 8). The default size is set to 4 in every new context for compatibility reasons.
Size changes affect only the following calls to d2_setpatternparam and d2_setpattern
Note that for correct wraparound the size must divide the hardware maximum without remainder.
handle | device pointer (see: d2_opendevice) |
size | number of valid bits used for pattern mask |
errorcode (D2_OK if successful) see list of Errorcodes for details
when using small pattern size (<8) all leading unused bits in the pattern mask (see: d2_setpattern) must be zero!
d2_s32 d2_setclipgradient( d2_device * handle, d2_s32 index, d2_point x, d2_point y, d2_s32 nx, d2_s32 ny, d2_u32 flags )
Define an alpha gradient for clipping.
Instead or in addition to a constant alpha (transparency) value the hardware can also apply one or more alpha gradients to the rendered geometry.
d2_setalphagradient offers an interface suitable to specify smooth alpha gradients, but does not provide enough accuracy for steep gradients, which effectively clip objects along a straight edge, e.g. let the alpha value drop from 255 to 0 within the distance of a single pixel. For this reason d2_setclipgradient offers the necessary accuracy by using 16.16 fixed point instead of d2_point (12.4 fixed point) for the definition of the gradient. Also the interpretation of nx,ny is different compared to dx,dy of d2_setalphagradient as follows: nx,ny specify a normal vector of the clipping edge, pointing towards the non-clipped side. When this vector is normalized to a length of 1.0 (i.e. 0x00010000), the gradient alpha value changes from 0 to 255 within the distance of a single pixel. When it is longer, the gradient is even steeper respectively smoother, when it is shorter. The gradient alpha value is always clamped to 0 respectively 255 when it leaves this range.
Additionally index 2 or 3 can also be used in some cases. These indices are shared with the alpha gradients (and will overwrite these settings) and have to be enabled using d2_setalphamode in order to become visible. Please also note that the total number of available gradients (alpha or clip) is restricted by the D/AVE 2D hardware and varies on the primitive types and render modes!
handle | device pointer (see: d2_opendevice) |
index | alpha gradient index (0 or 1, additionally 2 or 3) |
x,y | startpoint of gradient (point of alpha 0) (fixedpoint) |
nx,ny | normal vector of the clipping edge, pointing towards the non-clipped side (16.16 fixedpoint) |
flags | reserved |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_s32 d2_setcircleextend( d2_device * handle, d2_width offset )
Increase bbox of circles.
Due to limited precision for circle parameters large circles with enabled blurring can become inaccurate. To avoid clipping at the bbox of the circle the bbox can be extended by offset.
handle | device pointer (see: d2_opendevice) |
offset | number by which bbox of circles will be extended (fixedpoint) |
errorcode (D2_OK if successful) see list of Errorcodes for details
d2_u8 d2_getfillmode( d2_device * handle )
Query fillmode from selected context.
see: d2_setfillmode for a list of fill modes
handle | device pointer (see: d2_opendevice) |
Select fillmode (d2_fm_color,d2_fm_pattern,..). undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_color d2_getcolor( d2_device * handle, d2_s32 index )
Query a color from selected context.
handle | device pointer (see: d2_opendevice) |
index | color register index (0 or 1) |
content of specified color register. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_alpha d2_getalpha( d2_device * handle )
Query constant alpha from selected context.
handle | device pointer (see: d2_opendevice) |
content of constant alpha register. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_alpha d2_getalphaex( d2_device * handle, d2_s32 index )
Query constant alpha from selected context.
handle | device pointer (see: d2_opendevice) |
index | alpha register index (0 or 1) |
content of constant alpha register. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u8 d2_getalphamode( d2_device * handle )
Query alpha source from selected context.
see: d2_setalphamode for a list of alpha mode bits
handle | device pointer (see: d2_opendevice) |
alpha source bitmask. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u32 d2_getblendmodesrc( d2_device * handle )
Query source blend factor from selected context.
see: d2_setblendmode for a list of blendmodes
handle | device pointer (see: d2_opendevice) |
source blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u32 d2_getblendmodedst( d2_device * handle )
Query destination blend factor from selected context.
see: d2_setblendmode for a list of blendmodes
handle | device pointer (see: d2_opendevice) |
destination blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u32 d2_getalphablendmodesrc( d2_device * handle )
Query source blend factor for alpha channel blending from selected context.
see: d2_setalphablendmode for a list of blendmodes
handle | device pointer (see: d2_opendevice) |
alpha source blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u32 d2_getalphablendmodedst( d2_device * handle )
Query destination blend factor for alpha channel blending from selected context.
see: d2_setalphablendmode for a list of blendmodes
handle | device pointer (see: d2_opendevice) |
alpha destination blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u8 d2_getalphablendmodeflags( d2_device * handle )
Query alpha blend flags from selected context.
see: d2_setalphablendmodeex for a list of blend flags
handle | device pointer (see: d2_opendevice) |
alpha blend flags. Undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_s32 d2_getantialiasing( d2_device * handle )
Query antialiasing setting from selected context.
handle | device pointer (see: d2_opendevice) |
Boolean (0 or 1) antialiasing setting. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_width d2_getblur( d2_device * handle )
Query blurring factor from selected context.
handle | device pointer (see: d2_opendevice) |
global blurring factor (fixedpoint). undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u8 d2_getlinecap( d2_device * handle )
Query lineend style from selected context.
see: d2_setlinecap for a list of all line cap modes
handle | device pointer (see: d2_opendevice) |
Linecap mode. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u8 d2_getlinejoin( d2_device * handle )
Query polyline connection style from selected context.
see: d2_setlinejoin for a list of all line join modes
handle | device pointer (see: d2_opendevice) |
Linejoin mode. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_pattern d2_getpattern( d2_device * handle )
Query pattern bitmask from selected context.
handle | device pointer (see: d2_opendevice) |
Pattern bitmask. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_u32 d2_getpatternmode( d2_device * handle )
Query pattern addressing details.
handle | device pointer (see: d2_opendevice) |
Pattern address mode. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_s32 d2_getpatternsize( d2_device * handle )
Query pattern bitmask size.
handle | device pointer (see: d2_opendevice) |
Pattern bitmask size. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
d2_alpha d2_getpatternalpha( d2_device * handle, d2_s32 index )
Query pattern transparency from selected context.
handle | device pointer (see: d2_opendevice) |
index | register index (0 or 1 as patterns are always twocolor) |
Pattern alpha. undefined in case of an error (check with d2_geterror or d2_geterrorstring)
Create new context (used to store render settings).
d2_context * d2_newcontext( d2_device * handle )
Release Context.
d2_s32 d2_freecontext( d2_device * handle, d2_context * ctx )
Get a pointer to an currently active context.
d2_context * d2_getcontext( d2_device * handle, d2_s32 mode ) /* PRQA S 3673 */ /* $Misra: #NOT_CONST_IN_DEBUG_BUILD $*/
Make a rendering context active (all following property set operations will use it)
d2_s32 d2_selectcontext( d2_device * handle, d2_context * ctx )
Define the solid rendering context.
d2_s32 d2_solidcontext( d2_device * handle, d2_context * ctx )
Define the outline rendering context.
d2_s32 d2_outlinecontext( d2_device * handle, d2_context * ctx )
Select fillmode (solid,patter,texture,..)
d2_s32 d2_setfillmode( d2_device * handle, d2_u32 mode )
Set color registers.
d2_s32 d2_setcolor( d2_device * handle, d2_s32 index, d2_color color )
set constant alpha value
d2_s32 d2_setalpha( d2_device * handle, d2_alpha alpha )
set constant alpha value
d2_s32 d2_setalphaex( d2_device * handle, d2_s32 index, d2_alpha alpha )
Choose alpha source.
d2_s32 d2_setalphamode( d2_device * handle, d2_u32 mode )
Define an alpha gradient.
d2_s32 d2_setalphagradient( d2_device * handle, d2_s32 index, d2_point x, d2_point y, d2_point dx, d2_point dy )
Choose blendmode for RGB.
d2_s32 d2_setblendmode( d2_device * handle, d2_u32 srcfactor, d2_u32 dstfactor )
Choose blendmode for alpha channel.
d2_s32 d2_setalphablendmode( d2_device * handle, d2_u32 srcfactor, d2_u32 dstfactor )
Choose blendmode for alpha channel.
d2_s32 d2_setalphablendmodeex( d2_device * handle, d2_u32 srcfactor, d2_u32 dstfactor, d2_u32 blendflags )
Globally disable or enable antialiasing.
d2_s32 d2_setantialiasing( d2_device * handle, d2_s32 enable )
Set global blurring factor.
d2_s32 d2_setblur( d2_device * handle, d2_width blur )
Specify lineend style.
d2_s32 d2_setlinecap( d2_device * handle, d2_u32 mode )
Specify polyline connection style.
d2_s32 d2_setlinejoin( d2_device * handle, d2_u32 mode )
Clipping distance for miter polyline connections.
d2_s32 d2_setmiterlimit( d2_device * handle, d2_width miter )
Specify pattern bitmask.
d2_s32 d2_setpattern( d2_device * handle, d2_pattern pattern )
Specify pattern transparency.
d2_s32 d2_setpatternalpha( d2_device * handle, d2_s32 index, d2_alpha alpha )
Define mapping of pattern to geometry.
d2_s32 d2_setpatternparam( d2_device * handle, d2_point x, d2_point y, d2_width dx, d2_width dy )
Specify parameters for aligned patterns.
d2_s32 d2_setlinepattern( d2_device * handle, d2_width scale, d2_s32 offset )
Define pattern addressing details.
d2_s32 d2_setpatternmode( d2_device * handle, d2_u32 mode )
Define pattern size.
d2_s32 d2_setpatternsize( d2_device * handle, d2_s32 size )
Define an alpha gradient for clipping.
d2_s32 d2_setclipgradient( d2_device * handle, d2_s32 index, d2_point x, d2_point y, d2_s32 nx, d2_s32 ny, d2_u32 flags )
Increase bbox of circles.
d2_s32 d2_setcircleextend( d2_device * handle, d2_width offset )
Query fillmode from selected context.
d2_u8 d2_getfillmode( d2_device * handle )
Query a color from selected context.
d2_color d2_getcolor( d2_device * handle, d2_s32 index )
Query constant alpha from selected context.
d2_alpha d2_getalpha( d2_device * handle )
Query constant alpha from selected context.
d2_alpha d2_getalphaex( d2_device * handle, d2_s32 index )
Query alpha source from selected context.
d2_u8 d2_getalphamode( d2_device * handle )
Query source blend factor from selected context.
d2_u32 d2_getblendmodesrc( d2_device * handle )
Query destination blend factor from selected context.
d2_u32 d2_getblendmodedst( d2_device * handle )
Query source blend factor for alpha channel blending from selected context.
d2_u32 d2_getalphablendmodesrc( d2_device * handle )
Query destination blend factor for alpha channel blending from selected context.
d2_u32 d2_getalphablendmodedst( d2_device * handle )
Query alpha blend flags from selected context.
d2_u8 d2_getalphablendmodeflags( d2_device * handle )
Query antialiasing setting from selected context.
d2_s32 d2_getantialiasing( d2_device * handle )
Query blurring factor from selected context.
d2_width d2_getblur( d2_device * handle )
Query lineend style from selected context.
d2_u8 d2_getlinecap( d2_device * handle )
Query polyline connection style from selected context.
d2_u8 d2_getlinejoin( d2_device * handle )
Query pattern bitmask from selected context.
d2_pattern d2_getpattern( d2_device * handle )
Query pattern addressing details.
d2_u32 d2_getpatternmode( d2_device * handle )
Query pattern bitmask size.
d2_s32 d2_getpatternsize( d2_device * handle )
Query pattern transparency from selected context.
d2_alpha d2_getpatternalpha( d2_device * handle, d2_s32 index )
Create a new device handle.
d2_device * d2_opendevice( d2_u32 flags )
Choose texture operation for each channel.
d2_s32 d2_settextureoperation( d2_device * handle, d2_u8 amode, d2_u8 rmode, d2_u8 gmode, d2_u8 bmode )
Specify the rendering target.
d2_s32 d2_framebuffer( d2_device * handle, void * ptr, d2_s32 pitch, d2_u32 width, d2_u32 height, d2_s32 format )
Query hw revisionID.
d2_u32 d2_getrevisionhw( const d2_device * handle )
Render a wide line.
d2_s32 d2_renderline( d2_device * handle, d2_point x1, d2_point y1, d2_point x2, d2_point y2, d2_width w, d2_u32 flags )
Render a wide line with 2 different widths.
d2_s32 d2_renderline2( d2_device * handle, d2_point x1, d2_point y1, d2_point x2, d2_point y2, d2_width w1, d2_width w2, d2_u32 flags )
Render a polyline
d2_s32 d2_renderpolyline( d2_device * handle, const d2_point * data, d2_u32 count, d2_width w, d2_u32 flags )
Query device error information.
d2_s32 d2_geterror( const d2_device * handle )
Query detailed device error information.
const d2_char * d2_geterrorstring( const d2_device * handle )