void ImagemapRenderRegion::AddPathToImagemap(Path* ppthToAdd, WebAddressAttribute* pwaaCurrent) { //First get the origin of the export area and the DPI DocCoord dcOrigin=ImagemapFilterOptions::GetOriginOfExportArea(m_Options.m_stExportArea); double dDPI=m_Options.m_dDPI; //Now, how many subpaths are there in this path? INT32 lNumSubpaths=ppthToAdd->GetNumSubpaths(); //For each subpath in the path for (INT32 l=0; l<lNumSubpaths; l++) { //Create a new path Path pthSubpath; pthSubpath.Initialise(ppthToAdd->GetNumCoords()); //And copy the next subpath into it ppthToAdd->MakePathFromSubPath(l, &pthSubpath); //Now, if that subpath is closed if (pthSubpath.IsSubPathClosed(0)) { //Then we want to add it to the imagemap //So scale it to dDPI and by dcOrigin pthSubpath.Scale(dcOrigin, dDPI); //Now we need to flatten it. //This means creating a new path, because otherwise Path::Flatten //goes wrong Path pthFlattened; pthFlattened.Initialise(pthSubpath.GetNumCoords()); //So, if we should flatten the path if (m_Options.m_ffApprox!=FF_NOTATALL) //Then do it pthSubpath.Flatten(m_Options.m_ffApprox, &pthFlattened); else //Otherwise, simply copy the path across pthFlattened.CopyPathDataFrom(&pthSubpath); //Then add the flattened path to the imagemap m_Imagemap.AddPolygon(&pthFlattened, pwaaCurrent->m_url.GetWebAddress(), pwaaCurrent->m_pcFrame); } } }
void ImagemapRenderRegion::AddCircleToImagemap(Path* ppthToScale, WebAddressAttribute* pwaaCurrent) { //First get the origin of the export area and the DPI DocCoord dcOrigin=ImagemapFilterOptions::GetOriginOfExportArea(m_Options.m_stExportArea); double dDPI=m_Options.m_dDPI; //Now make a copy of the path Path pthToAdd; pthToAdd.Initialise(ppthToScale->GetNumCoords()); pthToAdd.CopyPathDataFrom(ppthToScale); //Scale it pthToAdd.Scale(dcOrigin, dDPI); //And add it to the imagemap m_Imagemap.AddCircle(&pthToAdd, pwaaCurrent->m_url.GetWebAddress(), pwaaCurrent->m_pcFrame); }