Not Recommended Documentclose button

Important: The information in this document is Not Recommended and should not be used for new development.

Current information on this Reference Library topic can be found here:

Version: 1.0

Posted: 2003-10-10

Build Requirements: N/A

Runtime Requirements: Carbon (both 9 and X) Color QuickDraw, CarbonLib

View Source Code:

Download Sample (“Palette_and_GWorld.zip”, 51.1K)
Download Sample (“Palette_and_GWorld.dmg”, 107.4K)



Description

This sample demonstrates the use of palette and color tables with GWorlds. It has been updated for Carbon. This app copies from two offscreen GWorlds into the left and right halves of the window. The contents of the GWorlds are vertical lines that show all the entries in the color tables associated with the GWorlds. The GWorlds were created as described below. One commonly asked question is how to use a palette when drawing into a GWorld. The trick is understanding that while setting a palette to a GWorld is permitted, doing so does not change the GWorld's color table. The solution is to make a palette from the color table ( or the color table from a palette) and to use that color table to create or update the GWorld. After then doing a SetGWorld you can either draw with Index2Color and RGBForeColor, or you can set the palette to the GWorld and draw with PmForeColor. These techniques are shown in the procedures createRGBForeColorImage and createPmForeColorImage in Palette and GWorld.c. Requirements: Color QuickDraw, CarbonLib Keywords: palette, GWorld, Index2Color, RGBForeColor, PmForeColor, GetCTable, NewPalette, GetMainDevice, NSetPalette, pmTable, ctSeed, GetGWorldPixMap, Carbon

Document Revision History

Date Notes
2003-10-10Demonstrates the use of palette and color tables with GWorlds.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.