This function connects the Output of the specified Standard Engine instance with a Memory Surface (MDC or Memory Device Context) created and supplied by your application. In this way, any output primitives (e.g. glyphs, shapes, bitmaps) that are sent to the Output (e.g. using the GlyphDoOutput, ShapeDoOutput or BitmapDoOutput function) will be rendered in memory that belongs to that surface. Furthermore, this function sets the clipping rectangle associated with the memory surface so that output primitives that are completely outside the clipping rectangle are not processed/rendered when they are sent to the Output.
Parameter | Description |
---|---|
format |
Specifies the format, or number of bits-per-pixel, of the surface. See below for details. |
subformat |
Color configuration of the pixel. See below for details. |
memory_surface |
A valid pointer to the DT_MDC structure that describes the surface. Alternatively, this value can be set to DV_NULL. See below for details. |
clip_x |
X coordinate of the clipping rectangle in pixels. |
clip_y |
Y coordinate of the clipping rectangle in pixels. |
clip_w |
Width of the clipping rectangle in pixels. |
clip_h |
Height of the clipping rectangle in pixels. |
The format parameter specifies the number of bits-per-pixel and is used to calculate the amount of memory required to store the surface; subformat defines the configuration of a single pixel and is used to calculate the maximum number of colors in the surface. The following table illustrates various pixel configurations supported by D-Type.
format (bits-per-pixel) | subformat | Description |
---|---|---|
8 | -2 |
iiiiiiii Unless otherwise noted, all other surface types listed below support full alpha-blending (composing). |
8 | 0 |
gggggggg |
8 | 1 |
TTTTTTTT |
8 | 2 |
gggggggg |
8 | 3 |
gggggggg |
8 | 4 |
gggggggg |
8 | 5 |
gggggggg |
8 | 10 |
gggggggg |
8 | 12 |
gggggggg |
8 | 13 |
gggggggg |
8 | 14 |
gggggggg |
8 | 15 |
gggggggg |
16 | 0 |
xBBBBBGG GGGRRRRR |
16 | 1 |
BBBBBBGG GGGRRRRR |
16 | 2 |
BBBBBGGG GGGRRRRR |
16 | 3 |
BBBBBGGG GGRRRRRR |
16 | 4 |
BBBBBGGG GGRRRRRx |
16 | 5 |
BBBBBxGG GGGRRRRR |
16 | 6 |
BBBBBGGG GGxRRRRR |
24 | 0 |
BBBBBBBB GGGGGGGG RRRRRRRR |
32 | 0 |
BBBBBBBB GGGGGGGG RRRRRRRR xxxxxxxx |
32 | 1 |
xxxxxxxx BBBBBBBB GGGGGGGG RRRRRRRR |
32 | 2 |
BBBBBBBB GGGGGGGG RRRRRRRR TTTTTTTT |
32 | 3 |
BBBBBBBB GGGGGGGG RRRRRRRR OOOOOOOO |
32 | 4 |
TTTTTTTT BBBBBBBB GGGGGGGG RRRRRRRR |
32 | 5 |
OOOOOOOO BBBBBBBB GGGGGGGG RRRRRRRR |
32 | 6 |
BBBBBBBB GGGGGGGG RRRRRRRR TTTTTTTT |
32 | 7 |
BBBBBBBB GGGGGGGG RRRRRRRR OOOOOOOO |
32 | 8 |
TTTTTTTT BBBBBBBB GGGGGGGG RRRRRRRR |
32 | 9 |
OOOOOOOO BBBBBBBB GGGGGGGG RRRRRRRR |
Legend: Note 1: RGB and alpha values are stored only for pixels that are actually rendered by D-Type. Your application must ensure that the surface is cleared with appropriate values before rendering. For modes 32-2, 32-4, 32-6 and 32-8 the surface's alpha values should be set to 255. For modes 32-3, 32-5, 32-7 and 32-9 the surface's alpha values should be set to 0. Note 2: Modes 32-6, 32-7, 32-8 and 32-9 are suitable for devices that support hardware alpha blending. |
If successful, the return value is 1. Otherwise, the function returns 0.
The OutputSetAsMDC function tells D-Type Engine to redirect all D-Type output to a surface that is created by your application and stored in memory (off-screen). This type of drawing is very fast and supports transparency and alpha blending. However, your application is responsible for creating the surface, copying its bytes to the screen (or other output device) and destroying it. On Windows, the DrawDibDraw function can be used to copy the surface bytes to the screen. For details, look at D-Type's Helper Library For Platform Independent Window Display which implements this.
If memory_surface is set to DV_NULL, the above mentioned memory redirection is disabled. In this case, clipping coordinates are ignored and all output primitives are processed (even if they are completely outside the clipping region). In some applications, this is useful for retrieving plain 8-bit grayscale memory bitmap data via the DT_BMP structure.