LibreOffice Module cppcanvas (master) 1
Classes | Functions
cppcanvas::tools Namespace Reference

Classes

struct  TextLineInfo
 

Functions

css::uno::Sequence< double > intSRGBAToDoubleSequence (IntSRGBA)
 
IntSRGBA doubleSequenceToIntSRGBA (const css::uno::Sequence< double > &rColor)
 
void initRenderState (rendering::RenderState &renderState, const ::cppcanvas::internal::OutDevState &outdevState)
 
::Size getBaselineOffset (const ::cppcanvas::internal::OutDevState &outdevState, const VirtualDevice &rVDev)
 Calc output offset relative to baseline. More...
 
::basegfx::B2DHomMatrixcalcLogic2PixelLinearTransform (::basegfx::B2DHomMatrix &o_rMatrix, const VirtualDevice &rVDev)
 Construct a matrix that converts from logical to pixel coordinate system. More...
 
::basegfx::B2DHomMatrixcalcLogic2PixelAffineTransform (::basegfx::B2DHomMatrix &o_rMatrix, const VirtualDevice &rVDev)
 Construct a matrix that converts from logical to pixel coordinate system. More...
 
bool modifyClip (rendering::RenderState &o_rRenderState, const struct ::cppcanvas::internal::OutDevState &rOutdevState, const CanvasSharedPtr &rCanvas, const ::basegfx::B2DPoint &rOffset, const ::basegfx::B2DVector *pScaling, const double *pRotation)
 
TextLineInfo createTextLineInfo (const ::VirtualDevice &rVDev, const ::cppcanvas::internal::OutDevState &rState)
 Generate text underline/strikeout info struct from OutDev state. More...
 
::basegfx::B2DPolyPolygon createTextLinesPolyPolygon (const ::basegfx::B2DPoint &rStartPos, const double &rLineWidth, const TextLineInfo &rTextLineInfo)
 
::basegfx::B2DRange calcDevicePixelBounds (const ::basegfx::B2DRange &rBounds, const rendering::ViewState &viewState, const rendering::RenderState &renderState)
 
::basegfx::B2DPolyPolygon createTextLinesPolyPolygon (const double &rStartOffset, const double &rLineWidth, const TextLineInfo &rTextLineInfo)
 Create a poly-polygon representing the given combination of overline, strikeout and underline. More...
 
void createTextLinesPolyPolygon (const double &rStartOffset, const double &rLineWidth, const TextLineInfo &rTextLineInfo, ::basegfx::B2DPolyPolygon &rOverlinePolyPoly, ::basegfx::B2DPolyPolygon &rUnderlinePolyPoly, ::basegfx::B2DPolyPolygon &rStrikeoutPolyPoly)
 
void initRenderState (css::rendering::RenderState &renderState, const ::cppcanvas::internal::OutDevState &outdevState)
 Init render state from OutDevState. More...
 
bool modifyClip (css::rendering::RenderState &o_rRenderState, const struct ::cppcanvas::internal::OutDevState &rOutdevState, const CanvasSharedPtr &rCanvas, const ::basegfx::B2DPoint &rOffset, const ::basegfx::B2DVector *pScaling, const double *pRotation)
 This method modifies the clip, to cancel the given transformation. More...
 
