Context Functions

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 contextThis one is changed (written to) by the set commands shown below (see: d2_selectcontext)
solid contextUsed as a source (read from) when rendering interior regions (see: d2_solidcontext)
outline contextUsed 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.

Summary
Context FunctionsModify material settings
Context Management
d2_newcontextCreate new context (used to store render settings).
d2_freecontextRelease Context.
d2_getcontextGet a pointer to an currently active context.
d2_selectcontextMake a rendering context active (all following property set operations will use it)
d2_solidcontextDefine the solid rendering context.
d2_outlinecontextDefine the outline rendering context.
Context Attribute Writes
d2_setfillmodeSelect fillmode (solid,patter,texture,..)
d2_setcolorSet color registers.
d2_setalphaset constant alpha value
d2_setalphaexset constant alpha value
d2_setalphamodeChoose alpha source.
d2_setalphagradientDefine an alpha gradient.
d2_setblendmodeChoose blendmode for RGB.
d2_setalphablendmodeChoose blendmode for alpha channel.
d2_setalphablendmodeexChoose blendmode for alpha channel.
d2_setantialiasingGlobally disable or enable antialiasing.
d2_setblurSet global blurring factor.
d2_setlinecapSpecify lineend style.
d2_setlinejoinSpecify polyline connection style.
d2_setmiterlimitClipping distance for miter polyline connections.
d2_setpatternSpecify pattern bitmask.
d2_setpatternalphaSpecify pattern transparency.
d2_setpatternparamDefine mapping of pattern to geometry.
d2_setlinepatternSpecify parameters for aligned patterns.
d2_setpatternmodeDefine pattern addressing details.
d2_setpatternsizeDefine pattern size.
d2_setclipgradientDefine an alpha gradient for clipping.
d2_setcircleextendIncrease bbox of circles.
Context Attribute Queries
d2_getfillmodeQuery fillmode from selected context.
d2_getcolorQuery a color from selected context.
d2_getalphaQuery constant alpha from selected context.
d2_getalphaexQuery constant alpha from selected context.
d2_getalphamodeQuery alpha source from selected context.
d2_getblendmodesrcQuery source blend factor from selected context.
d2_getblendmodedstQuery destination blend factor from selected context.
d2_getalphablendmodesrcQuery source blend factor for alpha channel blending from selected context.
d2_getalphablendmodedstQuery destination blend factor for alpha channel blending from selected context.
d2_getalphablendmodeflagsQuery alpha blend flags from selected context.
d2_getantialiasingQuery antialiasing setting from selected context.
d2_getblurQuery blurring factor from selected context.
d2_getlinecapQuery lineend style from selected context.
d2_getlinejoinQuery polyline connection style from selected context.
d2_getpatternQuery pattern bitmask from selected context.
d2_getpatternmodeQuery pattern addressing details.
d2_getpatternsizeQuery pattern bitmask size.
d2_getpatternalphaQuery pattern transparency from selected context.

Context Management

d2_newcontext

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.

parameters

handledevice pointer (see: d2_opendevice)

returns

context pointer or NULL in case of an error

d2_freecontext

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.

parameters

handledevice pointer (see: d2_opendevice)
ctxcontext pointer

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_getcontext

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.

parameters

handledevice pointer (see: d2_opendevice)
modegetcontext mode determines what context should be returned

getcontext modes

d2_context_defaultreturn the default context
d2_context_selectedreturn the currently selected context (see: d2_selectcontext)
d2_context_solidreturn current solid context (see: d2_solidcontext)
d2_context_outlinereturn current outline context (see: d2_outlinecontext)

returns

context pointer or NULL in case of an error

d2_selectcontext

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.

parameters

handledevice pointer (see: d2_opendevice)
ctxcontext pointer

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

see also

d2_solidcontext, d2_outlinecontext, d2_getcontext

d2_solidcontext

d2_s32 d2_solidcontext(d2_device *handle,
d2_context *ctx)

Define the solid rendering context.

parameters

handledevice pointer (see: d2_opendevice)
ctxcontext pointer

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

see also

d2_selectcontext, d2_outlinecontext, d2_getcontext

d2_outlinecontext

d2_s32 d2_outlinecontext(d2_device *handle,
d2_context *ctx)

Define the outline rendering context.

parameters

handledevice pointer (see: d2_opendevice)
ctxcontext pointer

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

