InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IGraphicsPort Class Referenceabstract

#include <IGraphicsPort.h>

Inheritance diagram for IGraphicsPort:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IGRAPHICSPORT }
 
enum  TextGraphicsFlags { kFillText = 1, kStrokeText = 2, kClipText = 4 }
 
enum  RenderingIntent { kPerceptual, kSaturation, kRelative, kAbsolute }
 

Public Member Functions

virtual void Setup ()=0
 
virtual void newpath ()=0
 
virtual void moveto (const PMReal &x, const PMReal &y)=0
 
virtual void rmoveto (const PMReal &x, const PMReal &y)=0
 
virtual void lineto (const PMReal &x, const PMReal &y)=0
 
virtual void curveto (const PMReal &x1, const PMReal &y1, const PMReal &x2, const PMReal &y2, const PMReal &x3, const PMReal &y3)=0
 
virtual void curvetov (const PMReal &x2, const PMReal &y2, const PMReal &x3, const PMReal &y3)=0
 
virtual void closepath ()=0
 
virtual void gsave ()=0
 
virtual void grestore ()=0
 
virtual void translate (const PMReal &x, const PMReal &y)=0
 
virtual void scale (const PMReal &x, const PMReal &y)=0
 
virtual void rotate (const PMReal &theta)=0
 
virtual void concat (const PMMatrix &m)=0
 
virtual void setlinewidth (const PMReal &width)=0
 
virtual void setdash (int32 numDash, float *dashArray, float offset)=0
 
virtual void setblendingmode (PMBlendingMode pmBlendingMode)=0
 
virtual void starttransparencygroup (const PMRect &bounds, AGMColorSpace *cs, bool16 isolationgroup=kTrue, bool16 knockoutgroup=kFalse)=0
 
virtual void endtransparencygroup ()=0
 
virtual void BeginGroup (const PMString name, const_AIMDictionaryContainer *attrib)=0
 
virtual void EndGroup (const PMString name)=0
 
virtual void setopacity (const PMReal &opacity, bool16 bIsAlphaShape)=0
 
virtual void setlinecap (int32 type)=0
 
virtual void setlinejoin (int32 type)=0
 
virtual void setmiterlimit (const PMReal &limit)=0
 
virtual void setstrokeadjust (bool16 strokeAdjust)=0
 
virtual void setgray (const PMReal &gray)=0
 
virtual void setrgbcolor (const PMReal &r, const PMReal &g, const PMReal &b)=0
 
virtual void setcmykcolor (const PMReal &c, const PMReal &m, const PMReal &y, const PMReal &k)=0
 
virtual void setlabcolor (const PMReal &l, const PMReal &a, const PMReal &b)=0
 
virtual void setcolorspace (AGMColorSpace *colorSpace)=0
 
virtual void setcolorvalues (const float *colorVals)=0
 
virtual void setgradient (AGMGradient *agmGrad, const PMMatrix &grMatrix, const PMReal &xOrig, const PMReal &yOrig, const PMReal &len, const PMReal &ang, const PMReal &hiliteLen, const PMReal &hiliteAng)=0
 
virtual void SetColorServer (AGMPaint *agmPaint, bool16 bIsAlphaShape, const PMMatrix &m)=0
 
virtual void SetAlphaServer (AGMPaint *agmPaint, bool16 bIsAlphaShape, const PMMatrix &m)=0
 
virtual void setoverprint (bool32 overprint)=0
 
virtual void fill ()=0
 
virtual void eofill ()=0
 
virtual void stroke ()=0
 
virtual void image (_t_AGMImageRecord *imageRec, const PMMatrix &imMatrix, int32 flags)=0
 
virtual void image (_t_AGMImageRecord *imageRec, AGMColorSpace *cs, const PMMatrix &m, int32 flags)=0
 
virtual void image (AGMImage *image, const PMMatrix &imMatrix, int32 flags)=0
 
virtual void show (const PMReal &x, const PMReal &y, uint32 numUTF16s, const textchar *text, TextGraphicsFlags graphicsflags=kFillText, bool16 verticalGlyphs=kFalse, bool16 wmodePositioning=kFalse)=0
 
