LibreOffice Module vcl (master)
1
|
#include <GraphicObject.hxx>
Public Member Functions | |
GraphicObject () | |
GraphicObject (const Graphic &rGraphic) | |
GraphicObject (const GraphicObject &rCacheObj) | |
~GraphicObject () | |
GraphicObject & | operator= (const GraphicObject &rCacheObj) |
bool | operator== (const GraphicObject &rCacheObj) const |
bool | operator!= (const GraphicObject &rCacheObj) const |
const Graphic & | GetGraphic () 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 GraphicAttr & | GetAttr () 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, 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 (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< GrfSimpleCacheObj > | mxSimpleCache |
Friends | |
class | SdrGrafObj |
Definition at line 51 of file GraphicObject.hxx.
GraphicObject::GraphicObject | ( | ) |
Definition at line 298 of file GraphicObject.cxx.
Referenced by ImplRenderTileRecursive().
GraphicObject::GraphicObject | ( | const Graphic & | rGraphic | ) |
Definition at line 302 of file GraphicObject.cxx.
References maGraphic.
GraphicObject::GraphicObject | ( | const GraphicObject & | rCacheObj | ) |
Definition at line 307 of file GraphicObject.cxx.
References maGraphic, and maUserData.
GraphicObject::~GraphicObject | ( | ) |
Definition at line 314 of file GraphicObject.cxx.
basegfx::B2DVector GraphicObject::calculateCropScaling | ( | double | fWidth, |
double | fHeight, | ||
double | fLeftCrop, | ||
double | fTopCrop, | ||
double | fRightCrop, | ||
double | fBottomCrop | ||
) | const |
Definition at line 894 of file GraphicObject.cxx.
References basegfx::fTools::equalZero(), Application::GetDefaultDevice(), GetMapUnit(), GetPrefMapMode(), GetPrefSize(), Size::Height(), OutputDevice::LogicToLogic(), OutputDevice::PixelToLogic(), and Size::Width().
bool GraphicObject::Draw | ( | OutputDevice * | pOut, |
const Point & | rPt, | ||
const Size & | rSz, | ||
const GraphicAttr * | pAttr = nullptr |
||
) |
Definition at line 459 of file GraphicObject.cxx.
References CLIPREGION, GetAttr(), tools::PolyPolygon::GetBoundRect(), OutputDevice::GetDrawMode(), GraphicAttr::GetMirrorFlags(), Size::Height(), Horizontal, ImplGetCropParams(), OutputDevice::IntersectClipRegion(), GraphicAttr::IsCropped(), Point, OutputDevice::Pop(), OutputDevice::Push(), OutputDevice::SetDrawMode(), Size::setHeight(), GraphicAttr::SetMirrorFlags(), SettingsFill, SettingsGradient, SettingsLine, SettingsText, Size::setWidth(), Vertical, and Size::Width().
Referenced by ImplDrawTiled(), ImplRenderTileRecursive(), and StartAnimation().
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.
pOut | OutputDevice where the rendering should take place |
rArea | The output area that is filled with tiled instances of this graphic |
rSize | The actual size of a single tile |
rOffset | Offset 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. |
nFlags | Optional rendering flags |
nTileCacheSize1D | Optional 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 521 of file GraphicObject.cxx.
References OutputDevice::GetMapMode(), Size::Height(), ImplDrawTiled(), Size::IsEmpty(), OutputDevice::LogicToPixel(), SAL_MAX_UINT16, and Size::Width().
|
inline |
Definition at line 204 of file GraphicObject.hxx.
Referenced by Draw(), GetTransformedGraphic(), and StartAnimation().
const Graphic & GraphicObject::GetGraphic | ( | ) | const |
Definition at line 600 of file GraphicObject.cxx.
References maGraphic.
Referenced by GetTransformedGraphic(), GetUniqueID(), ImplDrawTiled(), operator=(), and StartAnimation().
MapMode GraphicObject::GetPrefMapMode | ( | ) | const |
Definition at line 328 of file GraphicObject.cxx.
References Graphic::GetPrefMapMode(), and maGraphic.
Referenced by calculateCropScaling().
Size GraphicObject::GetPrefSize | ( | ) | const |
Definition at line 323 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.
rDestSize | Desired output size in logical coordinates. The mapmode to interpret these logical coordinates in is given by the second parameter, rDestMap. |
rDestMap | Mapmode 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. |
rAttr | Graphic attributes used to transform the graphic. This includes cropping, rotation, mirroring, and various color adjustment parameters. |
Definition at line 610 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(), Point, Size::setHeight(), Graphic::SetPrefMapMode(), Graphic::SetPrefSize(), Size::setWidth(), and Size::Width().
Referenced by GetTransformedGraphic(), and StartAnimation().
Graphic GraphicObject::GetTransformedGraphic | ( | const GraphicAttr * | pAttr | ) | const |
Definition at line 837 of file GraphicObject.cxx.
References ALL, Bitmap, Graphic::GetAnimation(), Graphic::GetAnimationLoopCount(), GetAttr(), Graphic::GetBitmapEx(), Graphic::GetGDIMetaFile(), GetGraphic(), GetType(), GraphicAttr::IsAdjusted(), IsAnimated(), GraphicAttr::IsMirrored(), GraphicAttr::IsRotated(), GraphicAttr::IsSpecialDrawMode(), Graphic::IsSupportedGraphic(), GraphicAttr::IsTransparent(), maGraphic, and Animation::SetLoopCount().
GraphicType GraphicObject::GetType | ( | ) | const |
Definition at line 318 of file GraphicObject.cxx.
References Graphic::GetType(), and maGraphic.
Referenced by GetTransformedGraphic(), ImplDrawTiled(), and ImplGetCropParams().
OString GraphicObject::GetUniqueID | ( | ) | const |
Definition at line 436 of file GraphicObject.cxx.
References GetGraphic(), and Graphic::getUniqueID().
|
inline |
Definition at line 209 of file GraphicObject.hxx.
|
inline |
Definition at line 206 of file GraphicObject.hxx.
|
private |
Definition at line 275 of file GraphicObject2.cxx.
References Bitmap, CLIPREGION, COL_WHITE, BitmapEx::GetBitmap(), GetGraphic(), OutputDevice::GetMapMode(), BitmapEx::GetSizePixel(), GetType(), Size::Height(), ImplDrawTiled(), ImplRenderTempTile(), OutputDevice::IntersectClipRegion(), Graphic::IsAlpha(), IsTransparent(), tools::Rectangle::Left(), OutputDevice::LogicToPixel(), Point, OutputDevice::Pop(), OutputDevice::Push(), SetGraphic(), tools::Rectangle::Top(), and Size::Width().
Referenced by DrawTiled(), and ImplDrawTiled().
|
private |
Definition at line 380 of file GraphicObject2.cxx.
References Bitmap, Draw(), OutputDevice::EnableMapMode(), OutputDevice::GetConnectMetaFile(), GetType(), Size::Height(), OutputDevice::IsMapModeEnabled(), OutputDevice::PixelToLogic(), Point, and Size::Width().
|
private |
Definition at line 348 of file GraphicObject.cxx.
References FRound(), GraphicAttr::GetBottomCrop(), Application::GetDefaultDevice(), GraphicAttr::GetLeftCrop(), MapMode::GetMapUnit(), GraphicAttr::GetMirrorFlags(), Graphic::GetPrefMapMode(), Graphic::GetPrefSize(), GraphicAttr::GetRightCrop(), GraphicAttr::GetRotation(), GraphicAttr::GetTopCrop(), GetType(), Size::Height(), Horizontal, Size::IsEmpty(), OutputDevice::LogicToLogic(), m, maGraphic, NONE, OutputDevice::PixelToLogic(), Point, tools::Polygon::Rotate(), Size::setHeight(), Size::setWidth(), Vertical, and Size::Width().
Referenced by Draw(), and StartAnimation().
|
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.
rVDev | Virtual device to render everything into |
nNumTilesX | Number of original tiles to generate in x direction |
nNumTilesY | Number of original tiles to generate in y direction |
rTileSizePixel | Size in pixel of the original tile bitmap to render it in |
pAttr | Graphic attributes to be used for rendering |
nFlags | Graphic flags to be used for rendering |
rCurrPos | Current output point for this recursion level (should start with (0,0)) |
Definition at line 58 of file GraphicObject2.cxx.
References OutputDevice::EnableMapMode(), ImplRenderTileRecursive(), and OutputDevice::IsMapModeEnabled().
Referenced by ImplDrawTiled().
|
private |
internally called by ImplRenderTempTile()
Definition at line 101 of file GraphicObject2.cxx.
References ImplTileInfo::aNextTileTopLeft, ImplTileInfo::aTileSizePixel, ImplTileInfo::aTileTopLeft, Draw(), OutputDevice::DrawEllipse(), OutputDevice::DrawRect(), OutputDevice::GetBitmap(), GraphicObject(), Size::Height(), ImplTileInfo::nTilesEmptyX, ImplTileInfo::nTilesEmptyY, Point, OutputDevice::SetFillColor(), OutputDevice::SetLineColor(), and Size::Width().
Referenced by ImplRenderTempTile().
|
private |
Definition at line 428 of file GraphicObject2.cxx.
References ColorAlpha, BitmapEx::CopyPixel(), BitmapEx::Crop(), BitmapEx::Erase(), Bitmap::Erase(), BitmapEx::GetAlpha(), BitmapEx::GetBitmap(), BitmapEx::GetMask(), GraphicAttr::GetRotation(), BitmapEx::GetSizePixel(), Size::Height(), BitmapEx::IsAlpha(), IsAnimated(), GraphicAttr::IsCropped(), BitmapEx::IsTransparent(), Point, BitmapEx::Scale(), and Size::Width().
Referenced by GetTransformedGraphic().
bool GraphicObject::IsAnimated | ( | ) | const |
Definition at line 338 of file GraphicObject.cxx.
References Graphic::IsAnimated(), and maGraphic.
Referenced by GetTransformedGraphic(), ImplTransformBitmap(), and StartAnimation().
bool GraphicObject::IsEPS | ( | ) | const |
Definition at line 343 of file GraphicObject.cxx.
References Graphic::IsEPS(), and maGraphic.
|
static |
Definition at line 887 of file GraphicObject.cxx.
Referenced by vcl::graphic::SearchForGraphics().
bool GraphicObject::IsTransparent | ( | ) | const |
Definition at line 333 of file GraphicObject.cxx.
References Graphic::IsTransparent(), and maGraphic.
Referenced by ImplDrawTiled().
|
inline |
Definition at line 166 of file GraphicObject.hxx.
GraphicObject & GraphicObject::operator= | ( | const GraphicObject & | rCacheObj | ) |
Definition at line 417 of file GraphicObject.cxx.
References GetGraphic(), maAttr, maGraphic, maUserData, and mxSimpleCache.
bool GraphicObject::operator== | ( | const GraphicObject & | rCacheObj | ) | const |
Definition at line 430 of file GraphicObject.cxx.
void GraphicObject::SetAttr | ( | const GraphicAttr & | rAttr | ) |
Definition at line 441 of file GraphicObject.cxx.
References maAttr, and mxSimpleCache.
Definition at line 605 of file GraphicObject.cxx.
References maGraphic.
Referenced by ImplDrawTiled().
void GraphicObject::SetUserData | ( | ) |
Definition at line 449 of file GraphicObject.cxx.
References maUserData.
void GraphicObject::SetUserData | ( | const OUString & | rUserData | ) |
Definition at line 454 of file GraphicObject.cxx.
References maUserData.
bool GraphicObject::StartAnimation | ( | OutputDevice * | pOut, |
const Point & | rPt, | ||
const Size & | rSz, | ||
tools::Long | nExtraData = 0 , |
||
OutputDevice * | pFirstFrameOutDev = nullptr |
||
) |
Definition at line 542 of file GraphicObject.cxx.
References CLIPREGION, Draw(), GetAttr(), tools::PolyPolygon::GetBoundRect(), GetGraphic(), GetTransformedGraphic(), ImplGetCropParams(), OutputDevice::IntersectClipRegion(), IsAnimated(), GraphicAttr::IsCropped(), mxSimpleCache, Point, OutputDevice::Pop(), and OutputDevice::Push().
void GraphicObject::StopAnimation | ( | const OutputDevice * | pOut = nullptr , |
tools::Long | nExtraData = 0 |
||
) |
Definition at line 594 of file GraphicObject.cxx.
References mxSimpleCache.
|
friend |
Definition at line 53 of file GraphicObject.hxx.
|
private |
Definition at line 57 of file GraphicObject.hxx.
Referenced by operator=(), operator==(), and SetAttr().
|
private |
Definition at line 56 of file GraphicObject.hxx.
Referenced by GetGraphic(), GetPrefMapMode(), GetPrefSize(), GetTransformedGraphic(), GetType(), ImplGetCropParams(), IsAnimated(), IsEPS(), IsTransparent(), operator=(), operator==(), and SetGraphic().
|
private |
Definition at line 58 of file GraphicObject.hxx.
Referenced by operator=(), and SetUserData().
|
private |
Definition at line 59 of file GraphicObject.hxx.
Referenced by operator=(), SetAttr(), StartAnimation(), and StopAnimation().