Important: The information in this document is obsolete and should not be used for new development.
NewPixPatAlthough you should generally create a pixel pattern in a
'ppat'resource and retrieve it with the
GetPixPatfunction, you can use the
NewPixPatfunction to create a new pixel pattern.
FUNCTION NewPixPat: PixPatHandle;
NewPixPatfunction creates a new
PixPatrecord (described on page 4-49) and returns a handle to it. This function calls the
NewPixMapfunction to allocate the pattern's
PixMaprecord (described on page 4-37) and initialize it to the same settings as the pixel map of the current
GDevicerecord--that is, as stored in the
gdPMapfield of the global variable
TheGDevice. This function also sets the
pat1Datafield of the new
PixPatrecord to a 50 percent gray pattern.
NewPixPatallocates new handles for the
PixPatrecord's data, expanded data, expanded map, and color table but does not initialize them; instead, your application must initialize them.
pixelSizefields of the pattern's
PixMaprecord to the dimensions of the desired pattern. The
rowBytesvalue should be equal to
(width of bounds)
rowBytesvalue need not be even. The width and height of the bounds must be a power of 2. Each scan line of the pattern must be at least 1 byte in length--that is, ([width of bounds]
pixelSize) must be at least 8.
Your application can explicitly specify the color corresponding to each pixel value with a color table. The color table for the pattern must be placed in the
pmTablefield in the pattern's
NewPixPatallocates a total of five handles. The sizes of the handles to the
PixMaprecords are the sizes of their respective data structures. The other three handles are initially small in size. Once the pattern is drawn, the size of the expanded data is proportional to the size of the pattern data, but adjusted to the depth of the screen. The color table size is the size of the record plus 8 bytes times the number of colors in the table.
When you are finished using the pixel pattern, use the
DisposePixPatprocedure, which is described on page 4-82, to make the memory used by the pixel pattern available again.
NewPixPatfunction may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.