ImagemapRenderRegion Class Reference

The render region for the imagemap filter. More...

#include <filtirr.h>

Inheritance diagram for ImagemapRenderRegion:

RenderRegion ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ImagemapRenderRegion ()
 Default constructor.
 ImagemapRenderRegion (ImagemapFilterOptions ifoOptions)
 Specific constructor, using a set of ImagemapFilterOptions.
 ~ImagemapRenderRegion ()
 Destructor.
BOOL Init ()
 Initialise the render region.
BOOL StopRender ()
void DrawPathToOutputDevice (Path *PathToRender, PathShape shapePath)
 Renders this path into the ImagemapRenderRegion.
void DrawRect (DocRect *RectToRender)
 Does nothing.
void DrawDragRect (DocRect *RectToRender)
 Should not be called for this kind of render region.
void DrawLine (const DocCoord &StartPoint, const DocCoord &EndPoint)
 None at present - this function should not be called during ink rendering.
void DrawPixel (const DocCoord &Point)
 Should not be called for this kind of render region.
void DrawBlob (DocCoord p, BlobType type)
 Should not be called for this kind of render region.
void DrawCross (const DocCoord &Point, const UINT32 Size)
 Should not be called for this kind of render region.
void DrawBitmap (const DocCoord &Point, KernelBitmap *pBitmap)
void DrawBitmap (const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID=NULL)
void DrawBitmapBlob (const DocCoord &Point, KernelBitmap *BlobShape)
void DrawBitmapBlob (const DocCoord &Point, ResourceID resID)
void GetRenderRegionCaps (RRCaps *pCaps)
 This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.
virtual BOOL WantsGrids ()
 very little
INT32 Write (CCLexFile *pfileToWrite=NULL, TCHAR *pcBuffer=NULL)
 Writes the imagemap HTML, either to the file or the text buffer or both:.
BOOL IsEmpty ()

Protected Member Functions

void InitClipping ()
void InitAttributes ()
void SetOSDrawingMode ()
void SetQualityLevel ()
 Does nothing.
MILLIPOINT CalcPixelWidth ()
 None for Imagemap render regions - just returns 1.
MILLIPOINT CalcScaledPixelWidth ()
 None for CMX render regions - just returns 1.
void AddRectangleToImagemap (DocRect rectToAdd, WebAddressAttribute *pwaaCurrent)
 Scales the rectangle then adds it to the imagemap list.
void AddCircleToImagemap (Path *ppthToAdd, WebAddressAttribute *pwaaCurrent)
 Scales the path then adds it to the imagemap list as a circle.
void AddPathToImagemap (Path *ppthToScale, WebAddressAttribute *pwaaCurrent)
 This function goes through the subpaths of the path one by one.

Protected Attributes

ImagemapFilterOptions m_Options
Imagemap m_Imagemap

Detailed Description

The render region for the imagemap filter.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/4/97
This render region has as a member an "Imagemap", which is a list of clickable areas.

The render region works as follows. The Imagemap starts off empty. Then, whenever something is rendered into this render region and there is a current WebAddressAttribute with a non-empty URL, a clickable area is added to the imagemap.

Definition at line 129 of file filtirr.h.


Constructor & Destructor Documentation

ImagemapRenderRegion::ImagemapRenderRegion  ) 
 

Default constructor.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97

Definition at line 127 of file filtirr.cpp.

00127                                            : RenderRegion()
00128 {
00129     m_Options=ImagemapFilterOptions();
00130 }

ImagemapRenderRegion::ImagemapRenderRegion ImagemapFilterOptions  ifoOptions  ) 
 

Specific constructor, using a set of ImagemapFilterOptions.

> ImagemapRenderRegion::ImagemapRenderRegion(ImagemapFilterOptions ifoOptions)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Note how this contructor works. It calls the RenderRegion constructor:

RenderRegion(ClipRect, ConvertMatrix, ViewScale)

with ClipRect derived from the ImagemapFilterOptions, ConvertMatrix set to the identity and ViewScale set to 1.

Definition at line 151 of file filtirr.cpp.