see also

d2_solidcontext, d2_selectcontext, d2_getcontext

Context Attribute Writes

d2_setfillmode

d2_s32 d2_setfillmode(d2_device *handle,
d2_u32 mode)

Select fillmode (solid,patter,texture,..)

parameters

handledevice pointer (see: d2_opendevice)
modefillmode

fill modes

d2_fm_colorsingle color (default)
d2_fm_twocolorblending between color1 and color2 instead of color1 and background
d2_fm_patternfill with pattern
d2_fm_texturefill with texture

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setcolor

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.

parameters

handledevice pointer (see: d2_opendevice)
indexcolor register index (0 or 1)
color24bit rgb color value

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setalpha

d2_s32 d2_setalpha(d2_device *handle,
d2_alpha alpha)

set constant alpha value

parameters

handledevice pointer (see: d2_opendevice)
alphaalpha value (0 is totally transparent, 255 is fully opaque)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setalphaex

d2_s32 d2_setalphaex(d2_device *handle,
d2_s32 index,
d2_alpha alpha)

set constant alpha value

parameters

handledevice pointer (see: d2_opendevice)
indexalpha register index (0 or 1)
alphaalpha 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).

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setalphamode

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.

parameters

handledevice pointer (see: d2_opendevice)
modealpha mode, several values can be or’ed together

alpha modes

d2_am_opaqueno transparency (equal to constant alpha of 0xff)
d2_am_constantconstant transparency (see: d2_setalpha)
d2_am_gradient1alpha gradient1 is active
d2_am_gradient2alpha gradient2 is active

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setalphagradient

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.

parameters

handledevice pointer (see: d2_opendevice)
indexalpha gradient index (0 or 1)
x,ystartpoint of gradient (point of alpha 0) (fixedpoint)
dx,dydirection and length of gradient (distance to point of alpha 255)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setblendmode

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.

parameters

handledevice pointer (see: d2_opendevice)
srcfactorsource blend factor (see available blend factors)
dstfactordestination blend factor (see available blend factors)

blend factors

d2_bm_zeroconstant 0
d2_bm_oneconstant 1
d2_bm_alphacurrent alpha
d2_bm_one_minus_alphainverted alpha

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setalphablendmode

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).

  • The most common blending for alpha channel (and also the default) is write src alpha :
d2_bm_one, d2_bm_zero
  • Another possible mode is alpha blending:
d2_bm_one, d2_bm_one_minus_alpha
  • It is also possible to keep dst alpha :
d2_bm_zero, d2_bm_one

parameters

handledevice pointer (see: d2_opendevice)
srcfactorsource blend factor (see available blend factors)
dstfactordestination blend factor (see available blend factors)

blend factors

d2_bm_zeroconstant 0
d2_bm_oneconstant 1
d2_bm_alphacurrent alpha
d2_bm_one_minus_alphainverted alpha

note

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.

note

the blend flags of the selected context is set to d2_blendf_default (see: d2_setalphablendmodeex)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setalphablendmodeex

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).

  • The most common blending for alpha channel (and also the default) is write src alpha :
d2_bm_one, d2_bm_zero
  • Another possible mode is alpha blending:
d2_bm_one, d2_bm_one_minus_alpha
  • It is also possible to keep dst alpha :
d2_bm_zero, d2_bm_one

parameters

handledevice pointer (see: d2_opendevice)
srcfactorsource blend factor (see available blend factors)
dstfactordestination blend factor (see available blend factors)
blendflagsblend flags (see available blend flags)

blend factors

d2_bm_zeroconstant 0
d2_bm_oneconstant 1
d2_bm_alphacurrent alpha
d2_bm_one_minus_alphainverted alpha

blend flags

d2_blendf_blenddstuse framebuffer alpha as dst alpha (is d2_blendf_default)
d2_blendf_blendcolor2use color2 alpha as dst alpha as input for the blending formula (see: d2_setalphaex)

note

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:

  • (1/0): 1 * src + 0 * dst -> write source alpha
  • (0/1): 0 * src + 1 * dst -> write framebuffer alpha or color2 alpha (depending on blendflags)

These modes also require that the same source blend factor is configured for RGB and A.

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setantialiasing

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.

parameters

handledevice pointer (see: d2_opendevice)
enableboolean value (set 1 to enable antialiasing)

If antaliasing is disabled blurring will also be disabled (see: d2_setblur).

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setblur

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)

