Important: The information in this document is obsolete and should not be used for new development.
NewPixPat
Although you should generally create a pixel pattern in a'ppat'resource and retrieve it with theGetPixPatfunction, you can use theNewPixPatfunction to create a new pixel pattern.
FUNCTION NewPixPat: PixPatHandle;DESCRIPTION
TheNewPixPatfunction creates a newPixPatrecord (described on page 4-49) and returns a handle to it. This function calls theNewPixMapfunction to allocate the pattern'sPixMaprecord (described on page 4-37) and initialize it to the same settings as the pixel map of the currentGDevicerecord--that is, as stored in thegdPMapfield of the global variableTheGDevice. This function also sets thepat1Datafield of the newPixPatrecord to a 50 percent gray pattern.NewPixPatallocates new handles for thePixPatrecord's data, expanded data, expanded map, and color table but does not initialize them; instead, your application must initialize them.Set the
rowBytes,bounds, andpixelSizefields of the pattern'sPixMaprecord to the dimensions of the desired pattern. TherowBytesvalue should be equal to(width of bounds)
pixelSize/8The
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'sPixMaprecord.Including the
PixPatrecord itself,NewPixPatallocates a total of five handles. The sizes of the handles to thePixPatandPixMaprecords 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.SPECIAL CONSIDERATIONS
TheNewPixPatfunction may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.