//----------------------------------------------------------------------------- bool CFrame::setZoom (double zoomFactor) { if (zoomFactor == 0.) return false; bool result = true; CGraphicsTransform currentTransform = getTransform (); CCoord origWidth = getWidth () / currentTransform.m11; CCoord origHeight = getHeight () / currentTransform.m22; CCoord newWidth = origWidth * zoomFactor; CCoord newHeight = origHeight * zoomFactor; setAutosizingEnabled (false); setTransform (CGraphicsTransform ().scale (zoomFactor, zoomFactor)); if (!setSize (newWidth, newHeight)) { setTransform (currentTransform); setSize (origWidth * currentTransform.m11, origHeight * currentTransform.m22); result = false; } invalid (); setAutosizingEnabled (true); return result; }
//----------------------------------------------------------------------------- CDrawContext::CDrawContext (const CRect& surfaceRect) : drawStringHelper (0) , surfaceRect (surfaceRect) { transformStack.push (CGraphicsTransform ()); }