IGrafPort

IGrafPort is an abstract class that represents a port, one of the central objects of the Graphics system. Graphics are drawn to a port, which in turn invokes the rendering operations of a particular device. Object of this class cannot be copied or copy-constructed.


IGrafPort - Member Functions and Data by Group

Constructors & Destructor

Use the constructors and destructor in this group to create and destroy objects of class IGrafPort.


[view class]
~IGrafPort
public:
virtual ~IGrafPort()
Destroys an IGrafPort object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IGrafPort
Constructs a graphics port.


Overload 1
protected:
IGrafPort( IGrafDevice* referencedDevice, IColorMap* colormap = & ( IColorMap::defaultColorMap ( ) ) )
Use this constructor to create an IGrafPort from a referenced graphics device.

referencedDevice
A pointer to the graphics device object.
colormap
A pointer to the color map object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
protected:
IGrafPort()
Use this constructor to create an empty graphics port.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Accessing the Graphics Port

Use the functions in this group to access the graphics port to be registered.


[view class]
portForStateUsage
public:
virtual const IGrafPort* portForStateUsage() const
Provides a more efficient way to get access to the port that needs to have its usage registered.

Return
A constant pointer to itself by default.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Adopting and Relinquishing the Device Context

Use the functions in this group to take ownership of the device context or return it to the caller.


[view class]
adoptDeviceContext
The device context is orphaned when this IGrafPort is destroyed.
public:
void adoptDeviceContext(IPresSpaceHandle)
Takes over the ownership of a device context without deleting any existing device context.

hps
The device context to be adopted.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
orphanDeviceContext
public:
IPresSpaceHandle orphanDeviceContext()
Relinquishes knowledge of, and responsibility for, the device context, returning it to the caller.

Return
A pointer to the orphaned device context.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Conversion from IRectangle to IGRect2D

Use the functions in this group to convert objects of type IRectangle to objects of type IGRect2D.


[view class]
convertRect
public:
virtual IGRect2D convertRect(const IRectangle) const
Convert an IRectangle which is in native coordinate into IGRect2D which is in ICoordinateSystem

rect
The IRectangle object to be converted.

Return
The equivalent IGRect2D rectangle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Converting Values from Pixel to Point

Use the function in this group to convert values from pixels (device coordinate) to points (ideal coordinate). Use the functions in this group to convert coordinates from pixels to points.


[view class]
pixelToPointSize
public:
virtual const IGrafMatrix& pixelToPointSize() const
Converts from device coordinate which is in pixel to "ideal" coordinate which is in point size ( 1/72 inch).

Return
A constant reference to the conversion matrix.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Drawing to the Graphics Device

Use the functions in this group to draw 2D geometric primitives to the graphic device.


[view class]
draw

Use this function to render a geometry, image, or text on the graphics device attached to this IGrafPort object.


