CD - Canvas Draw

Microsoft Windows Base Driver

This driver represents a base driver for all system-dependent drivers implemented in the Microsoft Windows system. The implementation uses Win32 API functions, but is totally compatible with Win32s, which means that the library will work in Windows NT 3.5 or later, Windows 95 and Windows 3.1 or later, as well as Win32s version 1.3 or later. If you do not have the latest Win32s, download the file WIN32S.ZIP (2.41Kb).

Note: In Windows 95 and Windows 3.xx, the coordinates internally implemented by the video driver use 16-bit integers. Therefore, if a coordinate with less than -32k or more than 32k is defined, it will be interpreted incorrectly.


Behavior of Functions

Control 

Coordinate System and Clipping

  • cdUpdateYAxis: the orientation of axis Y is the opposite to its orientation in the CD library.

Primitives

  • cdMark: is simulated.
  • cdText: when Write Mode is XOR or NOT_XOR, the XOR effect is simulated using bitmaps.
  • cdBegin: if the parameter CD_CLIP is specified, the polygon created will be used as a clipping polygon.
  • cdLine: needs to draw an extra pixel in the final position.

Attributes

  • cdWriteMode: for the client and server image functions, the mode NOT_XOR works as XOR.
  • cdStipple: is always opaque. If not in Windows NT and if width or height are greater than 8, the stipple is simulated using non-regular Windows clipping regions and bitmaps. The simulation is made when filled boxes, sectors and polygons are drawn.
  • cdPattern: If not in Windows NT and if width or height are greater than 8, the pattern is simulated using non-regular Windows clipping regions and bitmaps. The simulation is made when filled boxes, sectors and polygons are drawn.
  • cdTextAlignment: the vertical alignment of CD_CENTER, CD_EAST, CD_WEST is manually calculated.
  • cdLineWidth: in Windows 95 and Win32s, line width is always 1.
  • cdNativeFont: the font string describer has the following format:
    "fontname, size [style] [-k] [-u]", where fontname is the name of the font in Windows (notice the comma after the font name), size is given in points, style is the same as cdFont, -u means underline and -k means strikethrough, or "-d" to show the font-selection dialogue box. However, this function also accepts the font string used by the WINFONT attribute of the IUP library.
  • cdFont: see the font mapping table for the equivalence used to map CD fonts into Windows fonts:
Font Mapping
CD Fonts Windows Fonts
CD_SYSTEM System
CD_COURIER Courier New
CD_TIMES_ROMAN Times New Roman
CD_HELVETICA Arial

Client Images

  • cdPutImageRGBA: captures an image from the canvas to blend it with the given image using the transparency information.

Colors

  • cdPalette: is useful only if the device has 256 colors. If it has less than 256 colors, ignore this function, for it will not make much difference. If two different canvases have their palettes modified, the last one to be modified will have the best quality; the other one will not have good quality and the colors might have a completely different appearance.

Exclusive Attributes

  • "SIMXORTEXT": controls the internal XOR simulation for text. Assumes values "1" (active) and "0" (inactive). Default value: "1".
  • "SIMPATTERN8X8": controls the internal pattern and stipple simulation. Assumes values "1" (active) and "0" (inactive). Default value: "1".
  • "SIMPENFILLPOLY": controls the internal polygon filling simulation. Assumes values "1" (active) and "0" (inactive). Default value: "1". When a filled polygon is drawn, a line in the same color is used to draw the border which is not included in the filling. Deactivating this attribute solves the problem of polygons with holes, in which there is a line connecting the external polygon to the internal polygon.
  • "HDC": returns the HDC of the Win32 canvas. Read-only attribute, cannot be changed.
  • "IMAGEMASK":  allows the usage of an image as a transparency mask. The format is the some of a stipple. It should be an array of longs, where the first is the width, the second is the height, then the mask values. Works only for server imagens. Use NULL to remove the attribute. It can not be retreived.
  • "IMAGEPOINTS":  allows the usage of 3 coordinates (x, y) in an array of longs, that define 3 vertex of paralelogram that will be used to warp the image in the susequent calls of cdPutImageRect. Works only for server imagens. The Y values must already being converted by the cdUpdateYAxis function. Use NULL to remove the attribute. It can not be retreived.
  • "USERLINESTYLE":  allows the usage of n values in an array of chars, that define the line style sequence. The first value is the number of values. Use NULL to remove the attribute.