21 #include <config_features.h>
31 #include <rtl/math.hxx>
54 m_nLastMirrorDeviceLTRButBiDiRtlTranslate(0),
55 m_bLastMirrorDeviceLTRButBiDiRtlSet(false),
65 bool bFileDefinitionsWidgetDraw = !!getenv(
"VCL_DRAW_WIDGETS_FROM_FILE");
67 if (bFileDefinitionsWidgetDraw || bForce)
71 if (!pFileDefinitionWidgetDraw->isActive())
176 for( i=0, j=nPoints-1; i<nPoints; i++,j-- )
178 pPtAry2[j].setX( devX + (pPtAry[i].getX() - rOutDev.
GetOutOffXPixel()) );
179 pPtAry2[j].setY( pPtAry[i].getY() );
185 for( i=0, j=nPoints-1; i<nPoints; i++,j-- )
188 pPtAry2[j].setY( pPtAry[i].getY() );
194 for( i=0, j=nPoints-1; i<nPoints; i++,j-- )
196 pPtAry2[j].setX( w-1-pPtAry[i].getX() );
197 pPtAry2[j].setY( pPtAry[i].getY() );
249 mirror( x, nWidth, rOutDev, bBack );
250 rRect.
Move( x - x_org, 0 );
274 SAL_WARN_IF( !w,
"vcl",
"missing graphics width" );
276 const bool bMirrorDeviceLTRButBiDiRtlSet = !i_rOutDev.
IsRTLEnabled();
277 tools::Long nMirrorDeviceLTRButBiDiRtlTranslate(0);
278 if (bMirrorDeviceLTRButBiDiRtlSet)
283 if (bLastMirrorValid && bMirrorDeviceLTRButBiDiRtlSet)
290 if (!bLastMirrorValid)
298 if (bMirrorDeviceLTRButBiDiRtlSet)
311 nMirrorDeviceLTRButBiDiRtlTranslate, 0.0);
341 mirror( aMirror, rOutDev );
374 mirror( nX, nWidth, rOutDev );
375 drawRect( nX, nY, nWidth, nHeight );
382 std::unique_ptr<Point[]> pPtAry2(
new Point[nPoints]);
383 bool bCopied =
mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
384 drawPolyLine( nPoints, bCopied ? pPtAry2.get() : pPtAry );
394 std::unique_ptr<Point[]> pPtAry2(
new Point[nPoints]);
395 bool bCopied =
mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
396 drawPolygon( nPoints, bCopied ? pPtAry2.get() : pPtAry );
407 std::unique_ptr<Point*[]> pPtAry2(
new Point*[nPoly] );
409 for(i=0; i<nPoly; i++)
412 pPtAry2[i] =
new Point[ nPoints ];
413 mirror( nPoints, pPtAry[i], pPtAry2[i], rOutDev );
416 drawPolyPolygon( nPoly, pPoints, const_cast<const Point**>(pPtAry2.get()) );
418 for(i=0; i<nPoly; i++)
419 delete [] pPtAry2[i];
430 aRTLBoundingBox *= rMirror;
438 double i_fTransparency,
448 rMirror * rObjectToDevice,
462 bool bResult =
false;
465 std::unique_ptr<Point[]> pPtAry2(
new Point[nPoints]);
466 bool bCopied =
mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
476 bool bResult =
false;
479 std::unique_ptr<Point[]> pPtAry2(
new Point[nPoints]);
480 bool bCopied =
mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
481 bResult =
drawPolygonBezier( nPoints, bCopied ? pPtAry2.get() : pPtAry, pFlgAry );
495 std::unique_ptr<Point*[]> pPtAry2(
new Point*[i_nPoly] );
497 for(i=0; i<i_nPoly; i++)
500 pPtAry2[i] =
new Point[ nPoints ];
501 mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_rOutDev );
504 bRet =
drawPolyPolygonBezier( i_nPoly, i_pPoints, const_cast<const Point* const *>(pPtAry2.get()), i_pFlgAry );
506 for(i=0; i<i_nPoly; i++)
507 delete [] pPtAry2[i];
517 double i_fTransparency,
519 const std::vector< double >* i_pStroke,
521 css::drawing::LineCap i_eLineCap,
522 double i_fMiterMinimumAngle,
523 bool bPixelSnapHairline,
533 rMirror * rObjectToDevice,
540 i_fMiterMinimumAngle,
554 i_fMiterMinimumAngle,
576 mirror( nDestX, nSrcWidth, rOutDev );
577 mirror( nSrcX, nSrcWidth, rOutDev );
579 copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight,
true );
605 copyBits( aPosAry2, &rSrcGraphics );
632 drawBitmap( aPosAry2, rSalBitmap, rTransparentBitmap );
635 drawBitmap( rPosAry, rSalBitmap, rTransparentBitmap );
646 drawMask( aPosAry2, rSalBitmap, nMaskColor );
649 drawMask( rPosAry, rSalBitmap, nMaskColor );
655 mirror( nX, nWidth, rOutDev );
656 return getBitmap( nX, nY, nWidth, nHeight );
669 mirror( nX, nWidth, rOutDev );
670 invert( nX, nY, nWidth, nHeight, nFlags );
677 std::unique_ptr<Point[]> pPtAry2(
new Point[nPoints]);
678 bool bCopied =
mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
679 invert( nPoints, bCopied ? pPtAry2.get() : pPtAry, nFlags );
682 invert( nPoints, pPtAry, nFlags );
688 mirror( nX, nWidth, rOutDev );
689 return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize );
693 const Point& aPos,
bool& rIsInside,
const OutputDevice& rOutDev)
699 pt.setX(
mirror2( pt.X(), rOutDev ) );
746 const Color& rBackgroundColor)
755 mirror(aControlRegion, rOutDev);
756 std::unique_ptr< ImplControlValue > mirrorValue( aValue.
clone());
757 mirror( *mirrorValue, rOutDev );
776 std::unique_ptr< ImplControlValue > mirrorValue( aValue.
clone());
777 mirror( *mirrorValue, rOutDev );
780 mirror( rNativeBoundingRegion, rOutDev,
true );
781 mirror( rNativeContentRegion, rOutDev,
true );
852 auto aTranslateToMirroredBounds = createTranslateToMirroredBounds(aBoundingBox, rMirror);
874 mirror( nX, nWidth, rOutDev );
876 return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency );
888 std::vector<sal_Int32>& rWidths,
Ucs2UIntMap& rUnicodeEnc)
894 if (nGlyphCount <= 0)
900 SAL_WARN(
"vcl.fonts",
"no charmap");
904 rWidths.resize(nGlyphCount);
905 std::vector<sal_uInt16> aGlyphIds(nGlyphCount);
906 for (
int i = 0;
i < nGlyphCount;
i++)
907 aGlyphIds[
i] = static_cast<sal_uInt16>(
i);
909 std::unique_ptr<sal_uInt16[]> pGlyphMetrics
913 for (
int i = 0;
i < nGlyphCount; ++
i)
914 rWidths[
i] = pGlyphMetrics[
i];
915 pGlyphMetrics.reset();
920 for (; --nCharCount >= 0; nChar = xFCMap->
GetNextChar(nChar))
928 rUnicodeEnc[nUcsChar] = nGlyph;
933 const bool bVertical,
const sal_GlyphId* pGlyphIds,
934 const sal_uInt8* pEncoding, sal_Int32* pGlyphWidths,
935 const int nOrigGlyphCount)
946 if (nOrigGlyphCount > 256)
948 SAL_WARN(
"vcl.fonts",
"too many glyphs for subsetting");
952 int nGlyphCount = nOrigGlyphCount;
953 sal_uInt16 aShortIDs[256];
958 for (
i = 0;
i < nGlyphCount; ++
i)
960 aTempEncs[
i] = pEncoding[
i];
961 aShortIDs[
i] =
static_cast<sal_uInt16
>(pGlyphIds[
i]);
972 if (nGlyphCount == 256)
974 SAL_WARN(
"vcl.fonts",
"too many glyphs for subsetting");
977 nNotDef = nGlyphCount++;
980 aShortIDs[nNotDef] = aShortIDs[0];
981 aTempEncs[nNotDef] = aTempEncs[0];
986 std::unique_ptr<sal_uInt16[]> pMetrics
991 sal_uInt16 nNotDefAdv = pMetrics[0];
992 pMetrics[0] = pMetrics[nNotDef];
993 pMetrics[nNotDef] = nNotDefAdv;
994 for (
i = 0;
i < nOrigGlyphCount; ++
i)
995 pGlyphWidths[
i] = pMetrics[
i];
1004 const OString& rSysPath,
const sal_GlyphId* pGlyphIds,
1005 const sal_uInt8* pEncoding, sal_Int32* pGlyphWidths,
1008 FILE* pOutFile = fopen(rSysPath.getStr(),
"wb");
1013 nGlyphCount, pGlyphWidths);
virtual SalFrame * GetParent() const =0
FontType m_nFontType
font-type of subset result
int winDescent
descender metric for Windows
virtual bool drawAlphaBitmap(const SalTwoRect &, const SalBitmap &rSourceBitmap, const SalBitmap &rAlphaBitmap)=0
Render bitmap with alpha channel.
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const OutputDevice &rOutDev, const Color &rBackgroundColor=COL_AUTO)
void DrawPixel(tools::Long nX, tools::Long nY, const OutputDevice &rOutDev)
bool SetClipRegion(const vcl::Region &, const OutputDevice &rOutDev)
virtual OUString getRenderBackendName() const
static void FillFontSubsetInfo(const vcl::TTGlobalFontInfo &rTTInfo, const OUString &pPSName, FontSubsetInfo &rInfo)
static bool CreateTTFfontSubset(vcl::AbstractTrueTypeFont &aTTF, const OString &rSysPath, const bool bVertical, const sal_GlyphId *pGlyphIds, const sal_uInt8 *pEncoding, sal_Int32 *pGlyphWidths, int nGlyphCount)
bool BlendBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, const OutputDevice &rOutDev)
SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont *ttf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 const *encoding, int nGlyphs)
Generates a new TrueType font and dumps it to outf file.
virtual std::shared_ptr< SalBitmap > getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)=0
bool HasFastDrawTransformedBitmap() const
void DrawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2, const OutputDevice &rOutDev)
CFF-container with PSType2 glyphs.
bool CreateFontSubset(FontType nOutFontTypeMask, FILE *pOutFile, const char *pOutFontName, const sal_GlyphId *pGlyphIds, const sal_uInt8 *pEncodedIds, int nReqGlyphCount, sal_Int32 *pOutGlyphWidths=nullptr)
virtual bool IsVirtual() const
virtual bool blendAlphaBitmap(const SalTwoRect &, const SalBitmap &rSrcBitmap, const SalBitmap &rMaskBitmap, const SalBitmap &rAlphaBitmap)=0
Draw the bitmap by blending using the mask and alpha channel.
void Invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags, const OutputDevice &rOutDev)
SalFrameGeometry GetGeometry() const
ControlType getType() const
std::unique_ptr< sal_uInt16[]> GetTTSimpleGlyphMetrics(AbstractTrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical)
Queries glyph metrics.
void Union(const tools::Rectangle &rRegion)
sal_uInt32 glyphCount() const
tools::Long GetOutOffXPixel() const
virtual void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2)=0
void CopyBits(const SalTwoRect &rPosAry, const OutputDevice &rOutDev)
void DrawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point **pPtAry, const OutputDevice &rOutDev)
bool DrawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency, const OutputDevice &rOutDev)
void LoadFont(FontType eInFontType, const unsigned char *pFontBytes, int nByteLength)
virtual bool blendBitmap(const SalTwoRect &, const SalBitmap &rBitmap)=0
Blend the bitmap with the current buffer.
bool DrawTransformedBitmap(const basegfx::B2DPoint &rNull, const basegfx::B2DPoint &rX, const basegfx::B2DPoint &rY, const SalBitmap &rSourceBitmap, const SalBitmap *pAlphaBitmap, double fAlpha, const OutputDevice &rOutDev)
bool DrawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void *pPtr, sal_uInt32 nSize, const OutputDevice &rOutDev)
virtual Color getPixel(tools::Long nX, tools::Long nY)=0
bool DrawGradient(const tools::PolyPolygon &rPolyPoly, const Gradient &rGradient, const OutputDevice &rOutDev)
std::vector< tools::Rectangle > RectangleVector
int yMin
global bounding box: yMin
virtual void drawPixel(tools::Long nX, tools::Long nY)=0
void DrawMask(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, Color nMaskColor, const OutputDevice &rOutDev)
virtual void drawPolygon(sal_uInt32 nPoints, const Point *pPtAry)=0
virtual bool drawTransformedBitmap(const basegfx::B2DPoint &rNull, const basegfx::B2DPoint &rX, const basegfx::B2DPoint &rY, const SalBitmap &rSourceBitmap, const SalBitmap *pAlphaBitmap, double fAlpha)=0
draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system ...
void DrawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, const OutputDevice &rOutDev)
bool initWidgetDrawBackends(bool bForce=false)
basegfx::B2DHomMatrix m_aLastMirror
virtual void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)=0
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
int GetCharCount() const
Get the number of characters in the font character map.
int winAscent
ascender metric for Windows
bool BlendAlphaBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalSrcBitmap, const SalBitmap &rSalMaskBitmap, const SalBitmap &rSalAlphaBitmap, const OutputDevice &rOutDev)
virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point **pPtAry)=0
virtual void drawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap)=0
abstract base class for physical font faces
void DrawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice &rOutDev)
void DrawPolygon(sal_uInt32 nPoints, const Point *pPtAry, const OutputDevice &rOutDev)
sal_UCS4 GetFirstChar() const
Get the first character in the font character map.
tools::Long mirror2(tools::Long nX, const OutputDevice &rOutDev) const
virtual bool setClipRegion(const vcl::Region &)=0
bool IsRTLEnabled() const
virtual ImplControlValue * clone() const
int typoAscender
OS/2 portable typographic ascender.
int ascender
typographic ascent.
virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry)=0
int descender
typographic descent.
static bool CreateCFFfontSubset(const unsigned char *pFontBytes, int nByteLength, const OString &rSysPath, const sal_GlyphId *pGlyphIds, const sal_uInt8 *pEncoding, sal_Int32 *pGlyphWidths, int nGlyphCount, FontSubsetInfo &rInfo)
int GetGlyphIndex(sal_UCS4) const
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
void CopyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, const OutputDevice &rOutDev)
virtual void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags)=0
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
virtual bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void *pPtr, sal_uInt32 nSize)=0
static bool GetLayoutRTL()
void transform(const basegfx::B2DHomMatrix &rMatrix)
void DrawPolyLine(sal_uInt32 nPoints, Point const *pPtAry, const OutputDevice &rOutDev)
SalFrameGeometry maGeometry
absolute, unmirrored values
std::unique_ptr< vcl::WidgetDrawInterface > m_pWidgetDraw
virtual tools::Long GetGraphicsWidth() const =0
tools::Long m_nLastMirrorDeviceLTRButBiDiRtlTranslate
virtual bool drawPolygonBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry)=0
virtual OUString getRenderBackendName() const =0
SFNT container with TrueType glyphs.
virtual SalGraphicsImpl * GetImpl() const =0
void mirror(tools::Long &nX, const OutputDevice &rOutDev) const
virtual bool hasFastDrawTransformedBitmap() const =0
Used e.g.
int yMax
global bounding box: yMax
virtual void copyBits(const SalTwoRect &rPosAry, SalGraphics *pSrcGraphics)=0
tools::Rectangle maThumbRect
bool DrawPolyLineBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry, const OutputDevice &rOutDev)
vcl::WidgetDrawInterface * forWidget()
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion, const OutputDevice &rOutDev)
bool DrawAlphaBitmap(const SalTwoRect &, const SalBitmap &rSourceBitmap, const SalBitmap &rAlphaBitmap, const OutputDevice &rOutDev)
int xMax
global bounding box: xMax
int xMin
global bounding box: xMin
virtual void GetGlyphWidths(const PhysicalFontFace *pFont, bool bVertical, std::vector< sal_Int32 > &rWidths, Ucs2UIntMap &rUnicodeEnc)=0
sal_UCS4 GetNextChar(sal_UCS4 cChar) const
Get the next character in the font character map.
A SalFrame is a system window (e.g. an X11 window).
bool DrawPolygonBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry, const OutputDevice &rOutDev)
#define SAL_WARN_IF(condition, area, stream)
SalLayoutFlags GetLayout() const
bool m_bLastMirrorDeviceLTRButBiDiRtlSet
tools::Long m_aLastMirrorW
void GetRegionRectangles(RectangleVector &rTarget) const
virtual void drawMask(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, Color nMaskColor)=0
virtual FontCharMapRef GetFontCharMap() const =0
const basegfx::B2DHomMatrix & getMirror(const OutputDevice &rOutDev) const
bool HasPolyPolygonOrB2DPolyPolygon() const
~SalGraphics() COVERITY_NOEXCEPT_FALSE override
tools::Long GetDeviceWidth(const OutputDevice &rOutDev) const
int m_nAscent
all metrics in PS font units
PSType1 Postscript Font Binary.
virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point *const *pPtAry, const PolyFlags *const *pFlgAry)=0
basegfx::B2DPolyPolygon GetAsB2DPolyPolygon() const
bool HitTestNativeScrollbar(ControlPart nPart, const tools::Rectangle &rControlRegion, const Point &aPos, bool &rIsInside, const OutputDevice &rOutDev)
virtual void drawPolyLine(sal_uInt32 nPoints, const Point *pPtAry)=0
#define SAL_WARN(area, stream)
virtual bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency)=0
Render solid rectangle with given transparency.
bool DrawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point *const *pPtAry, const PolyFlags *const *pFlgAry, const OutputDevice &rOutDev)
Color GetPixel(tools::Long nX, tools::Long nY, const OutputDevice &rOutDev)
virtual void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate)=0
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap
tools::Rectangle m_aFontBBox
virtual bool drawGradient(const tools::PolyPolygon &rPolyPoly, const Gradient &rGradient)=0
tools::Long GetOutputWidthPixel() const
int typoDescender
OS/2 portable typographic descender.
virtual void handleDamage(const tools::Rectangle &rDamagedRegion)
Handle damage done by drawing with a widget draw override.
Return value of GetTTGlobalFontInfo()
std::shared_ptr< SalBitmap > GetBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice &rOutDev)