00151                                                                            :
00152 RenderRegion(ImagemapFilterOptions::GetSizeOfExportArea(ifoOptions.m_stExportArea), Matrix(), 1)
00153 {
00154     m_Options=ifoOptions;
00155 }

ImagemapRenderRegion::~ImagemapRenderRegion  ) 
 

Destructor.

> ImagemapRenderRegion::~ImagemapRenderRegion()

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97

Definition at line 169 of file filtirr.cpp.

00170 {
00171     m_Imagemap.DeleteAll();
00172 }


Member Function Documentation

void ImagemapRenderRegion::AddCircleToImagemap Path ppthToScale,
WebAddressAttribute pwaaCurrent
[protected]
 

Scales the path then adds it to the imagemap list as a circle.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/97
Parameters:
ppthToAdd The circle to add to the imagemap [INPUTS] pwaaToAdd Pointer to the current WebAddressAttribute
See also:
ImagemapRenderRegion::DrawPathToOutputDevice

Definition at line 523 of file filtirr.cpp.

00524 {
00525     //First get the origin of the export area and the DPI
00526     DocCoord dcOrigin=ImagemapFilterOptions::GetOriginOfExportArea(m_Options.m_stExportArea);
00527     double dDPI=m_Options.m_dDPI;
00528 
00529     //Now make a copy of the path
00530     Path pthToAdd;
00531     
00532     pthToAdd.Initialise(ppthToScale->GetNumCoords());
00533 
00534     pthToAdd.CopyPathDataFrom(ppthToScale);
00535 
00536     //Scale it
00537     pthToAdd.Scale(dcOrigin, dDPI);
00538 
00539     //And add it to the imagemap
00540     m_Imagemap.AddCircle(&pthToAdd, pwaaCurrent->m_url.GetWebAddress(), pwaaCurrent->m_pcFrame);
00541     
00542 }

void ImagemapRenderRegion::AddPathToImagemap Path ppthToAdd,
WebAddressAttribute pwaaCurrent
[protected]
 

This function goes through the subpaths of the path one by one.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/97
Parameters:
ppthToAdd The path to add to the imagemap [INPUTS] pwaaToAdd Pointer to the current WebAddressAttribute
For each closed subpath, it: a. Scales the subpath b. Flattens the subpath c. Adds the result to the imagemap

See also:
ImagemapRenderRegion::DrawPathToOutputDevice

Definition at line 564 of file filtirr.cpp.

00565 {
00566     //First get the origin of the export area and the DPI
00567     DocCoord dcOrigin=ImagemapFilterOptions::GetOriginOfExportArea(m_Options.m_stExportArea);
00568     double dDPI=m_Options.m_dDPI;
00569 
00570     //Now, how many subpaths are there in this path?
00571     INT32 lNumSubpaths=ppthToAdd->GetNumSubpaths();
00572 
00573     //For each subpath in the path
00574     for (INT32 l=0; l<lNumSubpaths; l++)
00575     {
00576         //Create a new path
00577         Path pthSubpath;
00578 
00579         pthSubpath.Initialise(ppthToAdd->GetNumCoords());
00580 
00581         //And copy the next subpath into it
00582         ppthToAdd->MakePathFromSubPath(l, &pthSubpath);
00583 
00584         //Now, if that subpath is closed
00585         if (pthSubpath.IsSubPathClosed(0))
00586         {
00587             //Then we want to add it to the imagemap
00588 
00589             //So scale it to dDPI and by dcOrigin
00590             pthSubpath.Scale(dcOrigin, dDPI);
00591     
00592             //Now we need to flatten it.
00593             //This means creating a new path, because otherwise Path::Flatten
00594             //goes wrong
00595 
00596             Path pthFlattened;
00597 
00598             pthFlattened.Initialise(pthSubpath.GetNumCoords());
00599 
00600             //So, if we should flatten the path
00601             if (m_Options.m_ffApprox!=FF_NOTATALL)
00602                 //Then do it
00603                 pthSubpath.Flatten(m_Options.m_ffApprox, &pthFlattened);
00604             else
00605                 //Otherwise, simply copy the path across
00606                 pthFlattened.CopyPathDataFrom(&pthSubpath);
00607 
00608             //Then add the flattened path to the imagemap
00609             m_Imagemap.AddPolygon(&pthFlattened, pwaaCurrent->m_url.GetWebAddress(), pwaaCurrent->m_pcFrame);
00610         }
00611     }
00612             
00613     
00614 }

