Basic Types

Note that several types represent fixedpoint numbers.  The C compiler cannot directly create these from constants.  Therefore if you want to pass an integer value of 42 to a function that expects an argument of e.g. type d2_point you would have to write :

function( 42 << 4 );    // conversion from integer to fixedpoint

see also D2_FIX4(x)

Summary
Basic TypesNote that several types represent fixedpoint numbers.
Types
d2_devicevoid
d2_contextvoid
d2_renderbuffervoid
d2_colorunsigned long
d2_alphaunsigned char
d2_widthshort (fixedpoint)
d2_pointshort (fixedpoint)
d2_bordershort
d2_patternunsigned long
d2_blitposunsigned short

Types

d2_device

void

Abstract type.  The application uses pointers of this type to hold the address of a device structure without knowing its internal layout.

see for example : d2_opendevice

d2_context

void

Abstract type.  The application uses pointers of this type to hold the address of a context structure without knowing its internal layout.

see for example : d2_newcontext

d2_renderbuffer

void

Abstract type.  The application uses pointers of this type to hold the address of a renderbuffer structure without knowing its internal layout.

see for example : d2_newrenderbuffer

d2_color

unsigned long

32bit RGB value.  Upper 8bits are ignored but should be set to zero.  All colors are passed to the driver in this format regardless of the framebuffer format.

see for example : d2_setcolor

d2_alpha

unsigned char

Alpha information is passed as 8bit values.  255 representing fully opaque and 0 totally transparent colors.

see for example : d2_setalpha

d2_width

short (fixedpoint)

Width is defined as an unsigned 10:4 fixedpoint number (4 bits fraction).  So the maximum width is 1023 and the smallest nonzero width is 1/16.

d2_point

short (fixedpoint)

Point defines a vertex component (e.g. the x coordinate of an endpoint) pixel position and is specified as a signed 1:11:4 fixedpoint number (1bit sign, 11 bits integer, 4 bits fraction).  So the integer range is 2047 to -2048 and the smallest positive value is 1/16.

Points are stored as 16bit quantities because they represent direct screen coordinates and therefor do not become larger than 2047 even for HDTV resolutions.

see for example : d2_renderline

d2_border

short

The border type is used only when setting clip borders.  In contrast to points, borders do not contain any fractional information (no subpixel clipping) and are simple 11bit signed integers.

see for example : d2_cliprect

d2_pattern

unsigned long

Patterns are Nbit bitmasks (N is 32 at most so they are passed as longs)

see for example : d2_setpattern

d2_blitpos

unsigned short

Blitpos defines an integer position in the source bitmap of a blit rendering operation.  The allowed range is 0 to 1023.

short (fixedpoint)
Integer to n:4 fixedpoint conversion
d2_device * d2_opendevice(d2_u32 flags)
Create a new device handle.
d2_context * d2_newcontext(d2_device *handle)
Create new context (used to store render settings).
d2_renderbuffer * d2_newrenderbuffer(d2_device *handle,
d2_u32 initialsize,
d2_u32 stepsize)
Create a new renderbuffer.
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_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_cliprect(d2_device *handle,
d2_border xmin,
d2_border ymin,
d2_border xmax,
d2_border ymax)
Specify the clipping rectangle.
d2_s32 d2_setpattern(d2_device *handle,
d2_pattern pattern)
Specify pattern bitmask.
Close