parameters

handledevice pointer (see: d2_opendevice)
blurfixed point

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setlinecap

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

parameters

handledevice pointer (see: d2_opendevice)
modelinecap mode

linecap modes

d2_lc_buttlines end directly at endpoints
d2_lc_roundlines end with halfcircles
d2_lc_squareline ends are extended by the half linewidth

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setlinejoin

d2_s32 d2_setlinejoin(d2_device *handle,
d2_u32 mode)

Specify polyline connection style.

Linejoins are applied when rendering polylines using d2_renderpolyline

parameters

handledevice pointer (see: d2_opendevice)
modelinejoin mode

linejoin modes

d2_lj_noneno connection is applied
d2_lj_miterlines meet in a sharp angle (see also d2_setmiterlimit)
d2_lj_roundline are connected by circle segments
d2_lj_bevellines meet in a flat angle

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setmiterlimit

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�.

parameters

handledevice pointer (see: d2_opendevice)
mitermaximum pixel distance the join can extend beyond bevel edge

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setpattern

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.

parameters

handledevice pointer (see: d2_opendevice)
patternN bit pattern mask

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

example

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_setpatternalpha

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.

parameters

handledevice pointer (see: d2_opendevice)
indexregister index (0 or 1 as patterns are always twocolor)
alphaalphavalue (0 is totally transparent, 255 is fully opaque)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

see also

d2_setcolor, d2_setpattern

d2_setpatternparam

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.

parameters

handledevice pointer (see: d2_opendevice)
x, ypattern startpoint (fixedpoint)
dx, dypattern direction and size (fixedpoint)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

see also

d2_setpatternsize, d2_setpattern, d2_setpatternmode

d2_setlinepattern

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.

parameters

handledevice pointer (see: d2_opendevice)
scalenumber of screenpixels one pattern bit is mapped onto
offsetpattern offset in pixels (fixedpoint format equal to d2_point)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

see also

d2_setpatternmode, d2_setpatternparam

d2_setpatternmode

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>.

parameters

handledevice pointer (see: d2_opendevice)
modeany combination of pattern mode bits (see below)

pattern mode bits

d2_pm_filteruse linear interpolation between colors (default)
d2_pm_autoalignmap pattern to line direction (see: d2_setlinepattern)
d2_pm_advanceincrease offset automatically (see: d2_setlinepattern)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

d2_setpatternsize

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.

parameters

handledevice pointer (see: d2_opendevice)
sizenumber of valid bits used for pattern mask

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

please note

when using small pattern size (<8) all leading unused bits in the pattern mask (see: d2_setpattern) must be zero!

d2_setclipgradient

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.

note

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!

parameters

handledevice pointer (see: d2_opendevice)
indexalpha gradient index (0 or 1, additionally 2 or 3)
x,ystartpoint of gradient (point of alpha 0) (fixedpoint)
nx,nynormal vector of the clipping edge, pointing towards the non-clipped side (16.16 fixedpoint)
flagsreserved

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

see also

d2_setalphagradient

d2_setcircleextend

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.

parameters

handledevice pointer (see: d2_opendevice)
offsetnumber by which bbox of circles will be extended (fixedpoint)

returns

errorcode (D2_OK if successful) see list of Errorcodes for details

Context Attribute Queries

d2_getfillmode

d2_u8 d2_getfillmode(d2_device *handle)

Query fillmode from selected context.

see: d2_setfillmode for a list of fill modes

parameters

handledevice pointer (see: d2_opendevice)

returns

Select fillmode (d2_fm_color,d2_fm_pattern,..). undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setfillmode

d2_getcolor

d2_color d2_getcolor(d2_device *handle,
d2_s32 index)

Query a color from selected context.

parameters

handledevice pointer (see: d2_opendevice)
indexcolor register index (0 or 1)

returns

content of specified color register. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setcolor

d2_getalpha

d2_alpha d2_getalpha(d2_device *handle)

Query constant alpha from selected context.

parameters

handledevice pointer (see: d2_opendevice)

returns

content of constant alpha register. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setalpha

d2_getalphaex

d2_alpha d2_getalphaex(d2_device *handle,
d2_s32 index)

Query constant alpha from selected context.

parameters

handledevice pointer (see: d2_opendevice)
indexalpha register index (0 or 1)

returns