void ImagemapRenderRegion::AddRectangleToImagemap DocRect  rectToScale,
WebAddressAttribute pwaaCurrent
[protected]
 

Scales the rectangle then adds it to the imagemap list.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/97
Parameters:
rectToAdd The rectangle to add to the imagemap [INPUTS] pwaaToAdd Pointer to the current WebAddressAttribute
See also:
ImagemapRenderRegion::DrawPathToOutputDevice

Definition at line 482 of file filtirr.cpp.

00483 {
00484     //First get the origin of the export area and the DPI
00485     DocCoord dcOrigin=ImagemapFilterOptions::GetOriginOfExportArea(m_Options.m_stExportArea);
00486     double dDPI=m_Options.m_dDPI;
00487 
00488     //Scale the rectangle
00489     rectToScale.lo.Scale(dcOrigin, dDPI);
00490     rectToScale.hi.Scale(dcOrigin, dDPI);
00491 
00492     //Now, in scaling the rectangle we may have made it invalid (for example, we
00493     //may have scaled rectToScale.lo so that it is actually higher than recToScale.hi).
00494 
00495     //So create a new valid rectangle
00496     DocRect rectToAdd;
00497 
00498     rectToAdd.lo.x=MIN(rectToScale.lo.x, rectToScale.hi.x);
00499     rectToAdd.hi.x=MAX(rectToScale.lo.x, rectToScale.hi.x);
00500     rectToAdd.lo.y=MIN(rectToScale.lo.y, rectToScale.hi.y);
00501     rectToAdd.hi.y=MAX(rectToScale.lo.y, rectToScale.hi.y);                     
00502 
00503     //And add it to the imagemap
00504     m_Imagemap.AddRectangle(rectToAdd, pwaaCurrent->m_url.GetWebAddress(), pwaaCurrent->m_pcFrame);
00505     
00506 }

MILLIPOINT ImagemapRenderRegion::CalcPixelWidth void   )  [protected, virtual]
 

None for Imagemap render regions - just returns 1.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
Width of pixels on millipoints.

Errors: -

See also:
ImagemapRenderRegion::CalcScaledPixelWidth

Implements RenderRegion.

Definition at line 371 of file filtirr.cpp.

00372 {
00373     //Return an invalid value
00374     return 1;
00375 }

MILLIPOINT ImagemapRenderRegion::CalcScaledPixelWidth void   )  [protected, virtual]
 

None for CMX render regions - just returns 1.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
Scaled width of pixels on millipoints.

Errors: ENSURE failure if called.

See also:
ImagemapRenderRegion::CalcPixelWidth

Implements RenderRegion.

Definition at line 390 of file filtirr.cpp.

00391 {
00392     //Return an invalid value
00393     return 1;
00394 }

void ImagemapRenderRegion::DrawBitmap const DocCoord Point,
UINT32  BitmapID,
UINT32  ToolID = NULL
[inline, virtual]
 

Implements RenderRegion.

Definition at line 156 of file filtirr.h.

00156 {}

void ImagemapRenderRegion::DrawBitmap const DocCoord Point,
KernelBitmap pBitmap
[inline, virtual]
 

Implements RenderRegion.

Definition at line 155 of file filtirr.h.

00155 {}

void ImagemapRenderRegion::DrawBitmapBlob const DocCoord Point,
ResourceID  resID
[inline, virtual]
 

Implements RenderRegion.

Definition at line 159 of file filtirr.h.

00159 {}

void ImagemapRenderRegion::DrawBitmapBlob const DocCoord Point,
KernelBitmap BlobShape
[inline, virtual]
 

Implements RenderRegion.

Definition at line 158 of file filtirr.h.

00158 {}

void ImagemapRenderRegion::DrawBlob DocCoord  p,
BlobType  type
[virtual]
 

Should not be called for this kind of render region.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
Errors: ENSURE failure if called.
See also:
RenderRegion::DrawBlob

Implements RenderRegion.

Definition at line 220 of file filtirr.cpp.