virtual void xshow (const PMReal &x, const PMReal &y, uint32 numGlyphs, const int32 *glyphArray, const Fixed *widths, const Fixed *yoffsets=nil, TextGraphicsFlags graphicsflags=kFillText, bool16 verticalGlyphs=kFalse, bool16 wmodePositioning=kFalse, uint32 numChars=0, const textchar *text=nil, K2Vector< OneOTFeature > *otFeatureArray=nil)=0
 
virtual void xshow (const PMReal &x, const PMReal &y, uint32 numGlyphs, const int32 *glyphArray, const float *widths, const float *yoffsets=nil, TextGraphicsFlags graphicsflags=kFillText, bool16 verticalGlyphs=kFalse, bool16 wmodePositioning=kFalse, uint32 numChars=0, const textchar *text=nil, K2Vector< OneOTFeature > *otFeatureArray=nil)=0
 
virtual void ctshow (IFontInstance *fontInstance, PMRealGlyphPoint *glyphPoints, uint32 numGlyphPoints, TextGraphicsFlags graphicsflags=kFillText, bool16 verticalGlyphs=kFalse)=0
 
virtual void selectfont (IPMFont *font, const PMMatrix &m)=0
 
virtual void selectfont (IPMFont *font, const PMReal &ptSize)=0
 
virtual void clip ()=0
 
virtual void eoclip ()=0
 
virtual void strokepath_clip ()=0
 
virtual void rectclip (const PMReal &x, const PMReal &y, const PMReal &width, const PMReal &height)=0
 
virtual void rectclip (const PMRect &r)=0
 
virtual void rectfill (const PMReal &x, const PMReal &y, const PMReal &width, const PMReal &height)=0
 
virtual void rectfill (const PMRect &r)=0
 
virtual void rectstroke (const PMReal &x, const PMReal &y, const PMReal &width, const PMReal &height)=0
 
virtual void rectstroke (const PMRect &r)=0
 
virtual void rectpath (const PMReal &x, const PMReal &y, const PMReal &width, const PMReal &height)=0
 
virtual void rectpath (const PMRect &r)=0
 
virtual void shadingfill (AGMPaint *paint)=0
 
virtual void AddComment (int32 comment, void *commentData, int32 length)=0
 
virtual IDrawMgrPortDrawMgr ()=0
 
virtual void BeginAuxInfoContext (GPortAuxInfoParam *auxInfoParam)=0
 
virtual void EndAuxInfoContext (GPortAuxInfoParam *auxInfoParam)=0
 
virtual void show (const CCTTextList &textList, int32 flags, const PMMatrix *matrix=0) const =0
 
virtual void SetRenderingIntent (RenderingIntent intent)=0
 
virtual void SetOverPrintMode (bool32 mode)=0
 
virtual void FillPath (AGMPath *path)=0
 
virtual void StrokePath (AGMPath *path)=0
 
virtual void ClipPath (AGMPath *path)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

IGraphicsPort is THE drawing API for InDesign. It is a shell around the AGM API.

The methods behave exactly, or very much like the equivalent PostScript operators. See the PostScript language reference manual for complete documentation.

IMPORTANT: if you expect something to print, this is the ONLY interface you can use to do drawing.

Member Enumeration Documentation

Note that these values are defined the same as those in ICMSSettings; but ICMSSettings includes 'virtual' rendering intents that are not allowed in SetRenderingIntent.

See Also
SetRenderingIntent

Member Function Documentation

virtual void IGraphicsPort::BeginGroup (const PMString name,
const_AIMDictionaryContainer * attrib 
)
pure virtual

Starts a named group. Groups surround an arbitrary, and possibly empty, set of drawing operations. The may be nested. Begin/End pairs must be matched within a given context which is identified by the name.

'name' allows for protocols based nesting of multiple different group types 'attrib' dictionary of attributes associated with the group itself rather than each of the enclosed elements.

See Also
PMString const_CAIMDictionary
virtual void IGraphicsPort::clip ()
pure virtual

Sets the clip to the intersection of the current clip and the inside of the current path. Insideness is determined by the winding fill rule (see EOClip to use the even-odd fill rule).

Note: This method does NOT modify the port's current path.

Equivalent to PostScript's 'clip' operator.

