#include "stdafx.h" #include "SigmaView.h" #include "ItemCopyAsImagePolygon.h" #include "Util.h" static CItemCopyAsImagePolygon * getItemItemCopyAsImagePolygon(CSigmaView * pView) { if (pView == nullptr) { return nullptr; } CItem * pItem = pView->GetItem(); if (pItem == nullptr) return nullptr; CItemCopyAsImagePolygon * ciItem = dynamic_cast(pItem); return ciItem; } extern "C" __declspec(dllexport) bool CopyAsImagePolygon_CopyRectToClipboard(CSigmaView * pView, double scaleFactor) { CItemCopyAsImagePolygon * pItem = getItemItemCopyAsImagePolygon(pView); if (pItem == NULL) return false; return pItem->CopyRectToClipboard(scaleFactor); } extern "C" __declspec(dllexport) void CopyAsImagePolygon_SetSelectedPolygon(CSigmaView * pView, POSITION pos) { CItemCopyAsImagePolygon * pItem = getItemItemCopyAsImagePolygon(pView); if (pItem == NULL) return; COne *pOne = pItem->GetDoc()->GetDraw()->GetAt(pos); if (pOne == nullptr) { return; } if (pOne->GetType() != DOUBLEFOX_CURVE) { return; } CCurveEx* pCurve = (CCurveEx*)pOne->value; if (!IsPolygon(pCurve)) { return; } pItem->SetPolygon(pCurve); } extern "C" __declspec(dllexport) bool CopyAsImagePolygon_CopyPolygonToClipboard(CSigmaView * pView, double scaleFactor) { if (pView == NULL) return false; CItemCopyAsImageEx* pItem = getItemItemCopyAsImagePolygon(pView); if (pItem == NULL) return false; return pItem->CopyRectToClipboard(scaleFactor); }