xref: /aoo42x/main/vcl/inc/aqua/salgdi.h (revision 24f6443d)
1*24f6443dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*24f6443dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*24f6443dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*24f6443dSAndrew Rist  * distributed with this work for additional information
6*24f6443dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*24f6443dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*24f6443dSAndrew Rist  * "License"); you may not use this file except in compliance
9*24f6443dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*24f6443dSAndrew Rist  *
11*24f6443dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*24f6443dSAndrew Rist  *
13*24f6443dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*24f6443dSAndrew Rist  * software distributed under the License is distributed on an
15*24f6443dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*24f6443dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*24f6443dSAndrew Rist  * specific language governing permissions and limitations
18*24f6443dSAndrew Rist  * under the License.
19*24f6443dSAndrew Rist  *
20*24f6443dSAndrew Rist  *************************************************************/
21*24f6443dSAndrew Rist 
22*24f6443dSAndrew 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;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir class CGRect;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // mac specific physically available font face
47cdf0e10cSrcweir class ImplMacFontData : public ImplFontData
48cdf0e10cSrcweir {
49cdf0e10cSrcweir public:
50cdf0e10cSrcweir 	ImplMacFontData( const ImplDevFontAttributes&, ATSUFontID );
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     virtual ~ImplMacFontData();
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     virtual ImplFontData*   Clone() const;
55cdf0e10cSrcweir     virtual ImplFontEntry*  CreateFontInstance( ImplFontSelectData& ) const;
56cdf0e10cSrcweir 	virtual sal_IntPtr      GetFontId() const;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     const ImplFontCharMap*	GetImplFontCharMap() const;
59cdf0e10cSrcweir 	bool					HasChar( sal_uInt32 cChar ) const;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	void					ReadOs2Table() const;
62cdf0e10cSrcweir 	void					ReadMacCmapEncoding() const;
63cdf0e10cSrcweir 	bool					HasCJKSupport() const;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir private:
66cdf0e10cSrcweir     const ATSUFontID			mnFontId;
67cdf0e10cSrcweir 	mutable const ImplFontCharMap*	mpCharMap;
68cdf0e10cSrcweir 	mutable bool				mbOs2Read;		 // true if OS2-table related info is valid
69cdf0e10cSrcweir 	mutable bool				mbHasOs2Table;
70cdf0e10cSrcweir 	mutable bool				mbCmapEncodingRead; // true if cmap encoding of Mac font is read
71cdf0e10cSrcweir 	mutable bool				mbHasCJKSupport; // #i78970# CJK fonts need extra leading
72cdf0e10cSrcweir };
73cdf0e10cSrcweir 
74cdf0e10cSrcweir // abstracting quartz color instead of having to use an CGFloat[] array
75cdf0e10cSrcweir class RGBAColor
76cdf0e10cSrcweir {
77cdf0e10cSrcweir public:
78cdf0e10cSrcweir 	RGBAColor( SalColor );
79cdf0e10cSrcweir 	RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET
80cdf0e10cSrcweir 	const float* AsArray() const	{ return &mfRed; }
81cdf0e10cSrcweir 	bool IsVisible() const			{ return (mfAlpha > 0); }
82cdf0e10cSrcweir 	void SetAlpha( float fAlpha )	{ mfAlpha = fAlpha; }
83cdf0e10cSrcweir private:
84cdf0e10cSrcweir 	float mfRed, mfGreen, mfBlue, mfAlpha;
85cdf0e10cSrcweir };
86cdf0e10cSrcweir 
87cdf0e10cSrcweir // -------------------
88cdf0e10cSrcweir // - AquaSalGraphics -
89cdf0e10cSrcweir // -------------------
90cdf0e10cSrcweir class AquaSalGraphics : public SalGraphics
91cdf0e10cSrcweir {
92cdf0e10cSrcweir     friend class ATSLayout;
93cdf0e10cSrcweir protected:
94cdf0e10cSrcweir     AquaSalFrame*                           mpFrame;
95cdf0e10cSrcweir 	CGLayerRef								mxLayer;	// Quartz graphics layer
96cdf0e10cSrcweir 	CGContextRef		                    mrContext;	// Quartz drawing context
97cdf0e10cSrcweir 	class XorEmulation*						mpXorEmulation;
98cdf0e10cSrcweir     int                                     mnXorMode; // 0: off 1: on 2: invert only
99cdf0e10cSrcweir 	int										mnWidth;
100cdf0e10cSrcweir 	int										mnHeight;
101cdf0e10cSrcweir 	int										mnBitmapDepth;	// zero unless bitmap
102cdf0e10cSrcweir     /// device resolution of this graphics
103cdf0e10cSrcweir     long                                    mnRealDPIX;
104cdf0e10cSrcweir 	long                                    mnRealDPIY;
105cdf0e10cSrcweir 	/// some graphics implementations (e.g. AquaSalInfoPrinter) scale
106cdf0e10cSrcweir 	/// everything down by a factor (see SetupPrinterGraphics for details)
107cdf0e10cSrcweir 	/// so we have to compensate for it with the inverse factor
108cdf0e10cSrcweir     double                                  mfFakeDPIScale;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     /// path representing current clip region
111cdf0e10cSrcweir     CGMutablePathRef                        mxClipPath;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     /// Drawing colors
114cdf0e10cSrcweir     /// pen color RGBA
115cdf0e10cSrcweir     RGBAColor                               maLineColor;
116cdf0e10cSrcweir     /// brush color RGBA
117cdf0e10cSrcweir     RGBAColor                               maFillColor;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     // Device Font settings
120cdf0e10cSrcweir  	const ImplMacFontData*                  mpMacFontData;
121cdf0e10cSrcweir     /// ATSU style object which carries all font attributes
122cdf0e10cSrcweir     ATSUStyle			                    maATSUStyle;
123cdf0e10cSrcweir     /// text rotation as ATSU angle
124cdf0e10cSrcweir     Fixed                                   mnATSUIRotation;
125cdf0e10cSrcweir     /// workaround to prevent ATSU overflows for huge font sizes
126cdf0e10cSrcweir     float                                   mfFontScale;
127cdf0e10cSrcweir     /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0
128cdf0e10cSrcweir     float                                   mfFontStretch;
129cdf0e10cSrcweir     /// allows text to be rendered without antialiasing
130cdf0e10cSrcweir     bool                                    mbNonAntialiasedText;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	// Graphics types
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     /// is this a printer graphics
135cdf0e10cSrcweir 	bool                                    mbPrinter;
136cdf0e10cSrcweir     /// is this a virtual device graphics
137cdf0e10cSrcweir 	bool                                    mbVirDev;
138cdf0e10cSrcweir     /// is this a window graphics
139cdf0e10cSrcweir 	bool                                    mbWindow;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir public:
142cdf0e10cSrcweir     AquaSalGraphics();
143cdf0e10cSrcweir     virtual ~AquaSalGraphics();
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     bool                IsPenVisible() const	{ return maLineColor.IsVisible(); }
146cdf0e10cSrcweir     bool                IsBrushVisible() const	{ return maFillColor.IsVisible(); }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     void                SetWindowGraphics( AquaSalFrame* pFrame );
149cdf0e10cSrcweir     void                SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale );
150cdf0e10cSrcweir     void                SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     void                initResolution( NSWindow* );
153cdf0e10cSrcweir     void                copyResolution( AquaSalGraphics& );
154cdf0e10cSrcweir     void                updateResolution();
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     bool                IsWindowGraphics()      const   { return mbWindow; }
157cdf0e10cSrcweir     bool                IsPrinterGraphics()     const   { return mbPrinter; }
158cdf0e10cSrcweir     bool                IsVirDevGraphics()      const   { return mbVirDev; }
159cdf0e10cSrcweir     AquaSalFrame*       getGraphicsFrame() const { return mpFrame; }
160cdf0e10cSrcweir     void                setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     void                ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     bool                CheckContext();
165cdf0e10cSrcweir     void                UpdateWindow( NSRect& ); // delivered in NSView coordinates
166cdf0e10cSrcweir 	void				RefreshRect( const CGRect& );
167cdf0e10cSrcweir 	void				RefreshRect( const NSRect& );
168cdf0e10cSrcweir 	void				RefreshRect(float lX, float lY, float lWidth, float lHeight);
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     void                SetState();
171cdf0e10cSrcweir     void                UnsetState();
172cdf0e10cSrcweir     // InvalidateContext does an UnsetState and sets mrContext to 0
173cdf0e10cSrcweir     void                InvalidateContext();
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     virtual bool        setClipRegion( const Region& );
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     // draw --> LineColor and FillColor and RasterOp and ClipRegion
178cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY );
179cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY, SalColor nSalColor );
180cdf0e10cSrcweir     virtual void		drawLine( long nX1, long nY1, long nX2, long nY2 );
181cdf0e10cSrcweir     virtual void		drawRect( long nX, long nY, long nWidth, long nHeight );
182cdf0e10cSrcweir     virtual void		drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
183cdf0e10cSrcweir     virtual void		drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
184cdf0e10cSrcweir     virtual void		drawPolyPolygon( sal_uLong nPoly, const sal_uLong* pPoints, PCONSTSALPOINT* pPtAry );
185cdf0e10cSrcweir     virtual bool        drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
186cdf0e10cSrcweir     virtual sal_Bool	drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
187cdf0e10cSrcweir     virtual sal_Bool	drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
188cdf0e10cSrcweir     virtual sal_Bool	drawPolyPolygonBezier( sal_uLong nPoly, const sal_uLong* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry );
189cdf0e10cSrcweir     virtual bool        drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     // CopyArea --> No RasterOp, but ClipRegion
192cdf0e10cSrcweir     virtual void		copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
193cdf0e10cSrcweir                                   long nSrcHeight, sal_uInt16 nFlags );
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     // CopyBits and DrawBitmap --> RasterOp and ClipRegion
196cdf0e10cSrcweir     // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
197cdf0e10cSrcweir     virtual void		copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics );
198cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap );
199cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry,
200cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
201cdf0e10cSrcweir                                     SalColor nTransparentColor );
202cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry,
203cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
204cdf0e10cSrcweir                                     const SalBitmap& rTransparentBitmap );
205cdf0e10cSrcweir     virtual void		drawMask( const SalTwoRect* pPosAry,
206cdf0e10cSrcweir                                   const SalBitmap& rSalBitmap,
207cdf0e10cSrcweir                                   SalColor nMaskColor );
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     virtual SalBitmap*	getBitmap( long nX, long nY, long nWidth, long nHeight );
210cdf0e10cSrcweir     virtual SalColor	getPixel( long nX, long nY );
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     // invert --> ClipRegion (only Windows or VirDevs)
213cdf0e10cSrcweir     virtual void		invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags);
214cdf0e10cSrcweir     virtual void		invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags );
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     virtual sal_Bool		drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize );
217cdf0e10cSrcweir 
218cdf0e10cSrcweir     virtual bool 			drawAlphaBitmap( const SalTwoRect&,
219cdf0e10cSrcweir                                              const SalBitmap& rSourceBitmap,
220cdf0e10cSrcweir                                              const SalBitmap& rAlphaBitmap );
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     virtual bool		    drawAlphaRect( long nX, long nY, long nWidth,
223cdf0e10cSrcweir                                            long nHeight, sal_uInt8 nTransparency );
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     CGPoint*                makeCGptArray(sal_uLong nPoints, const SalPoint*  pPtAry);
226cdf0e10cSrcweir     // native widget rendering methods that require mirroring
227cdf0e10cSrcweir     virtual sal_Bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
228cdf0e10cSrcweir                                               const Point& aPos, sal_Bool& rIsInside );
229cdf0e10cSrcweir     virtual sal_Bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
230cdf0e10cSrcweir                                            ControlState nState, const ImplControlValue& aValue,
231cdf0e10cSrcweir                                            const rtl::OUString& aCaption );
232cdf0e10cSrcweir     virtual sal_Bool        drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
233cdf0e10cSrcweir                                                ControlState nState, const ImplControlValue& aValue,
234cdf0e10cSrcweir                                                const rtl::OUString& aCaption );
235cdf0e10cSrcweir     virtual sal_Bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
236cdf0e10cSrcweir                                                 const ImplControlValue& aValue, const rtl::OUString& aCaption,
237cdf0e10cSrcweir                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     // get device resolution
240cdf0e10cSrcweir     virtual void			GetResolution( long& rDPIX, long& rDPIY );
241cdf0e10cSrcweir     // get the depth of the device
242cdf0e10cSrcweir     virtual sal_uInt16			GetBitCount();
243cdf0e10cSrcweir     // get the width of the device
244cdf0e10cSrcweir     virtual long			GetGraphicsWidth() const;
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     // set the clip region to empty
247cdf0e10cSrcweir     virtual void			ResetClipRegion();
248cdf0e10cSrcweir 
249cdf0e10cSrcweir     // set the line color to transparent (= don't draw lines)
250cdf0e10cSrcweir     virtual void			SetLineColor();
251cdf0e10cSrcweir     // set the line color to a specific color
252cdf0e10cSrcweir     virtual void			SetLineColor( SalColor nSalColor );
253cdf0e10cSrcweir     // set the fill color to transparent (= don't fill)
254cdf0e10cSrcweir     virtual void			SetFillColor();
255cdf0e10cSrcweir     // set the fill color to a specific color, shapes will be
256cdf0e10cSrcweir     // filled accordingly
257cdf0e10cSrcweir     virtual void          	SetFillColor( SalColor nSalColor );
258cdf0e10cSrcweir     // enable/disable XOR drawing
259cdf0e10cSrcweir     virtual void			SetXORMode( bool bSet, bool bInvertOnly );
260cdf0e10cSrcweir     // set line color for raster operations
261cdf0e10cSrcweir     virtual void			SetROPLineColor( SalROPColor nROPColor );
262cdf0e10cSrcweir     // set fill color for raster operations
263cdf0e10cSrcweir     virtual void			SetROPFillColor( SalROPColor nROPColor );
264cdf0e10cSrcweir     // set the text color to a specific color
265cdf0e10cSrcweir     virtual void			SetTextColor( SalColor nSalColor );
266cdf0e10cSrcweir     // set the font
267cdf0e10cSrcweir     virtual sal_uInt16         SetFont( ImplFontSelectData*, int nFallbackLevel );
268cdf0e10cSrcweir     // get the current font's etrics
269cdf0e10cSrcweir     virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
270cdf0e10cSrcweir     // get kernign pairs of the current font
271cdf0e10cSrcweir     // return only PairCount if (pKernPairs == NULL)
272cdf0e10cSrcweir     virtual sal_uLong			GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
273cdf0e10cSrcweir     // get the repertoire of the current font
274cdf0e10cSrcweir     virtual const ImplFontCharMap* GetImplFontCharMap() const;
275cdf0e10cSrcweir     // graphics must fill supplied font list
276cdf0e10cSrcweir     virtual void			GetDevFontList( ImplDevFontList* );
277cdf0e10cSrcweir     // graphics should call ImplAddDevFontSubstitute on supplied
278cdf0e10cSrcweir     // OutputDevice for all its device specific preferred font substitutions
279cdf0e10cSrcweir     virtual void			GetDevFontSubstList( OutputDevice* );
280cdf0e10cSrcweir     virtual bool			AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
281cdf0e10cSrcweir     // CreateFontSubset: a method to get a subset of glyhps of a font
282cdf0e10cSrcweir     // inside a new valid font file
283cdf0e10cSrcweir     // returns TRUE if creation of subset was successfull
284cdf0e10cSrcweir     // parameters: rToFile: contains a osl file URL to write the subset to
285cdf0e10cSrcweir     //             pFont: describes from which font to create a subset
286cdf0e10cSrcweir     //             pGlyphIDs: the glyph ids to be extracted
287cdf0e10cSrcweir     //             pEncoding: the character code corresponding to each glyph
288cdf0e10cSrcweir     //             pWidths: the advance widths of the correspoding glyphs (in PS font units)
289cdf0e10cSrcweir     //             nGlyphs: the number of glyphs
290cdf0e10cSrcweir     //             rInfo: additional outgoing information
291cdf0e10cSrcweir     // implementation note: encoding 0 with glyph id 0 should be added implicitly
292cdf0e10cSrcweir     // as "undefined character"
293cdf0e10cSrcweir     virtual sal_Bool			CreateFontSubset( const rtl::OUString& rToFile,
294cdf0e10cSrcweir                                               const ImplFontData* pFont,
295cdf0e10cSrcweir                                               long* pGlyphIDs,
296cdf0e10cSrcweir                                               sal_uInt8* pEncoding,
297cdf0e10cSrcweir                                               sal_Int32* pWidths,
298cdf0e10cSrcweir                                               int nGlyphs,
299cdf0e10cSrcweir                                               FontSubsetInfo& rInfo // out parameter
300cdf0e10cSrcweir                                               );
301cdf0e10cSrcweir 
302cdf0e10cSrcweir     // GetFontEncodingVector: a method to get the encoding map Unicode
303cdf0e10cSrcweir 	// to font encoded character; this is only used for type1 fonts and
304cdf0e10cSrcweir     // may return NULL in case of unknown encoding vector
305cdf0e10cSrcweir     // if ppNonEncoded is set and non encoded characters (that is type1
306cdf0e10cSrcweir     // glyphs with only a name) exist it is set to the corresponding
307cdf0e10cSrcweir     // map for non encoded glyphs; the encoding vector contains -1
308cdf0e10cSrcweir     // as encoding for these cases
309cdf0e10cSrcweir     virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
310cdf0e10cSrcweir 
311cdf0e10cSrcweir     // GetEmbedFontData: gets the font data for a font marked
312cdf0e10cSrcweir     // embeddable by GetDevFontList or NULL in case of error
313cdf0e10cSrcweir     // parameters: pFont: describes the font in question
314cdf0e10cSrcweir     //             pWidths: the widths of all glyphs from char code 0 to 255
315cdf0e10cSrcweir     //                      pWidths MUST support at least 256 members;
316cdf0e10cSrcweir     //             rInfo: additional outgoing information
317cdf0e10cSrcweir     //             pDataLen: out parameter, contains the byte length of the returned buffer
318cdf0e10cSrcweir     virtual const void*	GetEmbedFontData( const ImplFontData*,
319cdf0e10cSrcweir                                           const sal_Ucs* pUnicodes,
320cdf0e10cSrcweir                                           sal_Int32* pWidths,
321cdf0e10cSrcweir                                           FontSubsetInfo& rInfo,
322cdf0e10cSrcweir                                           long* pDataLen );
323cdf0e10cSrcweir     // frees the font data again
324cdf0e10cSrcweir     virtual void			FreeEmbedFontData( const void* pData, long nDataLen );
325cdf0e10cSrcweir 
326cdf0e10cSrcweir     virtual void            GetGlyphWidths( const ImplFontData*,
327cdf0e10cSrcweir                                             bool bVertical,
328cdf0e10cSrcweir                                             Int32Vector& rWidths,
329cdf0e10cSrcweir                                             Ucs2UIntMap& rUnicodeEnc );
330cdf0e10cSrcweir 
331cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphBoundRect( long nIndex, Rectangle& );
332cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& );
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     virtual SalLayout*              GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
335cdf0e10cSrcweir     virtual void					 DrawServerFontLayout( const ServerFontLayout& );
336cdf0e10cSrcweir     virtual bool                    supportsOperation( OutDevSupportType ) const;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir     // Query the platform layer for control support
339cdf0e10cSrcweir     virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart );
340cdf0e10cSrcweir 
341cdf0e10cSrcweir     virtual SystemGraphicsData    GetGraphicsData() const;
342cdf0e10cSrcweir     virtual SystemFontData        GetSysFontData( int /* nFallbacklevel */ ) const;
343cdf0e10cSrcweir 
344cdf0e10cSrcweir private:
345cdf0e10cSrcweir     // differences between VCL, Quartz and kHiThemeOrientation coordinate systems
346cdf0e10cSrcweir     // make some graphics seem to be vertically-mirrored from a VCL perspective
347cdf0e10cSrcweir     bool IsFlipped() const { return mbWindow; }
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 	void ApplyXorContext();
350cdf0e10cSrcweir     void Pattern50Fill();
351cdf0e10cSrcweir     UInt32 getState( ControlState nState );
352cdf0e10cSrcweir     UInt32 getTrackState( ControlState nState );
353cdf0e10cSrcweir };
354cdf0e10cSrcweir 
355cdf0e10cSrcweir class XorEmulation
356cdf0e10cSrcweir {
357cdf0e10cSrcweir public:
358cdf0e10cSrcweir 					XorEmulation();
359cdf0e10cSrcweir 	/*final*/		~XorEmulation();
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 	void			SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef );
362cdf0e10cSrcweir 	bool			UpdateTarget();
363cdf0e10cSrcweir 	void			Enable()			{ mbIsEnabled = true; }
364cdf0e10cSrcweir 	void			Disable()			{ mbIsEnabled = false; }
365cdf0e10cSrcweir 	bool 			IsEnabled() const	{ return mbIsEnabled; }
366cdf0e10cSrcweir 	CGContextRef	GetTargetContext() const { return mxTargetContext; }
367cdf0e10cSrcweir 	CGContextRef	GetMaskContext() const { return (mbIsEnabled ? mxMaskContext : NULL); }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir private:
370cdf0e10cSrcweir 	CGLayerRef		mxTargetLayer;
371cdf0e10cSrcweir 	CGContextRef	mxTargetContext;
372cdf0e10cSrcweir 	CGContextRef	mxMaskContext;
373cdf0e10cSrcweir 	CGContextRef	mxTempContext;
374cdf0e10cSrcweir 	sal_uLong*			mpMaskBuffer;
375cdf0e10cSrcweir 	sal_uLong*			mpTempBuffer;
376cdf0e10cSrcweir 	int				mnBufferLongs;
377cdf0e10cSrcweir 	bool			mbIsEnabled;
378cdf0e10cSrcweir };
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 
381cdf0e10cSrcweir // --- some trivial inlines
382cdf0e10cSrcweir 
383cdf0e10cSrcweir inline void AquaSalGraphics::RefreshRect( const CGRect& rRect )
384cdf0e10cSrcweir {
385cdf0e10cSrcweir 	RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
386cdf0e10cSrcweir }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir inline void AquaSalGraphics::RefreshRect( const NSRect& rRect )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir 	RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
391cdf0e10cSrcweir }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir inline RGBAColor::RGBAColor( SalColor nSalColor )
394cdf0e10cSrcweir :	mfRed( SALCOLOR_RED(nSalColor) * (1.0/255))
395cdf0e10cSrcweir ,	mfGreen( SALCOLOR_GREEN(nSalColor) * (1.0/255))
396cdf0e10cSrcweir ,	mfBlue( SALCOLOR_BLUE(nSalColor) * (1.0/255))
397cdf0e10cSrcweir ,	mfAlpha( 1.0 )	// opaque
398cdf0e10cSrcweir {}
399cdf0e10cSrcweir 
400cdf0e10cSrcweir inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha )
401cdf0e10cSrcweir :	mfRed( fRed )
402cdf0e10cSrcweir ,	mfGreen( fGreen )
403cdf0e10cSrcweir ,	mfBlue( fBlue )
404cdf0e10cSrcweir ,	mfAlpha( fAlpha )
405cdf0e10cSrcweir {}
406cdf0e10cSrcweir 
407cdf0e10cSrcweir #endif // _SV_SALGDI_H
408