See Also
IGraphicsPort::EOClip
virtual void IGraphicsPort::ClipPath (AGMPath * path)
pure virtual

Adds the specified path to the clip in the gstate. Any path currently in the gstate is ignored. In addition, the specified path does not get added to the gstate. However, this will perform an implicit newpath.

Note: The winding rule for the clip is taken from the path itself.

Parameters
pathThe AGM path to clip
virtual void IGraphicsPort::closepath ()
pure virtual

Closes the current subpath. It appends a straight line segment connecting the current point to the subpath's starting point – generally, the point most recently specified by MoveTo.

Equivalent to PostScript's 'closepath' operator.

virtual void IGraphicsPort::concat (const PMMatrixm)
pure virtual

Makes the port's current transformation matrix the product of the current matrix and the given one.

Equivalent to PostScript's 'concat' operator.

virtual void IGraphicsPort::curveto (const PMRealx1,
const PMRealy1,
const PMRealx2,
const PMRealy2,
const PMRealx3,
const PMRealy3 
)
pure virtual

Adds a bezier curve segment to the path. The curve is defined by the path's current point as the first anchor point, (x1,y1) as the first control point, (x2,y2) as the second control point, and (x3,y3) as the second anchor point. (x3,y3) becomes the path's new current point. The path cannot be empty when this call is made.

Equivalent to PostScript's 'curveto' operator.

virtual void IGraphicsPort::curvetov (const PMRealx2,
const PMRealy2,
const PMRealx3,
const PMRealy3 
)
pure virtual

Adds a bezier curve segment to the path. This method is identical to the CurveTo method except that the path's current point is treated as both the first anchor point as well as the first control point.

The method originated in the Adobe Illustrator file format which used a 'v' operator to represent this abbreviated form of curve.

virtual void IGraphicsPort::EndGroup (const PMString name)
pure virtual

Ends a named group.

See Also
PMString
virtual void IGraphicsPort::endtransparencygroup ()
pure virtual

Ends a transparency group. EndTransparencyGroup does an automatic GRestore.

virtual void IGraphicsPort::eoclip ()
pure virtual

Sets the clip to the intersection of the current clip and the inside of the current path. Insideness is determined by the even-odd fill rule (see Clip to use the winding fill rule).

Note: This method does NOT modify the port's current path.

Equivalent to PostScript's 'eoclip' operator.

See Also
IGraphicsPort::Clip
virtual void IGraphicsPort::eofill ()
pure virtual

Paints the inside of the current path. It uses the port's current color and opacity. Insideness is determined by the even-odd fill rule. Use Fill for the winding fill rule.

Note: This method clears the port's current path.

Equivalent to PostScript's 'eofill' operator.

See Also
IGraphicsPort::Fill
virtual void IGraphicsPort::fill ()
pure virtual

Paints the inside of the current path. It uses the port's current color and opacity. Insideness is determined by the winding fill rule. Use EOFill for the even-odd fill rule.

Note: This method clears the port's current path.

Equivalent to PostScript's 'fill' operator.

See Also
IGraphicsPort::EOFill
virtual void IGraphicsPort::FillPath (AGMPath * path)
pure virtual

Fills the specified path using the current color server. Any path currently in the gstate is ignored. In addition, the specified path is not added to the gstate. However, this will perform an implicit newpath.

Note: The winding rule for the fill is taken from the path itself.

Parameters
pathThe AGM path to fill
virtual void IGraphicsPort::grestore ()
pure virtual

Resets the port's current graphics state. It is set to the state that was saved in the previous call to GSave.

Equivalent to PostScript's 'grestore' operator.

virtual void IGraphicsPort::gsave ()
pure virtual
    Makes a copy of the port's current graphics state.

    The new copy becomes the port's new current state.

    The graphics state contains:


  current clip

  current color

  current path

  current stroke settings

  current transformation matrix

Equivalent to PostScript's 'gsave' operator.

virtual void IGraphicsPort::lineto (const PMRealx,
const PMRealy 
)
pure virtual

Adds a line segment to the path. The segment is from the path's current point to the given point. The given point becomes the path's new current point. The path cannot be empty when this call is made.

Equivalent to PostScript's 'lineto' operator.

virtual void IGraphicsPort::moveto (const PMRealx,
const PMRealy 
)
pure virtual