content of constant alpha register. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setalphaex

d2_getalphamode

d2_u8 d2_getalphamode(d2_device *handle)

Query alpha source from selected context.

see: d2_setalphamode for a list of alpha mode bits

parameters

handledevice pointer (see: d2_opendevice)

returns

alpha source bitmask. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setalphamode

d2_getblendmodesrc

d2_u32 d2_getblendmodesrc(d2_device *handle)

Query source blend factor from selected context.

see: d2_setblendmode for a list of blendmodes

parameters

handledevice pointer (see: d2_opendevice)

returns

source blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_getblendmodedst, d2_setblendmode

d2_getblendmodedst

d2_u32 d2_getblendmodedst(d2_device *handle)

Query destination blend factor from selected context.

see: d2_setblendmode for a list of blendmodes

parameters

handledevice pointer (see: d2_opendevice)

returns

destination blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_getblendmodesrc, d2_setblendmode

d2_getalphablendmodesrc

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

parameters

handledevice pointer (see: d2_opendevice)

returns

alpha source blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_getalphablendmodedst, d2_setalphablendmode

d2_getalphablendmodedst

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

parameters

handledevice pointer (see: d2_opendevice)

returns

alpha destination blend factor. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_getblendmodesrc, d2_setalphablendmode

d2_getalphablendmodeflags

d2_u8 d2_getalphablendmodeflags(d2_device *handle)

Query alpha blend flags from selected context.

see: d2_setalphablendmodeex for a list of blend flags

parameters

handledevice pointer (see: d2_opendevice)

returns

alpha blend flags.  Undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setalphablendmodeex

d2_getantialiasing

d2_s32 d2_getantialiasing(d2_device *handle)

Query antialiasing setting from selected context.

parameters

handledevice pointer (see: d2_opendevice)

returns

Boolean (0 or 1) antialiasing setting. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setantialiasing

d2_getblur

d2_width d2_getblur(d2_device *handle)

Query blurring factor from selected context.

parameters

handledevice pointer (see: d2_opendevice)

returns

global blurring factor (fixedpoint). undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setblur

d2_getlinecap

d2_u8 d2_getlinecap(d2_device *handle)

Query lineend style from selected context.

see: d2_setlinecap for a list of all line cap modes

parameters

handledevice pointer (see: d2_opendevice)

returns

Linecap mode. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setlinecap

d2_getlinejoin

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

parameters

handledevice pointer (see: d2_opendevice)

returns

Linejoin mode. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setlinejoin

d2_getpattern

d2_pattern d2_getpattern(d2_device *handle)

Query pattern bitmask from selected context.

parameters

handledevice pointer (see: d2_opendevice)

returns

Pattern bitmask. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setpattern

d2_getpatternmode

d2_u32 d2_getpatternmode(d2_device *handle)

Query pattern addressing details.

parameters

handledevice pointer (see: d2_opendevice)

returns

Pattern address mode. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setpatternmode

d2_getpatternsize

d2_s32 d2_getpatternsize(d2_device *handle)

Query pattern bitmask size.

parameters

handledevice pointer (see: d2_opendevice)

returns

Pattern bitmask size. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setpatternsize

d2_getpatternalpha

d2_alpha d2_getpatternalpha(d2_device *handle,
d2_s32 index)

Query pattern transparency from selected context.

parameters

handledevice pointer (see: d2_opendevice)
indexregister index (0 or 1 as patterns are always twocolor)

returns

Pattern alpha. undefined in case of an error (check with d2_geterror or d2_geterrorstring)

see also

d2_setpatternalpha

