Index

C/C++ Functions

dtOutputSetMDC

DT_SWORD dtOutputSetMDC(DT_DTENGINE engine, DT_ID_SWORD format, DT_ID_SWORD subformat, const DT_MDC* memory_surface, DT_SRAST_L clip_x, DT_SRAST_L clip_y, DT_SRAST_L clip_w, DT_SRAST_L clip_h)

Short Description: Set Output to memory surface (MDC)

dtOutputSetAsMDC

DT_SWORD dtOutputSetAsMDC(DT_DTENGINE engine, DT_ID_SWORD format, DT_ID_SWORD subformat, const DT_MDC* memory_surface, DT_SWORD clip_x, DT_SWORD clip_y, DT_SWORD clip_w, DT_SWORD clip_h)

Short Description: Set Output to memory surface (MDC) - deprecated form

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 dtGlyphDoOutput, dtShapeDoOutput or dtBitmapDoOutput 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.

Parameters

ParameterDescription

engine

Handle of the previously created Standard Engine instance.

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
8-bit indexed color surface. Eight bits (1 byte) are used to represent color indices. Up to 256 colors.

This is the only surface type that provides basic support for rendering in indexed color mode. In this mode, alpha-blending (composing) is disabled. This means that anti-aliased pixels that are rendered by the engine do not interact with the background; they are simply copied onto the surface. In this process any existing pixels in the background are destroyed. As a result, the output is anti-aliased but not blended with the background.

Unless otherwise noted, all other surface types listed below support full alpha-blending (composing).

8

0

gggggggg
8-bit grayscale surface (RGB averaging mode). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = (0.33333*R + 0.33333*G + 0.33333*B).

8

1

TTTTTTTT
8-bit alpha surface. Eight bits (1 byte) are used to represent transparency. 256 alpha values.

8

2

gggggggg
8-bit grayscale surface (RGB normalized mode). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = (0.21268*R + 0.7151*G + 0.07217*B).

8

3

gggggggg
8-bit grayscale surface (R channel). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = R.

8

4

gggggggg
8-bit grayscale surface (G channel). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = G.

8

5

gggggggg
8-bit grayscale surface (B channel). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = B.

8

10

gggggggg
8-bit grayscale surface (inverted RGB averaging mode). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = 255 - (0.33333*R + 0.33333*G + 0.33333*B).

8

12

gggggggg
8-bit grayscale surface (inverted RGB normalized mode). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = 255 - (0.21268*R + 0.7151*G + 0.07217*B).

8

13

gggggggg
8-bit grayscale surface (inverted R channel). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = 255 - R.

8

14

gggggggg
8-bit grayscale surface (inverted G channel). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = 255 - G.

8

15

gggggggg
8-bit grayscale surface (inverted B channel). Eight bits (1 byte) are used to represent the relative intensities of gray. 256 intensities calculated as g = 255 - B.

16

0

xBBBBBGG GGGRRRRR
16-bit RGB surface (1-5-5-5). Five bits are used for each color component. The first bit is not used. 32768 colors.

16

1

BBBBBBGG GGGRRRRR
16-bit RGB surface (6-5-5). Six bits are used for red; five bits are used for green and blue. 65,536 colors.

16

2

BBBBBGGG GGGRRRRR
16-bit RGB surface (5-6-5). Six bits are used for green; five bits are used for red and blue. 65,536 colors.

16

3

BBBBBGGG GGRRRRRR
16-bit RGB surface (5-5-6). Six bits are used for blue; five bits are used for red and green. 65,536 colors.

16

4

BBBBBGGG GGRRRRRx
16-bit RGB surface (5-5-5-1). Five bits are used for each color component. The last bit is not used. 32768 colors.

16

5

BBBBBxGG GGGRRRRR
16-bit RGB surface (5-1-5-5). Five bits are used for each color component. The bit between red and green component is not used. 32768 colors.

16

6

BBBBBGGG GGxRRRRR
16-bit RGB surface (5-5-1-5). Five bits are used for each color component. The bit between green and blue component is not used. 32768 colors.

24

0

BBBBBBBB GGGGGGGG RRRRRRRR
Standard 24-bit RGB surface. Eight bits (1 byte) are used for each color component. 16,777,216 colors.

32

0

BBBBBBBB GGGGGGGG RRRRRRRR xxxxxxxx
32-bit RGB surface. Eight bits (1 byte) are used for each color component. The last byte is not used. 16,777,216 colors.

32

1

xxxxxxxx BBBBBBBB GGGGGGGG RRRRRRRR
32-bit RGB surface. Eight bits (1 byte) are used for each color component. The first byte is not used. 16,777,216 colors.

32

2

BBBBBBBB GGGGGGGG RRRRRRRR TTTTTTTT
32-bit RGB surface. Eight bits (1 byte) are used for each color component. The last byte is used for transparency. 16,777,216 colors, 255 alpha values.

32

3

BBBBBBBB GGGGGGGG RRRRRRRR OOOOOOOO
32-bit RGB surface. Eight bits (1 byte) are used for each color component. The last byte is used for opacity. 16,777,216 colors, 255 alpha values.

32

4

TTTTTTTT BBBBBBBB GGGGGGGG RRRRRRRR
32-bit RGB surface. Eight bits (1 byte) are used for each color component. The first byte is used for transparency. 16,777,216 colors, 255 alpha values.

32

5

OOOOOOOO BBBBBBBB GGGGGGGG RRRRRRRR
32-bit RGB surface. Eight bits (1 byte) are used for each color component. The first byte is used for opacity. 16,777,216 colors, 255 alpha values.

32

6

BBBBBBBB GGGGGGGG RRRRRRRR TTTTTTTT
Same as 32-2, but pixels are not anti-aliased in the RGB channel.

32

7

BBBBBBBB GGGGGGGG RRRRRRRR OOOOOOOO
Same as 32-3, but pixels are not anti-aliased in the RGB channel.

32

8

TTTTTTTT BBBBBBBB GGGGGGGG RRRRRRRR
Same as 32-4, but pixels are not anti-aliased in the RGB channel.

32

9

OOOOOOOO BBBBBBBB GGGGGGGG RRRRRRRR
Same as 32-5, but pixels are not anti-aliased in the RGB channel.

Legend:
i = bits used to describe color indices, the current palette specifies how gray-values are mapped to color indices
g = bits used to describe gray
R = bits used to describe red, G = bits used to describe green, B = bits used to describe blue
T = bits used to describe transparency (0=fully opaque, 255=fully transparent)
O = bits used to describe opacity (0=fully transparent, 255=fully opaque)
x = unused bits

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.

Return Value

If successful, the return value is 1. Otherwise, the function returns 0.

Comments

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

 

Index