Begins a new subpath within the current path. It also sets the path's current point to the given point.

Note: All valid paths must begin with a call to MoveTo, or HintedMoveTo.

Equivalent to the PostScript 'moveto' operator.

virtual void IGraphicsPort::newpath ()
pure virtual

Clears the port's current path (makes it empty).

Equivalent to the PostScript 'newpath' operator.

virtual void IGraphicsPort::rmoveto (const PMRealx,
const PMRealy 
)
pure virtual

Begins a new subpath within the current path. It also sets the path's current point to the path's existing current point offset by the given coordinates. The 'R' stands for 'relative'. The path cannot be empty when this call is made.

Equivalent to PostScript's 'rmoveto' operator.

virtual void IGraphicsPort::rotate (const PMRealtheta)
pure virtual

Rotates the port's current transformation matrix by the given number of degrees and replaces it.

Equivalent to PostScript's 'rotate' operator.

virtual void IGraphicsPort::scale (const PMRealx,
const PMRealy 
)
pure virtual

Scales the port's current transformation matrix. It uses the given values, which are first mapped by the current transformation matrix so that they are interpreted as being 'user space' values.

Equivalent to PostScript's 'scale' operator.

virtual void IGraphicsPort::SetAlphaServer (AGMPaint * agmPaint,
bool16 bIsAlphaShape,
const PMMatrixm 
)
pure virtual

Installs a paint server as an alpha server.

A subsequent port call to paint, such as Fill or Stroke, will call the paint servers to paint whatever graphic has been drawn with the alpha value(s).

There may be both a color and an alpha paint server installed in the graphic state at the same time.

The alpha server must have a gray colorspace. 'alphaIsShape' defines the alpha values as a shape (NOT opacity).

This server is in effect in addition to fixed alpha.

The optional 'matrix' will be concatenated with current CTM.

TotalMatrix = paint server matrix * SetServer matrix * CTM.

Clients may specify an invalid CAGMPaint. In this case the alpha server is invalid, so none is defined. This is the same as RemoveAlphaServer.

See Also
IGraphicsPort::SetColorServer IGraphicsPort::RemoveAlphaServer
virtual void IGraphicsPort::setblendingmode (PMBlendingMode pmBlendingMode)
pure virtual

Sets current blending mode in GState.

Blending modes are defined in GraphicTypes.h

virtual void IGraphicsPort::SetColorServer (AGMPaint * agmPaint,
bool16 bIsAlphaShape,
const PMMatrixm 
)
pure virtual

Installs a paint server as a color server.

A subsequent port call to paint, such as Fill or Stroke, will call the paint servers to paint whatever graphic has been drawn with the color value(s).

There may be both a color and an alpha paint server installed in the graphic state at the same time.

alphaIsShape defines the alpha values as a shape (NOT opacity).

Optional matrix will be concatenated with current CTM.

TotalMatrix = paint server matrix * SetServer matrix * CTM.

See Also
IGraphicsPort::SetAlphaServer
virtual void IGraphicsPort::setdash (int32 numDash,
float * dashArray,
float offset 
)
pure virtual

Sets the port's current dash pattern. This pattern is used in any later call to Stroke or StrokePathClip.

Equivalent to PostScript's 'setdash' operator.

See Also
CAGMPort::Stroke CAGMPort::StrokePathClip
virtual void IGraphicsPort::setlinecap (int32 type)
pure virtual
    Sets the port's current line cap type.  This type

    is used in any later call to Stroke or StrokePathClip.

    These are the different types:


  Butt cap

  Round cap

  Square cap

Equivalent to PostScript's 'setlinecap' operator.

See Also
GraphicTypes.h for possible values of 'type'
virtual void IGraphicsPort::setlinejoin (int32 type)
pure virtual
    Sets the port's current line join type.  This type

    is used in any later call to Stroke or StrokePathClip.

    Possible types are:


  Miter join

  Round join

  Bevel join

Equivalent to PostScript's 'setlinejoin' operator.

See Also
GraphicTypes.h for possible values of 'type'
IGraphicsPort::Stroke IGraphicsPort::StrokePathClip
virtual void IGraphicsPort::setlinewidth (const PMRealwidth)
pure virtual