Overload 1
public:
void draw( const IGCurve2D& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given IGCurve2D geometry on the graphics device with overriding states.

geometry
A constant reference to the IGCurve2D geometry to be rendered.
attributeState
A constant reference to the new attribute state to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
void draw( const IGArea& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given area geometry on the graphics device with overriding states.

geometry
A constant reference to the area geometry to be rendered.
attributeState
A constant reference to the new attribute state to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
public:
void draw(const IGEllipse2D& geometry)
Use this function to render the given IGEllipse2D geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGEllipse2D object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
public:
void draw( const IGImage& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given IGImage geometry on the graphics device with overriding states.

geometry
A constant reference to the IGImage geometry to be rendered.
attributeState
A constant reference to the new attribute state to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 5
public:
void draw( const IGEllipse2D& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given IGEllipse2D geometry on the graphics device with overriding states.

geometry
A constant reference to the IGEllipse2D geometry to be rendered.
attributeState
A constant reference to the new attribute state to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 6
public:
void draw(const IGImage& geometry, const IGImage& theMask)
Use this function to render the given geometry IGImage on the graphics device using a mask.

geometry
A constant reference to the IGImage object to be rendered.
theMask
A constant reference to the trasparent mask.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 7
public:
void draw( const IGImage& theImage, const IGImage& theMask, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given geometry IGImage on the graphics device with overriding states.

theImage
A constant reference to the IGImage object to be rendered.
theMask
A constant reference to the trasparent mask
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 8
public:
void draw( const IGImage& theImage, const IGImage& theMask, const IGRect2D& srcBounds )
Use this function to render the given image geometry using the given tranparent mask and the final image size. One can scale the image by providing different values for srcBounds.

theImage
A constant reference to the IGImage object to be rendered.
theMask
A constant reference to the mask.
srcBounds
A constant reference to the target image bounding rectangle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 9
public:
void draw( const IGImage& theImage, const IGImage& theMask, const IGRect2D& srcBounds, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render an image using a mask into a target rectangular area with overriding attribute states.

theImage
A constant reference to the IGImage object to be rendered.
theMask
A constant reference to the mask.
srcBounds
A constant reference to the target image bounding rectangle.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 10
public:
void draw( const IGImage& theImage, const IGRect2D& srcBounds )
Use this function to render the given image geometry into the specified bounding rectangle. You can scale the image by providing appropriate values for the target rectangle.

theImage
A constant reference to the image to be rendered.
srcBounds
A constant reference to the bounding rectangle in which to render the image.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 11
public:
void draw( const IGLine2D& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given line geometry on the graph device with overriding attributes.

geometry
A constant reference to the IGLine2D object to be rendered.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 12
public:
void draw( const IGImage& theImage, const IGRect2D& srcBounds, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the image into a target rectangle using the specified attributes.

geometry
A constant reference to the image to be rendered.
srcBounds
A constant reference to the bounding rectangle in which to render the image.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 13
public:
void draw(const IGLoop2D& geometry)
Use this function to render the given loop geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGLoop2D object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 14
public:
void draw( const IGLoop2D& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given loop geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGLoop2D object to be rendered.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 15
public:
void draw(const IGPolygon2D& geometry)
Use this function to render the given polygon geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGPolygon2D object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 16
public:
void draw( const IGPolygon2D& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given polygon geometry on the graphics device with overriding attributes.

geometry
A constant reference to the IGPolygon2D object to be rendered.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 17
public:
void draw(const IGPolyline2D& geometry)
Use this function to render the given polyline geometry on the graphics device attached to this IGrafPort objec

geometry
A constant reference to the IGPolyline2D object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 18
public:
void draw( const IGPolyline2D& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given polyline geometry on the graphics device with overriding attributes.

geometry
A constant reference to the IGPolyline2D object to be rendered.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 19
public:
void draw(const IGRect2D& geometry)
Use this function to render the given rectangle geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGRect2D object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 20
public:
void draw( const IGRect2D& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this function to render the given rectangle geometry on the graphics device with overriding attributes.

geometry
A constant reference to the IGRect2D object to be rendered.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 21
public:
IGPoint2D draw(const IGTextRun& geometry)
Use this method to render the drawable text on the graph device attached to this graf port. It is used only by the implementation of IDrawableText.

geometry
A constant reference to the IGTextRun object.

Text that is rendered with either defaultFont, or cases when facename is not specified, would result in an undentified font, or the first font that matches other specified attributes, being used.

Return
The nextLocation position.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

It is not guaranteed that the font would be exactly the same as that loaded through an IFont constructor. The xlfd string, created for font loading while drawing text, might be altered due to text style setting procedures in IText (IText::addStyles).


Overload 22
public:
IGPoint2D draw( const IGTextRun& geometry, const IAttributeState& attributeState, const IGrafMatrix& modelMatrix = IGrafMatrix::identity ( ) )
Use this method to render the drawable text on the graph device attached to this graf port with overriding attributes. It is used only by the implementation of IDrawableText.

geometry
A constant reference to the IGTextRun object.
attributeState
A constant reference to the new attribute to use.
modelMatrix
A constant reference to the new model matrix to use. Default is IGrafMatrix::identity().

Text that is rendered with either defaultFont, or cases when facename is not specified, would result in an undentified font, or the first font that matches other specified attributes, being used.

Return
The nextLocation position.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

It is not guaranteed that the font would be exactly the same as that loaded through an IFont constructor. The xlfd string, created for font loading while drawing text, might be altered due to text style setting procedures in IText (IText::addStyles).


Overload 23
public:
void draw(const IGLine2D& geometry)
Use this function to render the given line geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGLine2D object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 24
public:
void draw(const IGImage& geometry)
Use this function to render the given IGImage geometry on the graphics device.

geometry
A constant reference to the IGImage object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 25
public:
void draw(const IGCurve2D& geometry)
Use this function to render the given IGCurve2D geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGCurve2D object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 26
public:
void draw(const IGArea& geometry)
Use this function to render the given area geometry on the graphics device attached to this IGrafPort object.

geometry
A constant reference to the IGArea object to be rendered.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Inverting the Device Transformation

Use the function in this group to invert the device tranformation the logical coordinate system.


[view class]
invertedDeviceTransform
public:
virtual const IGrafMatrix& invertedDeviceTransform() const
Get the inverted device tranformation matrix which can convert the coordinates back to its logical coordinate system.

Return
A constant reference to the matrix.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Modifying the Graphics State

Use the functions in this group to mark the graphics state as in use or not in use. Use the functions in this group to modify the graphic state of this object.


[view class]
doneWithState
public:
virtual void doneWithState() const = 0
Marks the graphic state as being no longer in use so that changes to the state can be made.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
useState
public:
virtual void useState() const = 0
Marks the graphic state as being in use so that no changes to the state are made until IGrafPort::doneWithState is called.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining Information About the Graphics Port and Its State

Use the functions in this group to obtain information about the graphics state such as its attributes, its clipping area, the graphics matrix (IGrafMatrix) of the current graphics port, and the device type.


[view class]
attributes
public:
const IAttributeState* attributes() const
Gets the attribute states of the IGrafState.

Return
The pointer to the attributes state.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
clipArea
public:
const IGArea* clipArea() const
Gets the clipping area of of the IGrafState.

Return
The pointer to the clipping area.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
deviceContext
public:
virtual const IPresSpaceHandle& deviceContext()

Get the device context.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
flush
public:
virtual void flush()

Flush the device.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
matrix
public:
const IGrafMatrix* matrix(EMatrixKind) const
Gets the IGrafMatrix of this IGrafPort based on the specified matrix kind.

kind
The specified matrix kind, either kModelMatrix or kViewMatrix.

Return
A pointer to the IGrafMatrix.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
portType
public:
const IString* portType() const
Gets the device type encapsulated by this IGrafPort.

Return
A pointer to the IString specifying the device type.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining IXDC information on AIX

Use the functions in this group to obtain IXDC information on AIX.


[view class]
display
public:
virtual _XDisplay* display() const

Gets the IXDC display information.

Supported Platforms

Windows OS/2 AIX
No No Yes


[view class]
drawable
public:
virtual unsigned long drawable() const

Gets the IXDC drawable information.

Supported Platforms

Windows OS/2 AIX
No No Yes


[view class]
gc
public:
virtual _XGC* gc() const

Gets the IXDC gc information.

Supported Platforms

Windows OS/2 AIX
No No Yes


IGrafPort - Enumerations


[view class]
EGrafPortType
enum EGrafPortType { kIBaseRootGrafPort, 
                     kIExtendedRootGrafPort }
Use these enumerated constants to specify the type of graphics port, that is, whether it is a root graphics port or an extended one.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IGrafPort - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

IGrafPort

Inherited Protected Data