Viewport Functions

Framebuffer and view specific functions.

Summary
Viewport FunctionsFramebuffer and view specific functions.
Clipping
d2_cliprectSpecify the clipping rectangle.
d2_getcliprectGet the clipping rectangle.
Framebuffer management
d2_framebufferSpecify the rendering target.
d2_getframebufferGet information about the rendering target

Clipping

d2_cliprect

d2_s32 d2_cliprect(d2_device *handle,
d2_border xmin,
d2_border ymin,
d2_border xmax,
d2_border ymax)

Specify the clipping rectangle.

No pixels outside the clipping rectangle are touched (rendered or read).  The clipping borders are specified as integer positions (in contrast to rendering where subpixel positions are supported).

The driver checks whether the specified rectangle fits within the framebuffer memory (by checking the dimensions given with d2_framebuffer).  Cliprects will be automatically adjusted to fit inside the framebuffer region.

parameters

handledevice pointer (see: d2_opendevice)
xmininteger pixel position of left border (inclusive)
ymininteger pixel position of top border (inclusive)
xmaxinteger pixel position of right border (inclusive)
ymaxinteger pixel position of bottom border (inclusive)

returns

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

d2_getcliprect

d2_s32 d2_getcliprect(d2_device *handle,
d2_border *xmin,
d2_border *ymin,
d2_border *xmax,
d2_border *ymax)

Get the clipping rectangle.

No pixels outside the clipping rectangle are touched (rendered or read).  The clipping borders are specified as integer positions (in contrast to rendering where subpixel positions are supported).

parameters

handledevice pointer (see: d2_opendevice)
xminpointer to an integer that receives pixel position of left border
yminpointer to an integer that receives pixel position of top border
xmaxpointer to an integer that receives pixel position of right border
ymaxpointer to an integer that receives pixel position of bottom border

returns

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

Framebuffer management

d2_framebuffer

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.

Use this function to define the framebuffer’s memory area and layout.  All subsequent Rendering Functions will work on the given buffer.

Setting a new framebuffer will automatically adjust the cliprect to the maximum range [0 .. width-1] and [0 .. height-1]

parameters

handledevice pointer (see: d2_opendevice)
ptraddress of the top left pixel (coordinate 0,0)
pitchnumber of pixels (not bytes) per scanline
widthwidth of framebuffer in pixels (equal or less than pitch)
heightheight of framebuffer in pixels
formatpixel encoding type (framebuffer format)

framebuffer formats

d2_mode_alpha8monochrome 8bit per pixel
d2_mode_rgb565colored 16bit per pixel
d2_mode_argb8888colored 32bit per pixel
d2_mode_argb4444colored 16bit per pixel
d2_mode_rgba8888colored 32bit per pixel
d2_mode_rgba4444colored 16bit per pixel

returns

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

note

this function has no effect on what memory area is currently visible

d2_getframebuffer

d2_s32 d2_getframebuffer(d2_device *handle,
void **ptr,
d2_s32 *pitch,
d2_u32 *width,
d2_u32 *height,
d2_s32 *format)

Get information about the rendering target

Use this function to get information about the framebuffer’s memory area and layout (framebuffer pointer, pitch, size and format).

parameters

handledevice pointer (see: d2_opendevice)
ptrpointer to receive address of the top left pixel (coordinate 0,0)
pitchpointer to receive number of pixels (not bytes) per scanline
widthpointer to receive width of framebuffer in pixels (equal or less than pitch)
heightpointer to receive height of framebuffer in pixels
formatpointer to receive pixel encoding type (framebuffer format)

framebuffer formats

d2_mode_alpha8monochrome 8bit per pixel
d2_mode_rgb565colored 16bit per pixel
d2_mode_argb8888colored 32bit per pixel
d2_mode_argb4444colored 16bit per pixel

returns

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

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_getcliprect(d2_device *handle,
d2_border *xmin,
d2_border *ymin,
d2_border *xmax,
d2_border *ymax)
Get the clipping rectangle.
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_s32 d2_getframebuffer(d2_device *handle,
void **ptr,
d2_s32 *pitch,
d2_u32 *width,
d2_u32 *height,
d2_s32 *format)
Get information about the rendering target
d2_device * d2_opendevice(d2_u32 flags)
Create a new device handle.
List of all dave driver errorcodes.
There is a rendering function for each supported geometric shape.
Close