Sets the port's current line width. This width is used in any later call to Stroke or StrokePathClip.

A stroke adjusted linewidth can be incremented in steps of .25, giving better and smoother visual results for small linewidths when antialiasing is enabled.

Equivalent to PostScript's 'setlinewidth' operator.

See Also
IGraphicsPort::Stroke IGraphicsPort::StrokePathClip IGraphicsPort::StrokeAdjust
virtual void IGraphicsPort::setmiterlimit (const PMReallimit)
pure virtual

Sets the port's current miter limit. This limit is used iff the port's current join type is miter join in any later call to Stroke or StrokePathClip.

Equivalent to PostScript's 'setmiterlimit' operator.

See Also
CAGMPort::Stroke CAGMPort::StrokePathClip
virtual void IGraphicsPort::setopacity (const PMRealopacity,
bool16 bIsAlphaShape 
)
pure virtual

Sets a constant opacity value. opacity should be between 0.0 (transparent) and (1.0) opaque. AlphaIsShape = true defines the alpha value as shape alpha. This value is in effect in addition to AlphaServer.

virtual void IGraphicsPort::setoverprint (bool32 overprint)
pure virtual

Sets Overprint state in GState.

virtual void IGraphicsPort::SetOverPrintMode (bool32 mode)
pure virtual

Sets the overprint mode for the port. This setting is part of gstate so is saved by gsave and restored by grestore. By default the overprint mode is true (NZO).

Parameters
opm,:True for non-zero overprint; false for full overprint.
virtual void IGraphicsPort::SetRenderingIntent (RenderingIntent intent)
pure virtual

Sets the default rendering intent for any drawing that doesn't specify a particular rendering intent. This default is part of gstate so is saved by gsave and restored by grestore. By default the gstate intent is set to the document vector intent.

See Also
IColorSpaceMgr
Parameters
intent,:The new intent to use.
virtual void IGraphicsPort::setstrokeadjust (bool16 strokeAdjust)
pure virtual

Defines the StrokeAdjust state in the graphics state.

Equivalent to PostScript's 'setstrokeadjust' operator.

virtual void IGraphicsPort::shadingfill (AGMPaint * paint)
pure virtual

This is similar to PostScript's shfill but using a shading paint server.

This method is new for InDesign 3.0

See Also
CAGMPaint
virtual void IGraphicsPort::starttransparencygroup (const PMRectbounds,
AGMColorSpace * cs,
bool16 isolationgroup = kTrue,
bool16 knockoutgroup = kFalse 
)
pure virtual
    Starts a new transparency group.

    'bounds' is in user space and defines the area of the

    transparency group.

    If 'isIsolated' is set, 'colorSpace' defines the colorspace

    of the group. If the group is defaulted or non-isolated,

    the parent's colorspace is used.



    StartTransparencyGroup does an automatic GSave.  It inherits

    all of the current GState except for 3 parameters that are

    reset:


SetAlpha(1.0);

RemoveAlphaServer();

SetBlendingMode(kAGMBlendNormal);

See Also
IGraphicsPort::SetAlpha IGraphicsPort::RemoveAlphaServer IGraphicsPort::SetBlendingMode
virtual void IGraphicsPort::stroke ()
pure virtual

Paints a line following the port's current path with the current color and opacity. The line thickness, dash pattern, joins, and caps are determined by the port's current settings for those (see SetLineWidth, SetLineDash, SetLineJoin, and SetLineCap).

Equivalent to PostScript's 'stroke' operator.

See Also
IGraphicsPort::SetLineWidth IGraphicsPort::SetLineDash IGraphicsPort::SetLineJoin IGraphicsPort::SetLineCap
virtual void IGraphicsPort::StrokePath (AGMPath * path)
pure virtual

Strokes the specified path using the current color server. Any path currently in the gstate is ignored. In addition, the specified path is not added to the gstate. However, this will perform an implicit newpath.

Parameters
pathThe AGM path to stroke
virtual void IGraphicsPort::translate (const PMRealx,
const PMRealy 
)
pure virtual

Offsets the port's current transformation matrix. It uses the given values, which are first mapped by the current transformation matrix so that they are interpreted as being 'user space' values.

Equivalent to PostScript's 'translate' operator.