LibreOffice Module vcl (master) 1
|
#include <GraphicObject.hxx>
Public Member Functions | |
GraphicObject () | |
GraphicObject (Graphic aGraphic) | |
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 &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< GrfSimpleCacheObj > | mxSimpleCache |
Friends | |
class | SdrGrafObj |
Definition at line 52 of file GraphicObject.hxx.
GraphicObject::GraphicObject | ( | ) |
Definition at line 300 of file GraphicObject.cxx.
Referenced by ImplRenderTileRecursive().
GraphicObject::GraphicObject | ( | Graphic | aGraphic | ) |
Definition at line 304 of file GraphicObject.cxx.
References maGraphic.
GraphicObject::GraphicObject | ( | const GraphicObject & | rCacheObj | ) |
Definition at line 309 of file GraphicObject.cxx.
References maGraphic, and maUserData.
GraphicObject::~GraphicObject | ( | ) |
Definition at line 316 of file GraphicObject.cxx.
basegfx::B2DVector GraphicObject::calculateCropScaling | ( | double | fWidth, |
double | fHeight, | ||
double | fLeftCrop, | ||
double | fTopCrop, | ||
double | fRightCrop, | ||
double | fBottomCrop | ||
) | const |
Definition at line 896 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 & | rOut, |
const Point & | rPt, | ||
const Size & | rSz, | ||
const GraphicAttr * | pAttr = nullptr |
||
) | const |
Definition at line 461 of file GraphicObject.cxx.
References Point::AdjustX(), Point::AdjustY(), vcl::CLIPREGION, GetAttr(), tools::PolyPolygon::GetBoundRect(), OutputDevice::GetDrawMode(), GraphicAttr::GetMirrorFlags(), Size::Height(), Horizontal, ImplGetCropParams(), OutputDevice::IntersectClipRegion(), GraphicAttr::IsCropped(), 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 & | rOut, |
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 523 of file GraphicObject.cxx.
References OutputDevice::GetMapMode(), Size::Height(), ImplDrawTiled(), Size::IsEmpty(), OutputDevice::LogicToPixel(), SAL_MAX_UINT16, and Size::Width().
|
inline |
Definition at line 205 of file GraphicObject.hxx.
Referenced by Draw(), GetTransformedGraphic(), and StartAnimation().
const Graphic & GraphicObject::GetGraphic | ( | ) | const |
Definition at line 602 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 GraphicAttr * | pAttr | ) | const |
Definition at line 839 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().
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 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().
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().
|
inline |
Definition at line 210 of file GraphicObject.hxx.
References maUserData.
|
inline |
Definition at line 207 of file GraphicObject.hxx.
References maUserData.
|
private |
Definition at line 380 of file GraphicObject2.cxx.
References Point::AdjustX(), Point::AdjustY(), Bitmap, Draw(), OutputDevice::EnableMapMode(), OutputDevice::GetConnectMetaFile(), GetType(), Size::Height(), OutputDevice::IsMapModeEnabled(), OutputDevice::PixelToLogic(), Point::setX(), Size::Width(), and Point::X().
|
private |
Definition at line 275 of file GraphicObject2.cxx.
References Bitmap, vcl::CLIPREGION, COL_WHITE(), BitmapEx::GetBitmap(), vcl::drawmode::GetBitmapEx(), GetGraphic(), tools::Rectangle::GetHeight(), OutputDevice::GetMapMode(), MapMode::GetMapUnit(), MapMode::GetScaleX(), MapMode::GetScaleY(), BitmapEx::GetSizePixel(), GetType(), tools::Rectangle::GetWidth(), Size::Height(), ImplDrawTiled(), ImplRenderTempTile(), OutputDevice::IntersectClipRegion(), IsTransparent(), tools::Rectangle::Left(), OutputDevice::LogicToPixel(), OutputDevice::Pop(), OutputDevice::Push(), SetGraphic(), tools::Rectangle::Top(), Size::Width(), Point::X(), and Point::Y().
Referenced by DrawTiled(), and ImplDrawTiled().
|
private |
Definition at line 350 of file GraphicObject.cxx.
References Point::AdjustX(), Point::AdjustY(), 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(), 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 Point::AdjustX(), Point::AdjustY(), ImplTileInfo::aNextTileTopLeft, ImplTileInfo::aTileSizePixel, ImplTileInfo::aTileTopLeft, Draw(), OutputDevice::DrawEllipse(), OutputDevice::DrawRect(), OutputDevice::GetBitmap(), GraphicObject(), Size::Height(), ImplRenderTileRecursive(), ImplTileInfo::nTilesEmptyX, ImplTileInfo::nTilesEmptyY, OutputDevice::SetFillColor(), OutputDevice::SetLineColor(), Point::setX(), Point::setY(), Size::Width(), Point::X(), and Point::Y().
Referenced by ImplRenderTempTile(), and ImplRenderTileRecursive().
|
private |
Definition at line 428 of file GraphicObject2.cxx.
References ColorAlpha, BitmapEx::CopyPixel(), BitmapEx::Crop(), BitmapEx::Erase(), AlphaMask::Erase(), BitmapEx::GetAlphaMask(), BitmapEx::GetBitmap(), GraphicAttr::GetRotation(), BitmapEx::GetSizePixel(), Size::Height(), BitmapEx::IsAlpha(), IsAnimated(), GraphicAttr::IsCropped(), BitmapEx::Scale(), and Size::Width().
Referenced by GetTransformedGraphic().
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.
|
static |
Definition at line 889 of file GraphicObject.cxx.
References o3tl::starts_with(), and u.
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().
|
inline |
Definition at line 167 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.
void GraphicObject::SetAttr | ( | const GraphicAttr & | rAttr | ) |
Definition at line 443 of file GraphicObject.cxx.
References maAttr, and mxSimpleCache.
void GraphicObject::SetGraphic | ( | const Graphic & | rGraphic | ) |
Definition at line 607 of file GraphicObject.cxx.
References maGraphic.
Referenced by ImplDrawTiled().
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 & | rOut, |
const Point & | rPt, | ||
const Size & | rSz, | ||
tools::Long | nExtraData = 0 , |
||
OutputDevice * | pFirstFrameOutDev = nullptr |
||
) |
Definition at line 544 of file GraphicObject.cxx.
References vcl::CLIPREGION, Draw(), GetAttr(), tools::PolyPolygon::GetBoundRect(), GetGraphic(), GetTransformedGraphic(), ImplGetCropParams(), OutputDevice::IntersectClipRegion(), IsAnimated(), GraphicAttr::IsCropped(), mxSimpleCache, OutputDevice::Pop(), and OutputDevice::Push().
void GraphicObject::StopAnimation | ( | const OutputDevice * | pOut = nullptr , |
tools::Long | nExtraData = 0 |
||
) |
Definition at line 596 of file GraphicObject.cxx.
References mxSimpleCache, and pOut.
|
friend |
Definition at line 54 of file GraphicObject.hxx.
|
private |
Definition at line 58 of file GraphicObject.hxx.
Referenced by operator=(), operator==(), and SetAttr().
|
private |
Definition at line 57 of file GraphicObject.hxx.
Referenced by GetGraphic(), GetPrefMapMode(), GetPrefSize(), GetTransformedGraphic(), GetType(), ImplGetCropParams(), IsAnimated(), IsEPS(), IsTransparent(), operator=(), operator==(), and SetGraphic().
|
private |
Definition at line 59 of file GraphicObject.hxx.
Referenced by operator=(), and SetUserData().
|
private |
Definition at line 60 of file GraphicObject.hxx.
Referenced by operator=(), SetAttr(), StartAnimation(), and StopAnimation().