InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IconHandler Class Reference

Public Member Functions

 ~IconHandler ()
 
bool SetRsrc (const PluginID &pid, const RsrcID &rid, const bool isRollOver, const bool isDark=false, const float scaleFactor=1.0, const float iconScale=2.0)
 
bool SetRsrc (const RsrcSpec &spec, const float scaleFactor=1.0, const float iconScale=2.0)
 
bool SetFile (const IDFile &idFile, const float scaleFactor=1.0, const float iconScale=2.0)
 
void Draw (IGraphicsPort *gPort, const PMMatrix &imMatrix, int32 agmflags)
 
void DrawDisabled (IGraphicsPort *gPort, const PMMatrix &imMatrix, int32 agmflags)
 
bool HasAlpha ()
 
bool IsLoaded ()
 
void Delete ()
 
int GetHeight () const
 
int GetWidth () const
 
AGMImageRecordGetBitmap () const
 

Constructor & Destructor Documentation

IconHandler::~IconHandler ()

If a SVG/PNG resource has been loaded it deletes it.

Member Function Documentation

void IconHandler::Delete ()

Deletes the SVG/PNG resource, this is done automatically when this class is destroyed

void IconHandler::Draw (IGraphicsPortgPort,
const PMMatriximMatrix,
int32 agmflags 
)

Draw's the SVG/PNG to the supplied graphics port

Parameters
IGraphicsPort,:IGraphicsPort to draw to
PMMatrix,:Transformation matrix to apply to the SVG/PNG, if no translation is desired use the idenity matrix or just a plain PMMatrix.
agmflags,:Any desired AGM flags, use 0 if none are desired.
void IconHandler::DrawDisabled (IGraphicsPortgPort,
const PMMatriximMatrix,
int32 agmflags 
)

Draw's the SVG/PNG with a 50% transparensy see regular draw methode for more info.

AGMImageRecord* IconHandler::GetBitmap () const
Returns
A pointer to the AGMImageRecord for the loaded SVG resource
int IconHandler::GetHeight () const
Returns
The height of the loaded SVG/PNG resource
int IconHandler::GetWidth () const
Returns
The width of the loaded SVG/PNG resource
bool IconHandler::HasAlpha ()

Does the SVG/PNG have a alpha?

Returns
true if SVG/PNG contains pixels not totally opaque
bool IconHandler::IsLoaded ()

Did the SVG/PNG sucessfully load?

Returns
true if loaded
bool IconHandler::SetFile (const IDFileidFile,
const float scaleFactor = 1.0,
const float iconScale = 2.0 
)

Deletes any currently loaded resource and loads a SVG/PNG image file resource in from the supplied file.

Parameters
pathto a SVG/PNG file
floatscale factor at which image should be displayed.
floatscale of the icon.
Returns
true if file / resource was loaded
bool IconHandler::SetRsrc (const PluginIDpid,
const RsrcID & rid,
const bool isRollOver,
const bool isDark = false,
const float scaleFactor = 1.0,
const float iconScale = 2.0 
)

Deletes any currently loaded resource and loads a SVG/PNG image from a plugin's resource. First tries for SVG then for PNG. SVG images are preferred.

Parameters
PluginID,:PluginId to load the resource from
RsrcID,:Resource ID of the SVG/PNG
bool,:Rollover resource? If false, then a resource type of "SVGA/PNGA" will be loaded, else a resource type of "SVGR/PNGR" will be loaded.
bool,:Dark UI resource? If false, then a resource type of "SVGA/PNGA" (or "SVGR/PNGR" if isRollover is true) will be loaded, else a resource type of "SVGD/PNGD" (or "SVGK/PNGK" if isRollover is true) will be loaded. Default is false.
floatscale factor at which image should be displayed.
floatscale of the icon.
Returns
true if file / resource was loaded