Foundation > Graphic Objects > The IlvSimpleGraphic Class
 
The IlvSimpleGraphic Class
IlvSimpleGraphic is a fundamental class inherited from IlvGraphic. IlvSimpleGraphic implements all functionality of the IlvGraphic class and adds to each instance an IlvPalette resource used to draw the object. This class lets you carry out operations that access and change graphic properties such as colors, fonts, and patterns that are gathered in an IlvPalette instance associated with the graphic object. It also allows you to apply geometric transformations to objects.
IlvSimpleGraphic objects contain their own IlvPalette object. This means that a graphical object is simultaneously a geometric shape and a set of attributes to display this shape. Thus, from this class you can create new objects needed for your application. Some member functions will be needed, some not. The Rogue Wave® Views object library contains a large number of such objects, and offers a wide range of solutions for almost all kinds of problems.
Member Functions
The IlvSimpleGraphic class includes member functions that allow you to access palette attributes. Every IlvSimpleGraphic object has an IlvPalette object, which can be shared among objects. Therefore, when you ask an IlvSimpleGraphic object to change a graphic property such as its foreground, the following operations are performed:
1. The IlvDisplay::getPalette function is used to search for a new IlvPalette for the new foreground.
2. The member function IlvResource::lock is called for the new palette to increment its reference count.
3. The graphic object’s old palette is called.
4. The member function IlvResource::unLock is called for the old palette.
5. The new palette is registered as the current palette of the object.
These operations guarantee the sharing of the IlvPalette. Users are encouraged to use the same mechanism in the case of IlvPalette objects. This is why member functions that can manipulate resources by changing the graphic attributes, such as IlvGraphic::setForeground, are defined as virtual functions.
Graphic Attributes
The IlvSimpleGraphic constructor needs the IlvPalette object from which it is to obtain resources. The palette parameter can be set to a specific value or left unspecified, by which it takes the value 0. When the palette is set to 0, the default palette of the display object is used. This palette is the one returned by the member function IlvDisplay::defaultPalette. The palette parameter is locked when the object is created and unlocked when it is deleted.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.