::basegfx::B2DRange calcDevicePixelBounds (const ::basegfx::B2DRange &rBounds, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 Transform given bounds to device coordinate system. More...
 
IntSRGBA doubleSequenceToIntSRGBA (const uno::Sequence< double > &rColor)
 

Function Documentation

◆ calcDevicePixelBounds() [1/2]

::basegfx::B2DRange cppcanvas::tools::calcDevicePixelBounds ( const ::basegfx::B2DRange rBounds,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

Transform given bounds to device coordinate system.

◆ calcDevicePixelBounds() [2/2]

::basegfx::B2DRange cppcanvas::tools::calcDevicePixelBounds ( const ::basegfx::B2DRange rBounds,
const rendering::ViewState viewState,
const rendering::RenderState &  renderState 
)

Definition at line 628 of file mtftools.cxx.

◆ calcLogic2PixelAffineTransform()

basegfx::B2DHomMatrix & cppcanvas::tools::calcLogic2PixelAffineTransform ( ::basegfx::B2DHomMatrix o_rMatrix,
const VirtualDevice rVDev 
)

Construct a matrix that converts from logical to pixel coordinate system.

This method calculates a matrix that approximates the VirtualDevice's LogicToPixel conversion.

Parameters
o_rMatrixThis matrix will receive the calculated transform, and is also returned from this method.
Returns
the calculated transformation matrix.

Definition at line 95 of file mtftools.cxx.

References calcLogic2PixelLinearTransform(), OutputDevice::LogicToPixel(), and basegfx::B2DHomMatrix::translate().

Referenced by cppcanvas::internal::ImplRenderer::createActions(), and cppcanvas::internal::ImplRenderer::ImplRenderer().

◆ calcLogic2PixelLinearTransform()

basegfx::B2DHomMatrix & cppcanvas::tools::calcLogic2PixelLinearTransform ( ::basegfx::B2DHomMatrix o_rMatrix,
const VirtualDevice rVDev 
)

Construct a matrix that converts from logical to pixel coordinate system.

This method calculates a matrix that approximates the VirtualDevice's LogicToPixel conversion (disregarding any offset components, thus the 'linear' in the method name - the returned matrix is guaranteed to be linear).

Parameters
o_rMatrixThis matrix will receive the calculated transform, and is also returned from this method.
Returns
the calculated transformation matrix.

Definition at line 77 of file mtftools.cxx.

References basegfx::utils::createScaleB2DHomMatrix(), and OutputDevice::LogicToPixel().

Referenced by calcLogic2PixelAffineTransform(), and cppcanvas::internal::ImplRenderer::createActions().

◆ createTextLineInfo()

TextLineInfo cppcanvas::tools::createTextLineInfo ( const ::VirtualDevice rVDev,
const ::cppcanvas::internal::OutDevState rState 
)

Generate text underline/strikeout info struct from OutDev state.

Definition at line 218 of file mtftools.cxx.

References OutputDevice::GetFontMetric().

Referenced by cppcanvas::internal::ImplRenderer::createActions().

◆ createTextLinesPolyPolygon() [1/3]

basegfx::B2DPolyPolygon cppcanvas::tools::createTextLinesPolyPolygon ( const ::basegfx::B2DPoint rStartPos,
const double &  rLineWidth,
const TextLineInfo rTextLineInfo 
)

◆ createTextLinesPolyPolygon() [2/3]

basegfx::B2DPolyPolygon cppcanvas::tools::createTextLinesPolyPolygon ( const double &  rStartOffset,
const double &  rLineWidth,
const TextLineInfo rTextLineInfo 
)

Create a poly-polygon representing the given combination of overline, strikeout and underline.

Parameters
rStartOffsetOffset in X direction, where the underline starts
rLineWidthWidth of the line of text to overline/strikeout/underline
rTextLineInfoCommon info needed for overline/strikeout/underline generation

Definition at line 645 of file mtftools.cxx.

References createTextLinesPolyPolygon().

◆ createTextLinesPolyPolygon() [3/3]

void cppcanvas::tools::createTextLinesPolyPolygon ( const double &  rStartOffset,
const double &  rLineWidth,
const TextLineInfo rTextLineInfo,
::basegfx::B2DPolyPolygon rOverlinePolyPoly,
::basegfx::B2DPolyPolygon rUnderlinePolyPoly,
::basegfx::B2DPolyPolygon rStrikeoutPolyPoly 
)

Definition at line 656 of file mtftools.cxx.

◆ doubleSequenceToIntSRGBA() [1/2]

IntSRGBA cppcanvas::tools::doubleSequenceToIntSRGBA ( const css::uno::Sequence< double > &  rColor)

◆ doubleSequenceToIntSRGBA() [2/2]

IntSRGBA cppcanvas::tools::doubleSequenceToIntSRGBA ( const uno::Sequence< double > &  rColor)

Definition at line 39 of file tools.cxx.

References cppcanvas::makeColor().

◆ getBaselineOffset()

Size cppcanvas::tools::getBaselineOffset ( const ::cppcanvas::internal::OutDevState outdevState,
const VirtualDevice rVDev 
)

Calc output offset relative to baseline.

The XCanvas API always renders text relative to its baseline. This method calculates an offset in logical coordinates, depending on the OutDevState's textReferencePoint and the font currently set, to offset the text from the baseline.

Parameters
outdevStateState to take textReferencePoint from
rVDevVDev to obtain font metrics from.

Definition at line 51 of file mtftools.cxx.

References ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_TOP, and OutputDevice::GetFontMetric().

Referenced by cppcanvas::internal::ImplRenderer::createActions(), and cppcanvas::internal::TextActionFactory::createTextAction().

◆ initRenderState() [1/2]

void cppcanvas::tools::initRenderState ( css::rendering::RenderState &  renderState,
const ::cppcanvas::internal::OutDevState outdevState 
)

Init render state from OutDevState.

This method initializes the given render state object, sets up the transformation and the clip from the OutDevState.

◆ initRenderState() [2/2]

void cppcanvas::tools::initRenderState ( rendering::RenderState &  renderState,
const ::cppcanvas::internal::OutDevState outdevState 
)

◆ intSRGBAToDoubleSequence()

uno::Sequence< double > cppcanvas::tools::intSRGBAToDoubleSequence ( IntSRGBA  aColor)

◆ modifyClip() [1/2]

bool cppcanvas::tools::modifyClip ( css::rendering::RenderState &  o_rRenderState,
const struct ::cppcanvas::internal::OutDevState rOutdevState,
const CanvasSharedPtr rCanvas,
const ::basegfx::B2DPoint rOffset,
const ::basegfx::B2DVector pScaling,
const double *  pRotation 
)

This method modifies the clip, to cancel the given transformation.

As the clip is relative to the render state transformation, offsetting or scaling the render state must modify the clip, to keep it at the same position relative to the primitive at hand

Parameters
o_rRenderStateRender state to change the clip in
rOutdevStateInput state. Is used to retrieve the original clip from
rOffsetThe clip is offsetted by the negative of this value.
pScalingThe clip is inversely scaled by this value (if given)
pRotationThe clip is inversely rotated by this value (if given)
Returns
true, if the clip has changed, false if not

◆ modifyClip() [2/2]

bool cppcanvas::tools::modifyClip ( rendering::RenderState &  o_rRenderState,
const struct ::cppcanvas::internal::OutDevState rOutdevState,
const CanvasSharedPtr rCanvas,
const ::basegfx::B2DPoint rOffset,
const ::basegfx::B2DVector pScaling,
const double *  pRotation 
)