xref: /aoo42x/main/vcl/inc/aqua/salgdi.h (revision 86e1cf34)
124f6443dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
324f6443dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
424f6443dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
524f6443dSAndrew Rist  * distributed with this work for additional information
624f6443dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
724f6443dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
824f6443dSAndrew Rist  * "License"); you may not use this file except in compliance
924f6443dSAndrew Rist  * with the License.  You may obtain a copy of the License at
1024f6443dSAndrew Rist  *
1124f6443dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1224f6443dSAndrew Rist  *
1324f6443dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1424f6443dSAndrew Rist  * software distributed under the License is distributed on an
1524f6443dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1624f6443dSAndrew Rist  * KIND, either express or implied.  See the License for the
1724f6443dSAndrew Rist  * specific language governing permissions and limitations
1824f6443dSAndrew Rist  * under the License.
1924f6443dSAndrew Rist  *
2024f6443dSAndrew Rist  *************************************************************/
2124f6443dSAndrew Rist 
2224f6443dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_SALGDI_H
25cdf0e10cSrcweir #define _SV_SALGDI_H
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "basegfx/polygon/b2dpolypolygon.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "premac.h"
30cdf0e10cSrcweir #include <ApplicationServices/ApplicationServices.h>
31cdf0e10cSrcweir #include "postmac.h"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "aqua/aquavcltypes.h"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include "outfont.hxx"
36cdf0e10cSrcweir #include "salgdi.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <vector>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class AquaSalFrame;
41cdf0e10cSrcweir class AquaSalBitmap;
42cdf0e10cSrcweir class ImplDevFontAttributes;
4324a22e85SHerbert Dürr class ImplMacTextStyle;
44cdf0e10cSrcweir 
4524a22e85SHerbert Dürr struct CGRect;
4624a22e85SHerbert Dürr 
472dae3561SHerbert Dürr typedef std::vector<unsigned char> ByteVector;
482dae3561SHerbert Dürr 
4924a22e85SHerbert Dürr #ifndef CGFLOAT_TYPE
5024a22e85SHerbert Dürr typedef float CGFloat;
5124a22e85SHerbert Dürr #endif
52cdf0e10cSrcweir 
53cdf0e10cSrcweir // mac specific physically available font face
54cdf0e10cSrcweir class ImplMacFontData : public ImplFontData
55cdf0e10cSrcweir {
56cdf0e10cSrcweir public:
572dae3561SHerbert Dürr 	ImplMacFontData( const ImplDevFontAttributes&, sal_IntPtr nFontID );
582dae3561SHerbert Dürr 	virtual ~ImplMacFontData();
59cdf0e10cSrcweir 
602dae3561SHerbert Dürr 	virtual ImplFontData*   Clone() const = 0;
612dae3561SHerbert Dürr 	virtual ImplFontEntry*  CreateFontInstance( ImplFontSelectData& ) const;
62cdf0e10cSrcweir 	virtual sal_IntPtr      GetFontId() const;
632dae3561SHerbert Dürr 
642dae3561SHerbert Dürr 	virtual ImplMacTextStyle* CreateMacTextStyle( const ImplFontSelectData& ) const = 0;
652dae3561SHerbert Dürr 	virtual int             GetFontTable( const char pTagName[5], unsigned char* ) const = 0;
66cdf0e10cSrcweir 
672dae3561SHerbert Dürr 	const ImplFontCharMap*	GetImplFontCharMap() const;
68cdf0e10cSrcweir 	bool					HasChar( sal_uInt32 cChar ) const;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	void					ReadOs2Table() const;
71cdf0e10cSrcweir 	void					ReadMacCmapEncoding() const;
72cdf0e10cSrcweir 	bool					HasCJKSupport() const;
73cdf0e10cSrcweir 
742dae3561SHerbert Dürr protected:
752dae3561SHerbert Dürr 	ImplMacFontData( const ImplMacFontData&);
76cdf0e10cSrcweir private:
772dae3561SHerbert Dürr 	const sal_IntPtr			mnFontId;
78cdf0e10cSrcweir 	mutable const ImplFontCharMap*	mpCharMap;
79cdf0e10cSrcweir 	mutable bool				mbOs2Read;		 // true if OS2-table related info is valid
80cdf0e10cSrcweir 	mutable bool				mbHasOs2Table;
81cdf0e10cSrcweir 	mutable bool				mbCmapEncodingRead; // true if cmap encoding of Mac font is read
82cdf0e10cSrcweir 	mutable bool				mbHasCJKSupport; // #i78970# CJK fonts need extra leading
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir // abstracting quartz color instead of having to use an CGFloat[] array
86cdf0e10cSrcweir class RGBAColor
87cdf0e10cSrcweir {
88cdf0e10cSrcweir public:
89cdf0e10cSrcweir 	RGBAColor( SalColor );
90cdf0e10cSrcweir 	RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET
SetAlpha(float fAlpha)9124a22e85SHerbert Dürr 	void SetAlpha( float fAlpha ) { mfRGBA[3] = fAlpha; }
9224a22e85SHerbert Dürr 
IsVisible() const9324a22e85SHerbert Dürr 	bool IsVisible() const        { return (mfRGBA[3] > 0); }
AsArray() const9424a22e85SHerbert Dürr 	const CGFloat* AsArray() const  { return mfRGBA; }
GetRed() const9524a22e85SHerbert Dürr 	CGFloat GetRed() const   { return mfRGBA[0]; }
GetGreen() const9624a22e85SHerbert Dürr 	CGFloat GetGreen() const { return mfRGBA[1]; }
GetBlue() const9724a22e85SHerbert Dürr 	CGFloat GetBlue() const  { return mfRGBA[2]; }
GetAlpha() const9824a22e85SHerbert Dürr 	CGFloat GetAlpha() const { return mfRGBA[3]; }
992dae3561SHerbert Dürr private:
10024a22e85SHerbert Dürr 	CGFloat mfRGBA[4]; // RGBA
101cdf0e10cSrcweir };
102cdf0e10cSrcweir 
1032dae3561SHerbert Dürr // --------------------
1042dae3561SHerbert Dürr // - ImplMacTextStyle -
1052dae3561SHerbert Dürr // --------------------
1062dae3561SHerbert Dürr class ImplMacTextStyle
1072dae3561SHerbert Dürr {
1082dae3561SHerbert Dürr public:
1092dae3561SHerbert Dürr 	explicit		ImplMacTextStyle( const ImplFontSelectData& );
1102dae3561SHerbert Dürr 	virtual			~ImplMacTextStyle( void );
1112dae3561SHerbert Dürr 
1122dae3561SHerbert Dürr 	virtual SalLayout* GetTextLayout( void ) const = 0;
1132dae3561SHerbert Dürr 
1142dae3561SHerbert Dürr 	virtual void	GetFontMetric( float fPDIY, ImplFontMetricData& ) const = 0;
1152dae3561SHerbert Dürr 	virtual bool	GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const = 0;
1162dae3561SHerbert Dürr 	virtual bool	GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const = 0;
1172dae3561SHerbert Dürr 
1182dae3561SHerbert Dürr 	virtual void	SetTextColor( const RGBAColor& ) = 0;
1192dae3561SHerbert Dürr 
1202dae3561SHerbert Dürr //###protected:
1212dae3561SHerbert Dürr 	const ImplMacFontData*	mpFontData;
1222dae3561SHerbert Dürr 	/// workaround to prevent overflows for huge font sizes
1232dae3561SHerbert Dürr 	float				mfFontScale;
1242dae3561SHerbert Dürr 	/// <1.0: font is squeezed, >1.0 font is stretched, else 1.0
1252dae3561SHerbert Dürr 	float				mfFontStretch;
1262dae3561SHerbert Dürr 	/// text rotation in radian
1272dae3561SHerbert Dürr 	float				mfFontRotation;
1282dae3561SHerbert Dürr };
1292dae3561SHerbert Dürr 
1302dae3561SHerbert Dürr // ------------------
1312dae3561SHerbert Dürr // - SystemFontList -
1322dae3561SHerbert Dürr // TODO: move into cross-platform headers
1332dae3561SHerbert Dürr // ------------------
1342dae3561SHerbert Dürr class SystemFontList
1352dae3561SHerbert Dürr {
1362dae3561SHerbert Dürr public:
1372dae3561SHerbert Dürr 	virtual ~SystemFontList( void );
1382dae3561SHerbert Dürr 
1392dae3561SHerbert Dürr 	virtual void	AnnounceFonts( ImplDevFontList& ) const = 0;
1402dae3561SHerbert Dürr 	virtual ImplMacFontData* GetFontDataFromId( sal_IntPtr nFontId ) const = 0;
1412dae3561SHerbert Dürr };
1422dae3561SHerbert Dürr 
143cdf0e10cSrcweir // -------------------
144cdf0e10cSrcweir // - AquaSalGraphics -
145cdf0e10cSrcweir // -------------------
146cdf0e10cSrcweir class AquaSalGraphics : public SalGraphics
147cdf0e10cSrcweir {
148cdf0e10cSrcweir     friend class ATSLayout;
1492dae3561SHerbert Dürr     friend class CTLayout;
150cdf0e10cSrcweir protected:
151cdf0e10cSrcweir     AquaSalFrame*                           mpFrame;
152cdf0e10cSrcweir 	CGLayerRef								mxLayer;	// Quartz graphics layer
153cdf0e10cSrcweir 	CGContextRef		                    mrContext;	// Quartz drawing context
154cdf0e10cSrcweir 	class XorEmulation*						mpXorEmulation;
155cdf0e10cSrcweir     int                                     mnXorMode; // 0: off 1: on 2: invert only
156cdf0e10cSrcweir 	int										mnWidth;
157cdf0e10cSrcweir 	int										mnHeight;
158cdf0e10cSrcweir 	int										mnBitmapDepth;	// zero unless bitmap
159cdf0e10cSrcweir     /// device resolution of this graphics
160cdf0e10cSrcweir     long                                    mnRealDPIX;
161cdf0e10cSrcweir 	long                                    mnRealDPIY;
162cdf0e10cSrcweir 	/// some graphics implementations (e.g. AquaSalInfoPrinter) scale
163cdf0e10cSrcweir 	/// everything down by a factor (see SetupPrinterGraphics for details)
164cdf0e10cSrcweir 	/// so we have to compensate for it with the inverse factor
165cdf0e10cSrcweir     double                                  mfFakeDPIScale;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     /// path representing current clip region
168cdf0e10cSrcweir     CGMutablePathRef                        mxClipPath;
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     /// Drawing colors
171cdf0e10cSrcweir     /// pen color RGBA
172cdf0e10cSrcweir     RGBAColor                               maLineColor;
173cdf0e10cSrcweir     /// brush color RGBA
174cdf0e10cSrcweir     RGBAColor                               maFillColor;
175cdf0e10cSrcweir 
1762dae3561SHerbert Dürr 	// Device Font settings
177cdf0e10cSrcweir  	const ImplMacFontData*                  mpMacFontData;
1782dae3561SHerbert Dürr 	ImplMacTextStyle*                       mpMacTextStyle;
1792dae3561SHerbert Dürr 	RGBAColor                               maTextColor;
1802dae3561SHerbert Dürr 	// allows text to be rendered without antialiasing
1812dae3561SHerbert Dürr 	bool                                    mbNonAntialiasedText;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	// Graphics types
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     /// is this a printer graphics
186cdf0e10cSrcweir 	bool                                    mbPrinter;
187cdf0e10cSrcweir     /// is this a virtual device graphics
188cdf0e10cSrcweir 	bool                                    mbVirDev;
189cdf0e10cSrcweir     /// is this a window graphics
190cdf0e10cSrcweir 	bool                                    mbWindow;
191cdf0e10cSrcweir 
192cdf0e10cSrcweir public:
193cdf0e10cSrcweir     AquaSalGraphics();
194cdf0e10cSrcweir     virtual ~AquaSalGraphics();
195cdf0e10cSrcweir 
IsPenVisible() const196cdf0e10cSrcweir     bool                IsPenVisible() const	{ return maLineColor.IsVisible(); }
IsBrushVisible() const197cdf0e10cSrcweir     bool                IsBrushVisible() const	{ return maFillColor.IsVisible(); }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     void                SetWindowGraphics( AquaSalFrame* pFrame );
200cdf0e10cSrcweir     void                SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale );
201cdf0e10cSrcweir     void                SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     void                initResolution( NSWindow* );
204cdf0e10cSrcweir     void                copyResolution( AquaSalGraphics& );
205cdf0e10cSrcweir     void                updateResolution();
206cdf0e10cSrcweir 
IsWindowGraphics() const207cdf0e10cSrcweir     bool                IsWindowGraphics()      const   { return mbWindow; }
IsPrinterGraphics() const208cdf0e10cSrcweir     bool                IsPrinterGraphics()     const   { return mbPrinter; }
IsVirDevGraphics() const209cdf0e10cSrcweir     bool                IsVirDevGraphics()      const   { return mbVirDev; }
getGraphicsFrame() const210cdf0e10cSrcweir     AquaSalFrame*       getGraphicsFrame() const { return mpFrame; }
setGraphicsFrame(AquaSalFrame * pFrame)211cdf0e10cSrcweir     void                setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     void                ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     bool                CheckContext();
216cdf0e10cSrcweir     void                UpdateWindow( NSRect& ); // delivered in NSView coordinates
217cdf0e10cSrcweir 	void				RefreshRect( const CGRect& );
21838754389SHerbert Dürr #ifndef __x86_64__ // on 64bit OSX NSRect is typedef'ed as CGRect
219cdf0e10cSrcweir 	void				RefreshRect( const NSRect& );
22038754389SHerbert Dürr #endif
221cdf0e10cSrcweir 	void				RefreshRect(float lX, float lY, float lWidth, float lHeight);
222cdf0e10cSrcweir 
223cdf0e10cSrcweir     void                SetState();
224cdf0e10cSrcweir     void                UnsetState();
225cdf0e10cSrcweir     // InvalidateContext does an UnsetState and sets mrContext to 0
226cdf0e10cSrcweir     void                InvalidateContext();
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     virtual bool        setClipRegion( const Region& );
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     // draw --> LineColor and FillColor and RasterOp and ClipRegion
231cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY );
232cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY, SalColor nSalColor );
233cdf0e10cSrcweir     virtual void		drawLine( long nX1, long nY1, long nX2, long nY2 );
234cdf0e10cSrcweir     virtual void		drawRect( long nX, long nY, long nWidth, long nHeight );
23554ae6a37SHerbert Dürr     virtual void		drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry );
23654ae6a37SHerbert Dürr     virtual void		drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
23754ae6a37SHerbert Dürr     virtual void		drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry );
238cdf0e10cSrcweir     virtual bool        drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
23954ae6a37SHerbert Dürr     virtual sal_Bool	drawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
24054ae6a37SHerbert Dürr     virtual sal_Bool	drawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
24154ae6a37SHerbert Dürr     virtual sal_Bool	drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry );
2425aaf853bSArmin Le Grand     virtual bool        drawPolyLine(
2435aaf853bSArmin Le Grand         const ::basegfx::B2DPolygon&,
2445aaf853bSArmin Le Grand         double fTransparency,
2455aaf853bSArmin Le Grand         const ::basegfx::B2DVector& rLineWidths,
2465aaf853bSArmin Le Grand         basegfx::B2DLineJoin,
2475aaf853bSArmin Le Grand         com::sun::star::drawing::LineCap eLineCap);
248cdf0e10cSrcweir 
249cdf0e10cSrcweir     // CopyArea --> No RasterOp, but ClipRegion
250cdf0e10cSrcweir     virtual void		copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
251cdf0e10cSrcweir                                   long nSrcHeight, sal_uInt16 nFlags );
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     // CopyBits and DrawBitmap --> RasterOp and ClipRegion
254cdf0e10cSrcweir     // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
2555f27b83cSArmin Le Grand     virtual void		copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics );
2565f27b83cSArmin Le Grand     virtual void		drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap );
2575f27b83cSArmin Le Grand     virtual void		drawBitmap( const SalTwoRect& rPosAry,
258cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
259cdf0e10cSrcweir                                     SalColor nTransparentColor );
2605f27b83cSArmin Le Grand     virtual void		drawBitmap( const SalTwoRect& rPosAry,
261cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
262cdf0e10cSrcweir                                     const SalBitmap& rTransparentBitmap );
2635f27b83cSArmin Le Grand     virtual void		drawMask( const SalTwoRect& rPosAry,
264cdf0e10cSrcweir                                   const SalBitmap& rSalBitmap,
265cdf0e10cSrcweir                                   SalColor nMaskColor );
266cdf0e10cSrcweir 
267cdf0e10cSrcweir     virtual SalBitmap*	getBitmap( long nX, long nY, long nWidth, long nHeight );
268cdf0e10cSrcweir     virtual SalColor	getPixel( long nX, long nY );
269cdf0e10cSrcweir 
270cdf0e10cSrcweir     // invert --> ClipRegion (only Windows or VirDevs)
271cdf0e10cSrcweir     virtual void		invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags);
27254ae6a37SHerbert Dürr     virtual void		invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags );
273cdf0e10cSrcweir 
274cdf0e10cSrcweir     virtual sal_Bool		drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize );
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     virtual bool 			drawAlphaBitmap( const SalTwoRect&,
277cdf0e10cSrcweir                                              const SalBitmap& rSourceBitmap,
278cdf0e10cSrcweir                                              const SalBitmap& rAlphaBitmap );
2795f27b83cSArmin Le Grand     virtual bool drawTransformedBitmap(
2805f27b83cSArmin Le Grand         const basegfx::B2DPoint& rNull,
2815f27b83cSArmin Le Grand         const basegfx::B2DPoint& rX,
2825f27b83cSArmin Le Grand         const basegfx::B2DPoint& rY,
2835f27b83cSArmin Le Grand         const SalBitmap& rSourceBitmap,
2845f27b83cSArmin Le Grand         const SalBitmap* pAlphaBitmap);
285cdf0e10cSrcweir 
286cdf0e10cSrcweir     virtual bool		    drawAlphaRect( long nX, long nY, long nWidth,
287cdf0e10cSrcweir                                            long nHeight, sal_uInt8 nTransparency );
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     CGPoint*                makeCGptArray(sal_uLong nPoints, const SalPoint*  pPtAry);
290cdf0e10cSrcweir     // native widget rendering methods that require mirroring
291cdf0e10cSrcweir     virtual sal_Bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
292cdf0e10cSrcweir                                               const Point& aPos, sal_Bool& rIsInside );
293cdf0e10cSrcweir     virtual sal_Bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
294cdf0e10cSrcweir                                            ControlState nState, const ImplControlValue& aValue,
295cdf0e10cSrcweir                                            const rtl::OUString& aCaption );
296cdf0e10cSrcweir     virtual sal_Bool        drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
297cdf0e10cSrcweir                                                ControlState nState, const ImplControlValue& aValue,
298cdf0e10cSrcweir                                                const rtl::OUString& aCaption );
299cdf0e10cSrcweir     virtual sal_Bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
300cdf0e10cSrcweir                                                 const ImplControlValue& aValue, const rtl::OUString& aCaption,
301cdf0e10cSrcweir                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     // get device resolution
3048a718ffcSHerbert Dürr     virtual void			GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
305cdf0e10cSrcweir     // get the depth of the device
306cdf0e10cSrcweir     virtual sal_uInt16			GetBitCount();
307cdf0e10cSrcweir     // get the width of the device
308cdf0e10cSrcweir     virtual long			GetGraphicsWidth() const;
309cdf0e10cSrcweir 
310cdf0e10cSrcweir     // set the clip region to empty
311cdf0e10cSrcweir     virtual void			ResetClipRegion();
312cdf0e10cSrcweir 
313cdf0e10cSrcweir     // set the line color to transparent (= don't draw lines)
314cdf0e10cSrcweir     virtual void			SetLineColor();
315cdf0e10cSrcweir     // set the line color to a specific color
316cdf0e10cSrcweir     virtual void			SetLineColor( SalColor nSalColor );
317cdf0e10cSrcweir     // set the fill color to transparent (= don't fill)
318cdf0e10cSrcweir     virtual void			SetFillColor();
319cdf0e10cSrcweir     // set the fill color to a specific color, shapes will be
320cdf0e10cSrcweir     // filled accordingly
321cdf0e10cSrcweir     virtual void          	SetFillColor( SalColor nSalColor );
322cdf0e10cSrcweir     // enable/disable XOR drawing
323cdf0e10cSrcweir     virtual void			SetXORMode( bool bSet, bool bInvertOnly );
324cdf0e10cSrcweir     // set line color for raster operations
325cdf0e10cSrcweir     virtual void			SetROPLineColor( SalROPColor nROPColor );
326cdf0e10cSrcweir     // set fill color for raster operations
327cdf0e10cSrcweir     virtual void			SetROPFillColor( SalROPColor nROPColor );
328cdf0e10cSrcweir     // set the text color to a specific color
329cdf0e10cSrcweir     virtual void			SetTextColor( SalColor nSalColor );
330cdf0e10cSrcweir     // set the font
331cdf0e10cSrcweir     virtual sal_uInt16         SetFont( ImplFontSelectData*, int nFallbackLevel );
332cdf0e10cSrcweir     // get the current font's etrics
333cdf0e10cSrcweir     virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
334cdf0e10cSrcweir     // get kernign pairs of the current font
335cdf0e10cSrcweir     // return only PairCount if (pKernPairs == NULL)
336cdf0e10cSrcweir     virtual sal_uLong			GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
337cdf0e10cSrcweir     // get the repertoire of the current font
338cdf0e10cSrcweir     virtual const ImplFontCharMap* GetImplFontCharMap() const;
339cdf0e10cSrcweir     // graphics must fill supplied font list
340cdf0e10cSrcweir     virtual void			GetDevFontList( ImplDevFontList* );
341cdf0e10cSrcweir     // graphics should call ImplAddDevFontSubstitute on supplied
342cdf0e10cSrcweir     // OutputDevice for all its device specific preferred font substitutions
343cdf0e10cSrcweir     virtual void			GetDevFontSubstList( OutputDevice* );
344cdf0e10cSrcweir     virtual bool			AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
345cdf0e10cSrcweir     // CreateFontSubset: a method to get a subset of glyhps of a font
346cdf0e10cSrcweir     // inside a new valid font file
347*86e1cf34SPedro Giffuni     // returns TRUE if creation of subset was successful
348cdf0e10cSrcweir     // parameters: rToFile: contains a osl file URL to write the subset to
349cdf0e10cSrcweir     //             pFont: describes from which font to create a subset
350cdf0e10cSrcweir     //             pGlyphIDs: the glyph ids to be extracted
351cdf0e10cSrcweir     //             pEncoding: the character code corresponding to each glyph
352cdf0e10cSrcweir     //             pWidths: the advance widths of the correspoding glyphs (in PS font units)
353cdf0e10cSrcweir     //             nGlyphs: the number of glyphs
354cdf0e10cSrcweir     //             rInfo: additional outgoing information
355cdf0e10cSrcweir     // implementation note: encoding 0 with glyph id 0 should be added implicitly
356cdf0e10cSrcweir     // as "undefined character"
357cdf0e10cSrcweir     virtual sal_Bool			CreateFontSubset( const rtl::OUString& rToFile,
358cdf0e10cSrcweir                                               const ImplFontData* pFont,
359248a599fSHerbert Dürr                                               sal_GlyphId* pGlyphIds,
360cdf0e10cSrcweir                                               sal_uInt8* pEncoding,
361cdf0e10cSrcweir                                               sal_Int32* pWidths,
362cdf0e10cSrcweir                                               int nGlyphs,
363cdf0e10cSrcweir                                               FontSubsetInfo& rInfo // out parameter
364cdf0e10cSrcweir                                               );
365cdf0e10cSrcweir 
366cdf0e10cSrcweir     // GetFontEncodingVector: a method to get the encoding map Unicode
367cdf0e10cSrcweir 	// to font encoded character; this is only used for type1 fonts and
368cdf0e10cSrcweir     // may return NULL in case of unknown encoding vector
369cdf0e10cSrcweir     // if ppNonEncoded is set and non encoded characters (that is type1
370cdf0e10cSrcweir     // glyphs with only a name) exist it is set to the corresponding
371cdf0e10cSrcweir     // map for non encoded glyphs; the encoding vector contains -1
372cdf0e10cSrcweir     // as encoding for these cases
373cdf0e10cSrcweir     virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
374cdf0e10cSrcweir 
375cdf0e10cSrcweir     // GetEmbedFontData: gets the font data for a font marked
376cdf0e10cSrcweir     // embeddable by GetDevFontList or NULL in case of error
377cdf0e10cSrcweir     // parameters: pFont: describes the font in question
378cdf0e10cSrcweir     //             pWidths: the widths of all glyphs from char code 0 to 255
379cdf0e10cSrcweir     //                      pWidths MUST support at least 256 members;
380cdf0e10cSrcweir     //             rInfo: additional outgoing information
381cdf0e10cSrcweir     //             pDataLen: out parameter, contains the byte length of the returned buffer
382cdf0e10cSrcweir     virtual const void*	GetEmbedFontData( const ImplFontData*,
383cdf0e10cSrcweir                                           const sal_Ucs* pUnicodes,
384cdf0e10cSrcweir                                           sal_Int32* pWidths,
385cdf0e10cSrcweir                                           FontSubsetInfo& rInfo,
386cdf0e10cSrcweir                                           long* pDataLen );
387cdf0e10cSrcweir     // frees the font data again
388cdf0e10cSrcweir     virtual void			FreeEmbedFontData( const void* pData, long nDataLen );
389cdf0e10cSrcweir 
390cdf0e10cSrcweir     virtual void            GetGlyphWidths( const ImplFontData*,
391cdf0e10cSrcweir                                             bool bVertical,
392cdf0e10cSrcweir                                             Int32Vector& rWidths,
393cdf0e10cSrcweir                                             Ucs2UIntMap& rUnicodeEnc );
394cdf0e10cSrcweir 
395248a599fSHerbert Dürr     virtual bool                    GetGlyphBoundRect( sal_GlyphId, Rectangle& );
396248a599fSHerbert Dürr     virtual bool                    GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& );
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     virtual SalLayout*              GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
399cdf0e10cSrcweir     virtual void					 DrawServerFontLayout( const ServerFontLayout& );
400cdf0e10cSrcweir     virtual bool                    supportsOperation( OutDevSupportType ) const;
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     // Query the platform layer for control support
403cdf0e10cSrcweir     virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart );
404cdf0e10cSrcweir 
405cdf0e10cSrcweir     virtual SystemGraphicsData    GetGraphicsData() const;
406cdf0e10cSrcweir     virtual SystemFontData        GetSysFontData( int /* nFallbacklevel */ ) const;
407cdf0e10cSrcweir 
408cdf0e10cSrcweir private:
409cdf0e10cSrcweir     // differences between VCL, Quartz and kHiThemeOrientation coordinate systems
410cdf0e10cSrcweir     // make some graphics seem to be vertically-mirrored from a VCL perspective
IsFlipped() const411cdf0e10cSrcweir     bool IsFlipped() const { return mbWindow; }
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	void ApplyXorContext();
414cdf0e10cSrcweir     void Pattern50Fill();
415cdf0e10cSrcweir     UInt32 getState( ControlState nState );
416cdf0e10cSrcweir     UInt32 getTrackState( ControlState nState );
417cdf0e10cSrcweir };
418cdf0e10cSrcweir 
419cdf0e10cSrcweir class XorEmulation
420cdf0e10cSrcweir {
421cdf0e10cSrcweir public:
422cdf0e10cSrcweir 					XorEmulation();
423cdf0e10cSrcweir 	/*final*/		~XorEmulation();
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 	void			SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef );
426cdf0e10cSrcweir 	bool			UpdateTarget();
Enable()427cdf0e10cSrcweir 	void			Enable()			{ mbIsEnabled = true; }
Disable()428cdf0e10cSrcweir 	void			Disable()			{ mbIsEnabled = false; }
IsEnabled() const429cdf0e10cSrcweir 	bool 			IsEnabled() const	{ return mbIsEnabled; }
GetTargetContext() const430cdf0e10cSrcweir 	CGContextRef	GetTargetContext() const { return mxTargetContext; }
GetMaskContext() const431cdf0e10cSrcweir 	CGContextRef	GetMaskContext() const { return (mbIsEnabled ? mxMaskContext : NULL); }
432cdf0e10cSrcweir 
433cdf0e10cSrcweir private:
434cdf0e10cSrcweir 	CGLayerRef		mxTargetLayer;
435cdf0e10cSrcweir 	CGContextRef	mxTargetContext;
436cdf0e10cSrcweir 	CGContextRef	mxMaskContext;
437cdf0e10cSrcweir 	CGContextRef	mxTempContext;
438cdf0e10cSrcweir 	sal_uLong*			mpMaskBuffer;
439cdf0e10cSrcweir 	sal_uLong*			mpTempBuffer;
440cdf0e10cSrcweir 	int				mnBufferLongs;
441cdf0e10cSrcweir 	bool			mbIsEnabled;
442cdf0e10cSrcweir };
443cdf0e10cSrcweir 
444cdf0e10cSrcweir 
445cdf0e10cSrcweir // --- some trivial inlines
446cdf0e10cSrcweir 
RefreshRect(const CGRect & rRect)447cdf0e10cSrcweir inline void AquaSalGraphics::RefreshRect( const CGRect& rRect )
448cdf0e10cSrcweir {
449cdf0e10cSrcweir 	RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
450cdf0e10cSrcweir }
451cdf0e10cSrcweir 
45238754389SHerbert Dürr #ifndef __x86_64__ // on 64bit OSX NSRect is typedef'ed as CGRect
RefreshRect(const NSRect & rRect)453cdf0e10cSrcweir inline void AquaSalGraphics::RefreshRect( const NSRect& rRect )
454cdf0e10cSrcweir {
455cdf0e10cSrcweir 	RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
456cdf0e10cSrcweir }
45738754389SHerbert Dürr #endif
458cdf0e10cSrcweir 
RGBAColor(SalColor nSalColor)459cdf0e10cSrcweir inline RGBAColor::RGBAColor( SalColor nSalColor )
46024a22e85SHerbert Dürr {
46124a22e85SHerbert Dürr 	mfRGBA[0] = SALCOLOR_RED(  nSalColor) * (1.0/255);
46224a22e85SHerbert Dürr 	mfRGBA[1] = SALCOLOR_GREEN(nSalColor) * (1.0/255);
46324a22e85SHerbert Dürr 	mfRGBA[2] = SALCOLOR_BLUE( nSalColor) * (1.0/255);
46424a22e85SHerbert Dürr 	mfRGBA[3] = 1.0; // default to opaque
46524a22e85SHerbert Dürr }
466cdf0e10cSrcweir 
RGBAColor(float fRed,float fGreen,float fBlue,float fAlpha)467cdf0e10cSrcweir inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha )
46824a22e85SHerbert Dürr {
46924a22e85SHerbert Dürr 	mfRGBA[0] = fRed;
47024a22e85SHerbert Dürr 	mfRGBA[1] = fGreen;
47124a22e85SHerbert Dürr 	mfRGBA[2] = fBlue;
47224a22e85SHerbert Dürr 	mfRGBA[3] = fAlpha;
47324a22e85SHerbert Dürr }
474cdf0e10cSrcweir 
475cdf0e10cSrcweir #endif // _SV_SALGDI_H
47624a22e85SHerbert Dürr 
477