d2_context * d2_newcontext(d2_device *handle)
Create new context (used to store render settings).
d2_s32 d2_freecontext(d2_device *handle,
d2_context *ctx)
Release Context.
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.
d2_s32 d2_selectcontext(d2_device *handle,
d2_context *ctx)
Make a rendering context active (all following property set operations will use it)
d2_s32 d2_solidcontext(d2_device *handle,
d2_context *ctx)
Define the solid rendering context.
d2_s32 d2_outlinecontext(d2_device *handle,
d2_context *ctx)
Define the outline rendering context.
d2_s32 d2_setfillmode(d2_device *handle,
d2_u32 mode)
Select fillmode (solid,patter,texture,..)
d2_s32 d2_setcolor(d2_device *handle,
d2_s32 index,
d2_color color)
Set color registers.
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)
set constant alpha value
d2_s32 d2_setalphamode(d2_device *handle,
d2_u32 mode)
Choose alpha source.
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.
d2_s32 d2_setblendmode(d2_device *handle,
d2_u32 srcfactor,
d2_u32 dstfactor)
Choose blendmode for RGB.
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)
Choose blendmode for alpha channel.
d2_s32 d2_setantialiasing(d2_device *handle,
d2_s32 enable)
Globally disable or enable antialiasing.
d2_s32 d2_setblur(d2_device *handle,
d2_width blur)
Set global blurring factor.
d2_s32 d2_setlinecap(d2_device *handle,
d2_u32 mode)
Specify lineend style.
d2_s32 d2_setlinejoin(d2_device *handle,
d2_u32 mode)
Specify polyline connection style.
d2_s32 d2_setmiterlimit(d2_device *handle,
d2_width miter)
Clipping distance for miter polyline connections.
d2_s32 d2_setpattern(d2_device *handle,
d2_pattern pattern)
Specify pattern bitmask.
d2_s32 d2_setpatternalpha(d2_device *handle,
d2_s32 index,
d2_alpha alpha)
Specify pattern transparency.
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.
d2_s32 d2_setlinepattern(d2_device *handle,
d2_width scale,
d2_s32 offset)
Specify parameters for aligned patterns.
d2_s32 d2_setpatternmode(d2_device *handle,
d2_u32 mode)
Define pattern addressing details.
d2_s32 d2_setpatternsize(d2_device *handle,
d2_s32 size)
Define pattern size.
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.
d2_s32 d2_setcircleextend(d2_device *handle,
d2_width offset)
Increase bbox of circles.
d2_u8 d2_getfillmode(d2_device *handle)
Query fillmode from selected context.
d2_color d2_getcolor(d2_device *handle,
d2_s32 index)
Query a color 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 constant alpha from selected context.
d2_u8 d2_getalphamode(d2_device *handle)
Query alpha source from selected context.
d2_u32 d2_getblendmodesrc(d2_device *handle)
Query source blend factor from selected context.
d2_u32 d2_getblendmodedst(d2_device *handle)
Query destination blend factor from selected context.
d2_u32 d2_getalphablendmodesrc(d2_device *handle)
Query source blend factor for alpha channel blending from selected context.
d2_u32 d2_getalphablendmodedst(d2_device *handle)
Query destination blend factor for alpha channel blending from selected context.
d2_u8 d2_getalphablendmodeflags(d2_device *handle)
Query alpha blend flags from selected context.
d2_s32 d2_getantialiasing(d2_device *handle)
Query antialiasing setting from selected context.
d2_width d2_getblur(d2_device *handle)
Query blurring factor from selected context.
d2_u8 d2_getlinecap(d2_device *handle)
Query lineend style from selected context.
d2_u8 d2_getlinejoin(d2_device *handle)
Query polyline connection style from selected context.
d2_pattern d2_getpattern(d2_device *handle)
Query pattern bitmask from selected context.
d2_u32 d2_getpatternmode(d2_device *handle)
Query pattern addressing details.
d2_s32 d2_getpatternsize(d2_device *handle)
Query pattern bitmask size.
d2_alpha d2_getpatternalpha(d2_device *handle,
d2_s32 index)
Query pattern transparency from selected context.
d2_device * d2_opendevice(d2_u32 flags)
Create a new device handle.
List of all dave driver errorcodes.
d2_s32 d2_settextureoperation(d2_device *handle,
d2_u8 amode,
d2_u8 rmode,
d2_u8 gmode,
d2_u8 bmode)
Choose texture operation for each channel.
d2_s32 d2_framebuffer(d2_device *handle,
void *ptr,
d2_s32 pitch,
d2_u32 width,
d2_u32 height,
d2_s32 format)
Specify the rendering target.
d2_u32 d2_getrevisionhw(const d2_device *handle)
Query hw revisionID.
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.
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 wide line with 2 different widths.
d2_s32 d2_renderpolyline(d2_device *handle,
const d2_point *data,
d2_u32 count,
d2_width w,
d2_u32 flags)
Render a polyline
short (fixedpoint)
d2_s32 d2_geterror(const d2_device *handle)
Query device error information.
const d2_char * d2_geterrorstring(const d2_device *handle)
Query detailed device error information.
Close