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 (const Graphic &rGraphic)
 
 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, const GraphicObject *pCopyObj=nullptr)
 
void SetGraphic (const Graphic &rGraphic, const OUString &rLink)
 
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 *pOut, const Point &rPt, const Size &rSz, const GraphicAttr *pAttr=nullptr)
 
void DrawTiled (OutputDevice *pOut, 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 *pOut, const Point &rPt, const Size &rSz, long nExtraData=0, OutputDevice *pFirstFrameOutDev=nullptr)
 
void StopAnimation (OutputDevice *pOut=nullptr, 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 (OUString const &rURL)
 

Private Member Functions

bool VCL_DLLPRIVATE ImplGetCropParams (OutputDevice const *pOut, 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 *pOut, 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)
 
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 144 of file GraphicObject.hxx.

Constructor & Destructor Documentation

GraphicObject::GraphicObject ( )

Definition at line 300 of file GraphicObject.cxx.

Referenced by ImplRenderTileRecursive().

GraphicObject::GraphicObject ( const Graphic rGraphic)

Definition at line 304 of file GraphicObject.cxx.

GraphicObject::GraphicObject ( const GraphicObject rCacheObj)

Definition at line 309 of file GraphicObject.cxx.

GraphicObject::~GraphicObject ( )

Definition at line 316 of file GraphicObject.cxx.

Member Function Documentation

basegfx::B2DVector GraphicObject::calculateCropScaling ( double  fWidth,
double  fHeight,
double  fLeftCrop,
double  fTopCrop,
double  fRightCrop,
double  fBottomCrop 
) const
bool GraphicObject::Draw ( OutputDevice pOut,
const Point rPt,
const Size rSz,
const GraphicAttr pAttr = nullptr 
)
void GraphicObject::DrawTiled ( OutputDevice pOut,
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 526 of file GraphicObject.cxx.

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

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

Definition at line 298 of file GraphicObject.hxx.

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

const Graphic & GraphicObject::GetGraphic ( ) const

Definition at line 606 of file GraphicObject.cxx.

References maGraphic.

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

MapMode GraphicObject::GetPrefMapMode ( ) const

Definition at line 330 of file GraphicObject.cxx.

References Graphic::GetPrefMapMode(), and maGraphic.

Referenced by calculateCropScaling().

Size GraphicObject::GetPrefSize ( ) const

Definition at line 325 of file GraphicObject.cxx.

References Graphic::GetPrefSize(), and maGraphic.

Referenced by calculateCropScaling().

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 621 of file GraphicObject.cxx.

References Size::AdjustWidth(), Bitmap, eType, basegfx::fround(), GdiMetafile, Graphic::GetAnimation(), Graphic::GetBitmapEx(), GraphicAttr::GetBottomCrop(), Application::GetDefaultDevice(), Graphic::GetGDIMetaFile(), GetGraphic(), GraphicAttr::GetLeftCrop(), Graphic::GetPrefMapMode(), Graphic::GetPrefSize(), GraphicAttr::GetRightCrop(), GraphicAttr::GetTopCrop(), GetTransformedGraphic(), GetType(), Size::Height(), ImplTransformBitmap(), Graphic::IsAnimated(), GraphicAttr::IsCropped(), OutputDevice::LogicToLogic(), OutputDevice::LogicToPixel(), AnimationBitmap::maPositionPixel, tools::Rectangle::Move(), Size::setHeight(), Graphic::SetPrefMapMode(), Graphic::SetPrefSize(), Size::setWidth(), and Size::Width().

Referenced by GetTransformedGraphic(), and StartAnimation().

Graphic GraphicObject::GetTransformedGraphic ( const GraphicAttr pAttr) const
GraphicType GraphicObject::GetType ( ) const

Definition at line 320 of file GraphicObject.cxx.

References Graphic::GetType(), and maGraphic.

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

OString GraphicObject::GetUniqueID ( ) const

Definition at line 438 of file GraphicObject.cxx.

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

const OUString& GraphicObject::GetUserData ( ) const
inline

Definition at line 303 of file GraphicObject.hxx.

bool GraphicObject::HasUserData ( ) const
inline

Definition at line 300 of file GraphicObject.hxx.

bool GraphicObject::ImplDrawTiled ( OutputDevice pOut,
const tools::Rectangle rArea,
const Size rSizePixel,
const Size rOffset,
const GraphicAttr pAttr,
int  nTileCacheSize1D 
)
private
bool GraphicObject::ImplDrawTiled ( OutputDevice rOut,
const Point rPos,
int  nNumTilesX,
int  nNumTilesY,
const Size rTileSize,
const GraphicAttr pAttr 
)
private
bool GraphicObject::ImplGetCropParams ( OutputDevice const *  pOut,
Point rPt,
Size rSz,
const GraphicAttr pAttr,
tools::PolyPolygon rClipPolyPoly,
bool &  bRectClipRegion 
) const
private
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().

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
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
bool GraphicObject::IsAnimated ( ) const

Definition at line 340 of file GraphicObject.cxx.

References Graphic::IsAnimated(), and maGraphic.

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

bool GraphicObject::IsEPS ( ) const

Definition at line 345 of file GraphicObject.cxx.

References Graphic::IsEPS(), and maGraphic.

bool GraphicObject::isGraphicObjectUniqueIdURL ( OUString const &  rURL)
static

Definition at line 898 of file GraphicObject.cxx.

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

bool GraphicObject::IsTransparent ( ) const

Definition at line 335 of file GraphicObject.cxx.

References Graphic::IsTransparent(), and maGraphic.

Referenced by ImplDrawTiled().

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

Definition at line 259 of file GraphicObject.hxx.

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

Definition at line 419 of file GraphicObject.cxx.

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

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

Definition at line 432 of file GraphicObject.cxx.

References maAttr, and maGraphic.

void GraphicObject::SetAttr ( const GraphicAttr rAttr)

Definition at line 443 of file GraphicObject.cxx.

References maAttr, and mxSimpleCache.

void GraphicObject::SetGraphic ( const Graphic rGraphic,
const GraphicObject pCopyObj = nullptr 
)

Definition at line 611 of file GraphicObject.cxx.

References maGraphic.

Referenced by ImplDrawTiled(), and SetGraphic().

void GraphicObject::SetGraphic ( const Graphic rGraphic,
const OUString &  rLink 
)

Definition at line 616 of file GraphicObject.cxx.

References SetGraphic().

void GraphicObject::SetUserData ( )

Definition at line 451 of file GraphicObject.cxx.

References maUserData.

void GraphicObject::SetUserData ( const OUString &  rUserData)

Definition at line 456 of file GraphicObject.cxx.

References maUserData.

bool GraphicObject::StartAnimation ( OutputDevice pOut,
const Point rPt,
const Size rSz,
long  nExtraData = 0,
OutputDevice pFirstFrameOutDev = nullptr 
)
void GraphicObject::StopAnimation ( OutputDevice pOut = nullptr,
long  nExtraData = 0 
)

Definition at line 600 of file GraphicObject.cxx.

References mxSimpleCache.

Friends And Related Function Documentation

friend class SdrGrafObj
friend

Definition at line 146 of file GraphicObject.hxx.

Member Data Documentation

GraphicAttr GraphicObject::maAttr
private

Definition at line 150 of file GraphicObject.hxx.

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

Graphic GraphicObject::maGraphic
private
OUString GraphicObject::maUserData
private

Definition at line 151 of file GraphicObject.hxx.

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

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

Definition at line 152 of file GraphicObject.hxx.

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


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