00221 {
00222     ENSURE(FALSE, "DrawBlob called while exporting!");
00223 }

void ImagemapRenderRegion::DrawCross const DocCoord Point,
const UINT32  Size
[virtual]
 

Should not be called for this kind of render region.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
Errors: ENSURE failure if called.
See also:
RenderRegion::DrawCross

Implements RenderRegion.

Definition at line 237 of file filtirr.cpp.

00238 {
00239     ENSURE(FALSE, "DrawCross called while exporting!");
00240 }

void ImagemapRenderRegion::DrawDragRect DocRect RectToRender  )  [virtual]
 

Should not be called for this kind of render region.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
Errors: ENSURE failure if called.
See also:
RenderRegion::DrawDragRect

Implements RenderRegion.

Definition at line 186 of file filtirr.cpp.

00187 {
00188     ENSURE(FALSE, "DrawDragRect called while exporting!");
00189 }

void ImagemapRenderRegion::DrawLine const DocCoord StartPoint,
const DocCoord EndPoint
[virtual]
 

None at present - this function should not be called during ink rendering.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
Errors: ENSURE failure if called.

Implements RenderRegion.

Definition at line 353 of file filtirr.cpp.

00354 {
00355     ENSURE(FALSE, "ImagemapRenderRegion::DrawLine called - this should not happen!");
00356 }

void ImagemapRenderRegion::DrawPathToOutputDevice Path ppthRender,
PathShape  shapePath
[virtual]
 

Renders this path into the ImagemapRenderRegion.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Parameters:
ppthRender - Pointer to the path to render [INPUTS] shapePath - Tag to tell us what shape the path is. The values we are interested in are:
PATHSHAPE_RECTANGLE (and PATHSHAPE_SQUARE) PATHSHAPE_CIRCLE

It does this by adding a clickable area into the imagemap list.

See also:
RenderRegion::DrawPath

Implements RenderRegion.

Definition at line 264 of file filtirr.cpp.

00265 {
00266     //First check our path parameter
00267     if (ppthRender==NULL)
00268     {
00269         ERROR2RAW("ImagemapRenderRegion::DrawPathToOutputDevice not given a path!");
00270         return;
00271     }
00272 
00273     //Now get the current WebAddressAttribute
00274     WebAddressAttribute* pwaaCurrent=(WebAddressAttribute*) GetCurrentAttribute(ATTR_WEBADDRESS);
00275 
00276     if (pwaaCurrent==NULL)
00277     {
00278         ERROR2RAW("ImagemapRenderRegion::DrawPathToOutputDevice - no current WebAddressAttribute!");
00279         return;
00280     }
00281 
00282     
00283     //IF the current WebAddressAttribute has a URL
00284     if (pwaaCurrent->HasURL())
00285     {
00286         //Then we want to add a clickable area into the imagemap
00287 
00288         //Now, if EITHER the user has specified that this clickable area is a rectangle
00289         //OR the user has specified all clickable areas should be rectangles
00290         //OR this path is a rectangle shape
00291         if (m_Options.m_fAllRectangles 
00292             || pwaaCurrent->UseBoundingRectangle()
00293             || shapePath==PATHSHAPE_RECTANGLE
00294             || shapePath==PATHSHAPE_SQUARE)
00295         {
00296             //Then we want to add a clickable area into the imagemap
00297             
00298             //So get the rectangle to add
00299             DocRect rectToAdd=pwaaCurrent->GetClickableRectangleInRendering();
00300 
00301             //And add it
00302             AddRectangleToImagemap(rectToAdd, pwaaCurrent);
00303 
00304         }
00305         else
00306         {
00307             //It's not a rectangle
00308 
00309             //So, what shape is the path?
00310             if (shapePath==PATHSHAPE_CIRCLE)
00311                 //Circular. So add a circle to the imagemap
00312                 AddCircleToImagemap(ppthRender, pwaaCurrent);
00313             else
00314                 //Otherwise, add a polygon to the imagemap
00315                 AddPathToImagemap(ppthRender, pwaaCurrent);
00316 
00317         }//End if/else rectangle
00318 
00319     } //ENd if/else has URL
00320 
00321 }

void ImagemapRenderRegion::DrawPixel const DocCoord Point  )  [virtual]
 

Should not be called for this kind of render region.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
Errors: ENSURE failure if called.
See also:
RenderRegion::DrawPixel

Implements RenderRegion.

Definition at line 203 of file filtirr.cpp.

00204 {
00205     ENSURE(FALSE, "DrawPixel called while exporting!");
00206 }

void ImagemapRenderRegion::DrawRect DocRect RectToRender  )  [virtual]
 

Does nothing.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
/08/96 Input: RectToRender - The rectangle to render

Implements RenderRegion.

Definition at line 337 of file filtirr.cpp.

00338 {
00339     ENSURE(FALSE, "ImagemapRenderRegion::DrawRect called - this should not happen!");
00340 }

void ImagemapRenderRegion::GetRenderRegionCaps RRCaps pCaps  )  [virtual]
 

This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Parameters:
pCaps - The details about what types of thing this render region can render [OUTPUTS]

Reimplemented from RenderRegion.

Definition at line 410 of file filtirr.cpp.

00411 {
00412     //This seems to be what all the other overrides do, so I guess
00413     //I'll do the same
00414     pCaps->CanDoNothing();
00415 
00416 }

BOOL ImagemapRenderRegion::Init void   ) 
 

Initialise the render region.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/05/94
Returns:
TRUE if initialised ok; FALSE if not.

Reimplemented from RenderRegion.

void ImagemapRenderRegion::InitAttributes void   )  [inline, protected, virtual]
 

Implements RenderRegion.

Definition at line 176 of file filtirr.h.

00176 {}

void ImagemapRenderRegion::InitClipping void   )  [inline, protected, virtual]
 

Implements RenderRegion.

Definition at line 175 of file filtirr.h.

00175 {}

BOOL ImagemapRenderRegion::IsEmpty  )  [inline]
 

Definition at line 168 of file filtirr.h.

00169     {
00170         return m_Imagemap.IsEmpty();
00171     }

void ImagemapRenderRegion::SetOSDrawingMode void   )  [inline, protected, virtual]
 

Implements RenderRegion.

Definition at line 177 of file filtirr.h.

00177 {}

void ImagemapRenderRegion::SetQualityLevel void   )  [inline, protected, virtual]
 

Does nothing.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/8/97
Parameters:
- [INPUTS]
This used to be a pure function until we found a way of making the base class get called (due to the introduction of the path processing code)

See also:
RenderRegion::SetQuality

Reimplemented from RenderRegion.

Definition at line 178 of file filtirr.h.

00178 {}

BOOL ImagemapRenderRegion::StopRender void   )  [inline, virtual]
 

Implements RenderRegion.

Definition at line 145 of file filtirr.h.

00145 {return TRUE;}

BOOL ImagemapRenderRegion::WantsGrids  )  [virtual]
 

very little

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/97
Returns:
FALSE

Reimplemented from RenderRegion.

Definition at line 432 of file filtirr.cpp.

00433 {
00434     return FALSE;
00435 }

INT32 ImagemapRenderRegion::Write CCLexFile pfileToWrite = NULL,
TCHAR pcBuffer = NULL
 

Writes the imagemap HTML, either to the file or the text buffer or both:.

> INT32 ImagemapRenderRegion::Write(CCLexFile* pfileToWrite=NULL, TCHAR* pcBuffer=NULL)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Parameters:
pfileToWrite - The file to write to [INPUTS] pcBuffer - Pointer to a text buffer to write to
Either of the above may be NULL.

Returns:
The number of TCHARs written.
<MAP> <AREA shape="RECTANGLE...>"> <AREA shape="RECTANGLE...>"> </MAP>

Definition at line 461 of file filtirr.cpp.

00462 {
00463     return m_Imagemap.Write(pfileToWrite, pcBuffer);
00464         
00465 }


Member Data Documentation

Imagemap ImagemapRenderRegion::m_Imagemap [protected]
 

Definition at line 195 of file filtirr.h.

ImagemapFilterOptions ImagemapRenderRegion::m_Options [protected]
 

Definition at line 192 of file filtirr.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:55:24 2007 for Camelot by  doxygen 1.4.4