/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
struct ImplOutDevData; class LogicalFontInstance; struct SystemGraphicsData; class ImplFontCache; class SalGraphics; class Gradient; class Hatch; class BitmapReadAccess; class Image; class TextRectInfo; class FontMetric; class GDIMetaFile; class GfxLink; namespace tools { class Line;
} class LineInfo; class AlphaMask; class FontCharMap; class SalLayout; class VirtualDevice; struct SalTwoRect; class Printer; class VCLXGraphics; class SalLayoutGlyphs;
namespace vcl
{ class ExtOutDevData; class TextLayoutCommon; struct FontCapabilities; class Window; class WindowOutputDevice; namespace font { struct Feature; class PhysicalFontCollection; class PhysicalFontFaceCollection;
}
namespace text { class ImplLayoutArgs; class TextLayoutCache;
}
}
namespace basegfx { class B2DHomMatrix; class B2ISize;
}
namespace com::sun::star::awt { class XGraphics;
}
namespace com::sun::star::rendering { class XCanvas; class XSpriteCanvas;
}
/** * Some things multiple-inherit from VclAbstractDialog and OutputDevice, * so we need to use virtual inheritance to keep the referencing counting * OK.
*/ class SAL_WARN_UNUSED VCL_DLLPUBLIC OutputDevice : publicvirtual VclReferenceBase
{ friendclass Printer; friendclass VirtualDevice; friendclass vcl::Window; friendclass vcl::WindowOutputDevice; friendclass WorkWindow; friendvoid ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight );
mutable SalGraphics* mpGraphics; ///< Graphics context to draw on mutable VclPtr<OutputDevice> mpPrevGraphics; ///< Previous output device in list mutable VclPtr<OutputDevice> mpNextGraphics; ///< Next output device in list
GDIMetaFile* mpMetaFile; mutable rtl::Reference<LogicalFontInstance> mpFontInstance;
rtl::Reference<LogicalFontInstance> mpForcedFallbackInstance; mutable std::unique_ptr<vcl::font::PhysicalFontFaceCollection> mpFontFaceCollection;
std::vector<vcl::State> maOutDevStateStack;
std::unique_ptr<ImplOutDevData> mpOutDevData;
std::vector< VCLXGraphics* >* mpUnoGraphicsList;
vcl::ExtOutDevData* mpExtOutDevData; // The canvas interface for this output device. Is persistent after the first GetCanvas() call mutable css::uno::WeakReference< css::rendering::XCanvas > mxCanvas;
// Used by the canvas module. Despite the name it does not always return true if Cairo is supported. bool SupportsCairo() const; /// Create Surface from given cairo surface
cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const; /// Create surface with given dimensions
cairo::SurfaceSharedPtr CreateSurface(int x, int y, int width, int height) const; /// Create Surface for given bitmap data
cairo::SurfaceSharedPtr CreateBitmapSurface(const BitmapSystemData& rData, constSize& rSize) const; /// Return native handle for underlying surface
css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const;
SAL_DLLPRIVATE css::uno::Any GetSystemGfxDataAny() const;
/** Acquire a graphics device that the output device uses to draw on.
There is an LRU of OutputDevices that is used to get the graphics. The actual creation of a SalGraphics instance is done via the SalFrame implementation.
However, the SalFrame instance will only return a valid SalGraphics instance if it is not in use or there wasn't one in the first place. When this happens, AcquireGraphics finds the least recently used OutputDevice in a different frame and "steals" it (releases it then starts using it).
If there are no frames to steal an OutputDevice's SalGraphics instance from then it blocks until the graphics is released.
Once it has acquired a graphics instance, then we add the OutputDevice to the LRU.
@returns true if was able to initialize the graphics device, false otherwise.
*/ virtualbool AcquireGraphics() const = 0;
/** Release the graphics device, and remove it from the graphics device list.
@param bRelease Determines whether to release the fonts of the physically released graphics device.
*/ virtualvoid ReleaseGraphics( bool bRelease = true ) = 0; ///@}
/** If this OutputDevice is used for displaying a Print Preview the OutDevViewType should be set to 'OutDevViewType::PrintPreview'.
A View can then make painting decisions dependent on this OutDevViewType. E.g. text colors need to be handled differently, dependent on whether it's a PrintPreview or not. (see #106611# for more)
*/ void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
/** Perform actual rect clip against outdev dimensions, to generate empty clips whenever one of the values is completely off the device.
@param aRegion region to be clipped to the device dimensions @returns region clipped to the device bounds
**/ virtual vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const; virtualvoid ClipToPaintRegion ( tools::Rectangle& rDstRect );
/// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd void DrawCheckered( const Point& rPos, const Size& rSize,
sal_uInt32 nLen = 8,
Color aStart = COL_WHITE,
Color aEnd = COL_BLACK);
/** Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
*/
SAL_DLLPRIVATE void drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const LineInfo& rInfo ); ///@}
/** @name Polyline functions
*/ ///@{
public:
/** Render the given polygon as a line stroke
The given polygon is stroked with the current LineColor, start and end point are not automatically connected
The given polygon is stroked with the current LineColor, start and end point are not automatically connected. The line is rendered according to the specified LineInfo, e.g. supplying a dash pattern, or a line thickness.
// #i101491# // Helper which holds the old line geometry creation and is extended to use AA when // switched on. Advantage is that line geometry is only temporarily used for paint
SAL_DLLPRIVATE void drawPolyLine(const tools::Polygon& rPoly, const LineInfo& rLineInfo);
The given polygon is stroked with the current LineColor, and filled with the current FillColor. If one of these colors are transparent, the corresponding stroke or fill stays invisible. Start and end point of the polygon are automatically connected.
The given poly-polygon is stroked with the current LineColor, and filled with the current FillColor. If one of these colors are transparent, the corresponding stroke or fill stays invisible. Start and end points of the contained polygons are automatically connected.
The text is then drawn exactly from rRect.TopLeft() to rRect.BottomRight(), don't assume that rRect.TopLeft() is [0, 0].
Please note that you don't always want to use GetTextBoundRect(); in many cases you actually want to use GetTextHeight(), because GetTextBoundRect() gives you the exact bounding rectangle regardless what is the baseline of the text.
Code snippet to get just exactly the text (no filling around that) as a bitmap via a VirtualDevice (regardless what is the baseline):
// exactly only the text, regardless of the baseline Bitmap aBitmap(aDevice.GetBitmap(aRect.TopLeft(), aRect.GetSize())); </code>
Code snippet to get the text as a bitmap via a Virtual device that contains even the filling so that the baseline is always preserved (ie. the text will not jump up and down according to whether it contains 'y' or not etc.)
<code> VirtualDevice aDevice; // + the appropriate font / device setup, see above
This method splits up the text rect into multiple MetaTextActions, one for each line of text. This is comparable to AddGradientActions(), which splits up a gradient into its constituent polygons. Parameter semantics fully compatible to DrawText().
*/ void AddTextRectActions( const tools::Rectangle& rRect, const OUString& rOrigStr,
DrawTextFlags nStyle,
GDIMetaFile& rMtf );
/** Height where any character of the current font fits; in logic coordinates.
See also GetTextBoundRect() for more explanation + code examples.
*/
tools::Long GetTextHeight() const; double GetTextHeightDouble() const; float approximate_digit_width() const;
// tdf#163105: Get map of valid kashida positions for a single word void GetWordKashidaPositions(const OUString& rText, std::vector<bool>* pOutMap) const;
//drop font data for all outputdevices. //If bNewFontLists is true then empty lists of system fonts staticvoid ImplClearAllFontData( bool bNewFontLists ); //fetch font data for all outputdevices //If bNewFontLists is true then fetch lists of system fonts staticvoid ImplRefreshAllFontData( bool bNewFontLists ); //drop and fetch font data for all outputdevices //If bNewFontLists is true then drop and refetch lists of system fonts
SAL_DLLPRIVATE staticvoid ImplUpdateAllFontData( bool bNewFontLists );
/* These functions allow collecting information on how fonts are mapped when used, such as what replacements are used when a requested font is missing or which fonts are used as fallbacks when a font doesn't provide all necessary glyphs. After StartTrackingFontMappingUse() is called, VCL starts collecting font usage for all text layout calls, FinishTrackingFontMappingUse() will stop collecting and providing the collected information. Each item is a mapping from a requested font to a list of actually used fonts and the number of times this mapping was done.
*/ struct FontMappingUseItem
{
OUString mOriginalFont;
std::vector<OUString> mUsedFonts; int mCount;
}; typedef std::vector<FontMappingUseItem> FontMappingUseData; staticvoid StartTrackingFontMappingUse(); static FontMappingUseData FinishTrackingFontMappingUse();
// Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout virtualvoid EnableRTL( bool bEnable = true); bool IsRTLEnabled() const { return mbEnableRTL; }
@param rTransformation The transformation describing the target positioning of the given bitmap. Transforming the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to discrete coordinates
@param rBitmapEx The BitmapEx to be painted
@param fAlpha Optional additional alpha to use for drawing (0 to 1, 1 being no change).
*/ void DrawTransformedBitmapEx( const basegfx::B2DHomMatrix& rTransformation, const BitmapEx& rBitmapEx, double fAlpha = 1.0);
/** Return true if DrawTransformedBitmapEx() is fast.
@param aFullTransform The B2DHomMatrix used for the transformation @param rBitmapEx Reference to the bitmap to be transformed and drawn
@return true if it was able to draw the bitmap, false if not
*/ virtualbool DrawTransformBitmapExDirect( const basegfx::B2DHomMatrix& aFullTransform, const BitmapEx& rBitmapEx, double fAlpha = 1.0);
/** Transform and reduce the area that needs to be drawn of the bitmap and return the new visible range and the maximum area.
@param aFullTransform B2DHomMatrix used for transformation @param aVisibleRange The new visible area of the bitmap @param fMaximumArea The maximum area of the bitmap
@returns true if there is an area to be drawn, otherwise nothing is left to be drawn so return false
*/
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.67 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.