LibreOffice Module vcl (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
GraphicObject Class Reference

#include <GraphicObject.hxx>

Collaboration diagram for GraphicObject:
[legend]

Public Member Functions

 GraphicObject ()
 
 GraphicObject (Graphic aGraphic)
 
 GraphicObject (const GraphicObject &rCacheObj)
 
 ~GraphicObject ()
 
GraphicObjectoperator= (const GraphicObject &rCacheObj)
 
bool operator== (const GraphicObject &rCacheObj) const
 
bool operator!= (const GraphicObject &rCacheObj) const
 
const GraphicGetGraphic () const
 
void SetGraphic (const Graphic &rGraphic)
 
Graphic GetTransformedGraphic (const Size &rDestSize, const MapMode &rDestMap, const GraphicAttr &rAttr) const
 Get graphic transformed according to given attributes. More...
 
Graphic GetTransformedGraphic (const GraphicAttr *pAttr) const
 
void SetAttr (const GraphicAttr &rAttr)
 
const GraphicAttrGetAttr () const
 
bool HasUserData () const
 
void SetUserData ()
 
void SetUserData (const OUString &rUserData)
 
const OUString & GetUserData () const
 
OString GetUniqueID () const
 
GraphicType GetType () const
 
Size GetPrefSize () const
 
MapMode GetPrefMapMode () const
 
bool IsTransparent () const
 
bool IsAnimated () const
 
bool IsEPS () const
 
bool Draw (OutputDevice &rOut, const Point &rPt, const Size &rSz, const GraphicAttr *pAttr=nullptr) const
 
void DrawTiled (OutputDevice &rOut, const tools::Rectangle &rArea, const Size &rSize, const Size &rOffset, int nTileCacheSize1D=128)
 Draw the graphic repeatedly into the given output rectangle. More...
 
bool StartAnimation (OutputDevice &rOut, const Point &rPt, const Size &rSz, tools::Long nExtraData=0, OutputDevice *pFirstFrameOutDev=nullptr)
 
void StopAnimation (const OutputDevice *pOut=nullptr, tools::Long nExtraData=0)
 
basegfx::B2DVector calculateCropScaling (double fWidth, double fHeight, double fLeftCrop, double fTopCrop, double fRightCrop, double fBottomCrop) const
 

Static Public Member Functions

static bool isGraphicObjectUniqueIdURL (std::u16string_view rURL)
 

Private Member Functions

bool VCL_DLLPRIVATE ImplGetCropParams (const OutputDevice &rOut, Point &rPt, Size &rSz, const GraphicAttr *pAttr, tools::PolyPolygon &rClipPolyPoly, bool &bRectClipRegion) const
 
bool VCL_DLLPRIVATE ImplRenderTempTile (VirtualDevice &rVDev, int nNumTilesX, int nNumTilesY, const Size &rTileSizePixel, const GraphicAttr *pAttr)
 Render a given number of tiles in an optimized way. More...
 
bool VCL_DLLPRIVATE ImplRenderTileRecursive (VirtualDevice &rVDev, int nExponent, int nMSBFactor, int nNumOrigTilesX, int nNumOrigTilesY, int nRemainderTilesX, int nRemainderTilesY, const Size &rTileSizePixel, const GraphicAttr *pAttr, ImplTileInfo &rTileInfo)
 internally called by ImplRenderTempTile() More...
 
bool VCL_DLLPRIVATE ImplDrawTiled (OutputDevice &rOut, const tools::Rectangle &rArea, const Size &rSizePixel, const Size &rOffset, const GraphicAttr *pAttr, int nTileCacheSize1D)
 
bool VCL_DLLPRIVATE ImplDrawTiled (OutputDevice &rOut, const Point &rPos, int nNumTilesX, int nNumTilesY, const Size &rTileSize, const GraphicAttr *pAttr) const
 
void VCL_DLLPRIVATE ImplTransformBitmap (BitmapEx &rBmpEx, const GraphicAttr &rAttr, const Size &rCropLeftTop, const Size &rCropRightBottom, const tools::Rectangle &rCropRect, const Size &rDstSize, bool bEnlarge) const
 

Private Attributes

Graphic maGraphic
 
GraphicAttr maAttr
 
OUString maUserData
 
std::unique_ptr< GrfSimpleCacheObjmxSimpleCache
 

Friends

class SdrGrafObj
 

Detailed Description

Definition at line 52 of file GraphicObject.hxx.

Constructor & Destructor Documentation

◆ GraphicObject() [1/3]

GraphicObject::GraphicObject ( )

Definition at line 300 of file GraphicObject.cxx.

Referenced by ImplRenderTileRecursive().

◆ GraphicObject() [2/3]

GraphicObject::GraphicObject ( Graphic  aGraphic)

Definition at line 304 of file GraphicObject.cxx.

References maGraphic.

◆ GraphicObject() [3/3]

GraphicObject::GraphicObject ( const GraphicObject rCacheObj)

Definition at line 309 of file GraphicObject.cxx.

References maGraphic, and maUserData.

◆ ~GraphicObject()

GraphicObject::~GraphicObject ( )

Definition at line 316 of file GraphicObject.cxx.

Member Function Documentation

◆ calculateCropScaling()

basegfx::B2DVector GraphicObject::calculateCropScaling ( double  fWidth,
double  fHeight,
double  fLeftCrop,
double  fTopCrop,
double  fRightCrop,
double  fBottomCrop 
) const

◆ Draw()

bool GraphicObject::Draw ( OutputDevice rOut,
const Point rPt,
const Size rSz,
const GraphicAttr pAttr = nullptr 
) const

◆ DrawTiled()

void GraphicObject::DrawTiled ( OutputDevice rOut,
const tools::Rectangle rArea,
const Size rSize,
const Size rOffset,
int  nTileCacheSize1D = 128 
)

Draw the graphic repeatedly into the given output rectangle.

Parameters
pOutOutputDevice where the rendering should take place
rAreaThe output area that is filled with tiled instances of this graphic
rSizeThe actual size of a single tile
rOffsetOffset from the left, top position of rArea, where to start the tiling. The upper left corner of the graphic tilings will virtually start at this position. Concretely, only that many tiles are drawn to completely fill the given output area.
nFlagsOptional rendering flags
nTileCacheSize1DOptional dimension of the generated cache tiles. The pOut sees a number of tile draws, which have approximately nTileCacheSize1D times nTileCacheSize1D bitmap sizes if the tile bitmap is smaller. Otherwise, the tile is drawn as is. This is useful if e.g. you want only a few, very large bitmap drawings appear on the outdev.

Definition at line 523 of file GraphicObject.cxx.

References OutputDevice::GetMapMode(), Size::Height(), ImplDrawTiled(), Size::IsEmpty(), OutputDevice::LogicToPixel(), SAL_MAX_UINT16, and Size::Width().

◆ GetAttr()

const GraphicAttr & GraphicObject::GetAttr ( void  ) const
inline

Definition at line 205 of file GraphicObject.hxx.

Referenced by Draw(), GetTransformedGraphic(), and StartAnimation().

◆ GetGraphic()

const Graphic & GraphicObject::GetGraphic ( ) const

Definition at line 602 of file GraphicObject.cxx.

References maGraphic.

Referenced by GetTransformedGraphic(), GetUniqueID(), ImplDrawTiled(), operator=(), and StartAnimation().

◆ GetPrefMapMode()

MapMode GraphicObject::GetPrefMapMode ( ) const

Definition at line 330 of file GraphicObject.cxx.

References Graphic::GetPrefMapMode(), and maGraphic.

Referenced by calculateCropScaling().

◆ GetPrefSize()

Size GraphicObject::GetPrefSize ( ) const

Definition at line 325 of file GraphicObject.cxx.

References Graphic::GetPrefSize(), and maGraphic.

Referenced by calculateCropScaling().

◆ GetTransformedGraphic() [1/2]

Graphic GraphicObject::GetTransformedGraphic ( const GraphicAttr pAttr) const

◆ GetTransformedGraphic() [2/2]

Graphic GraphicObject::GetTransformedGraphic ( const Size rDestSize,
const MapMode rDestMap,
const GraphicAttr rAttr 
) const

Get graphic transformed according to given attributes.

This method returns a Graphic transformed, cropped and scaled to the given parameters, ready to be rendered to printer or display. The returned graphic has the same visual appearance as if it had been drawn via GraphicObject::Draw() to a specific output device.

Parameters
rDestSizeDesired output size in logical coordinates. The mapmode to interpret these logical coordinates in is given by the second parameter, rDestMap.
rDestMapMapmode the output should be interpreted in. This is used to interpret rDestSize, to set the appropriate PrefMapMode on the returned Graphic, and to deal correctly with metafile graphics.
rAttrGraphic attributes used to transform the graphic. This includes cropping, rotation, mirroring, and various color adjustment parameters.
Returns
the readily transformed Graphic

Definition at line 612 of file GraphicObject.cxx.

References GDIMetaFile::AddAction(), Size::AdjustHeight(), Size::AdjustWidth(), Bitmap, tools::Rectangle::Contains(), Animation::Count(), eType, basegfx::fround(), GdiMetafile, Animation::Get(), Graphic::GetAnimation(), Graphic::GetBitmapEx(), GraphicAttr::GetBottomCrop(), Application::GetDefaultDevice(), Animation::GetDisplaySizePixel(), Graphic::GetGDIMetaFile(), GetGraphic(), GraphicAttr::GetLeftCrop(), MapMode::GetMapUnit(), MapMode::GetOrigin(), GDIMetaFile::GetPrefMapMode(), Graphic::GetPrefMapMode(), Graphic::GetPrefSize(), GraphicAttr::GetRightCrop(), BitmapEx::GetSizePixel(), GraphicAttr::GetTopCrop(), GetTransformedGraphic(), GetType(), Size::Height(), ImplTransformBitmap(), Graphic::IsAnimated(), GraphicAttr::IsCropped(), OutputDevice::LogicToLogic(), OutputDevice::LogicToPixel(), AnimationFrame::maBitmapEx, AnimationFrame::maPositionPixel, AnimationFrame::maSizePixel, tools::Rectangle::Move(), Animation::Replace(), GDIMetaFile::Scale(), Animation::SetDisplaySizePixel(), Size::setHeight(), MapMode::SetOrigin(), GDIMetaFile::SetPrefMapMode(), Graphic::SetPrefMapMode(), Graphic::SetPrefSize(), GDIMetaFile::SetPrefSize(), Size::setWidth(), Size::Width(), Point::X(), and Point::Y().

Referenced by GetTransformedGraphic(), and StartAnimation().

◆ GetType()

GraphicType GraphicObject::GetType ( ) const

Definition at line 320 of file GraphicObject.cxx.

References Graphic::GetType(), and maGraphic.

Referenced by GetTransformedGraphic(), ImplDrawTiled(), and ImplGetCropParams().

◆ GetUniqueID()

OString GraphicObject::GetUniqueID ( ) const

Definition at line 438 of file GraphicObject.cxx.

References GetGraphic(), and Graphic::getUniqueID().

◆ GetUserData()

const OUString & GraphicObject::GetUserData ( ) const
inline

Definition at line 210 of file GraphicObject.hxx.

References maUserData.

◆ HasUserData()

bool GraphicObject::HasUserData ( ) const
inline

Definition at line 207 of file GraphicObject.hxx.

References maUserData.

◆ ImplDrawTiled() [1/2]

bool GraphicObject::ImplDrawTiled ( OutputDevice rOut,
const Point rPos,
int  nNumTilesX,
int  nNumTilesY,
const Size rTileSize,
const GraphicAttr pAttr 
) const
private

◆ ImplDrawTiled() [2/2]

bool GraphicObject::ImplDrawTiled ( OutputDevice rOut,
const tools::Rectangle rArea,
const Size rSizePixel,
const Size rOffset,
const GraphicAttr pAttr,
int  nTileCacheSize1D 
)
private

◆ ImplGetCropParams()

bool GraphicObject::ImplGetCropParams ( const OutputDevice rOut,
Point rPt,
Size rSz,
const GraphicAttr pAttr,
tools::PolyPolygon rClipPolyPoly,
bool &  bRectClipRegion 
) const
private

◆ ImplRenderTempTile()

bool GraphicObject::ImplRenderTempTile ( VirtualDevice rVDev,
int  nNumTilesX,
int  nNumTilesY,
const Size rTileSizePixel,
const GraphicAttr pAttr 
)
private

Render a given number of tiles in an optimized way.

This method recursively subdivides the tile rendering problem in smaller parts, i.e. rendering output size x with few tiles of size y, which in turn are generated from the original bitmap in a recursive fashion. The subdivision size can be controlled by the exponent argument, which specifies the minimal number of smaller tiles used in one recursion step. The resulting tile size is given as the integer number of repetitions of the original bitmap along x and y. As the exponent need not necessarily divide these numbers without remainder, the repetition counts are effectively converted to base-exponent numbers, where each place denotes the number of times the corresponding tile size is rendered.

Parameters
rVDevVirtual device to render everything into
nNumTilesXNumber of original tiles to generate in x direction
nNumTilesYNumber of original tiles to generate in y direction
rTileSizePixelSize in pixel of the original tile bitmap to render it in
pAttrGraphic attributes to be used for rendering
nFlagsGraphic flags to be used for rendering
rCurrPosCurrent output point for this recursion level (should start with (0,0))
Returns
true, if everything was successfully rendered.

Definition at line 58 of file GraphicObject2.cxx.

References OutputDevice::EnableMapMode(), ImplRenderTileRecursive(), and OutputDevice::IsMapModeEnabled().

Referenced by ImplDrawTiled().

◆ ImplRenderTileRecursive()

bool GraphicObject::ImplRenderTileRecursive ( VirtualDevice rVDev,
int  nExponent,
int  nMSBFactor,
int  nNumOrigTilesX,
int  nNumOrigTilesY,
int  nRemainderTilesX,
int  nRemainderTilesY,
const Size rTileSizePixel,
const GraphicAttr pAttr,
ImplTileInfo rTileInfo 
)
private

◆ ImplTransformBitmap()

void GraphicObject::ImplTransformBitmap ( BitmapEx rBmpEx,
const GraphicAttr rAttr,
const Size rCropLeftTop,
const Size rCropRightBottom,
const tools::Rectangle rCropRect,
const Size rDstSize,
bool  bEnlarge 
) const
private

◆ IsAnimated()

bool GraphicObject::IsAnimated ( ) const

Definition at line 340 of file GraphicObject.cxx.

References Graphic::IsAnimated(), and maGraphic.

Referenced by GetTransformedGraphic(), ImplTransformBitmap(), and StartAnimation().

◆ IsEPS()

bool GraphicObject::IsEPS ( ) const

Definition at line 345 of file GraphicObject.cxx.

References Graphic::IsEPS(), and maGraphic.

◆ isGraphicObjectUniqueIdURL()

bool GraphicObject::isGraphicObjectUniqueIdURL ( std::u16string_view  rURL)
static

Definition at line 889 of file GraphicObject.cxx.

References o3tl::starts_with(), and u.

Referenced by vcl::graphic::SearchForGraphics().

◆ IsTransparent()

bool GraphicObject::IsTransparent ( ) const

Definition at line 335 of file GraphicObject.cxx.

References Graphic::IsTransparent(), and maGraphic.

Referenced by ImplDrawTiled().

◆ operator!=()

bool GraphicObject::operator!= ( const GraphicObject rCacheObj) const
inline

Definition at line 167 of file GraphicObject.hxx.

◆ operator=()

GraphicObject & GraphicObject::operator= ( const GraphicObject rCacheObj)

Definition at line 419 of file GraphicObject.cxx.

References GetGraphic(), maAttr, maGraphic, maUserData, and mxSimpleCache.

◆ operator==()

bool GraphicObject::operator== ( const GraphicObject rCacheObj) const

Definition at line 432 of file GraphicObject.cxx.

References maAttr, and maGraphic.

◆ SetAttr()

void GraphicObject::SetAttr ( const GraphicAttr rAttr)

Definition at line 443 of file GraphicObject.cxx.

References maAttr, and mxSimpleCache.

◆ SetGraphic()

void GraphicObject::SetGraphic ( const Graphic rGraphic)

Definition at line 607 of file GraphicObject.cxx.

References maGraphic.

Referenced by ImplDrawTiled().

◆ SetUserData() [1/2]

void GraphicObject::SetUserData ( )

Definition at line 451 of file GraphicObject.cxx.

References maUserData.

◆ SetUserData() [2/2]

void GraphicObject::SetUserData ( const OUString &  rUserData)

Definition at line 456 of file GraphicObject.cxx.

References maUserData.

◆ StartAnimation()

bool GraphicObject::StartAnimation ( OutputDevice rOut,
const Point rPt,
const Size rSz,
tools::Long  nExtraData = 0,
OutputDevice pFirstFrameOutDev = nullptr 
)

◆ StopAnimation()

void GraphicObject::StopAnimation ( const OutputDevice pOut = nullptr,
tools::Long  nExtraData = 0 
)

Definition at line 596 of file GraphicObject.cxx.

References mxSimpleCache, and pOut.

Friends And Related Function Documentation

◆ SdrGrafObj

friend class SdrGrafObj
friend

Definition at line 54 of file GraphicObject.hxx.

Member Data Documentation

◆ maAttr

GraphicAttr GraphicObject::maAttr
private

Definition at line 58 of file GraphicObject.hxx.

Referenced by operator=(), operator==(), and SetAttr().

◆ maGraphic

Graphic GraphicObject::maGraphic
private

◆ maUserData

OUString GraphicObject::maUserData
private

Definition at line 59 of file GraphicObject.hxx.

Referenced by operator=(), and SetUserData().

◆ mxSimpleCache

std::unique_ptr<GrfSimpleCacheObj> GraphicObject::mxSimpleCache
private

Definition at line 60 of file GraphicObject.hxx.

Referenced by operator=(), SetAttr(), StartAnimation(), and StopAnimation().


The documentation for this class was generated from the following files: