1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_QUARTZ_SALGDICOMMON_HXX
21 #define INCLUDED_VCL_INC_QUARTZ_SALGDICOMMON_HXX
25 #include <CoreGraphics/CoreGraphics.h>
27 #include <ApplicationServices/ApplicationServices.h>
31 #include <vcl/salgtype.hxx>
33 // abstracting quartz color instead of having to use an CGFloat[] array
37 RGBAColor( SalColor
);
38 RGBAColor( float fRed
, float fGreen
, float fBlue
, float fAlpha
); //NOTUSEDYET
39 const CGFloat
* AsArray() const { return m_fRGBA
; }
40 bool IsVisible() const { return m_fRGBA
[3] > 0; }
41 void SetAlpha( float fAlpha
) { m_fRGBA
[3] = fAlpha
; }
43 CGFloat
GetRed() const { return m_fRGBA
[0]; }
44 CGFloat
GetGreen() const { return m_fRGBA
[1]; }
45 CGFloat
GetBlue() const { return m_fRGBA
[2]; }
46 CGFloat
GetAlpha() const { return m_fRGBA
[3]; }
48 CGFloat m_fRGBA
[4]; // red, green, blue, alpha
51 inline RGBAColor::RGBAColor( SalColor nSalColor
)
53 m_fRGBA
[0] = SALCOLOR_RED(nSalColor
) * (1.0/255);
54 m_fRGBA
[1] = SALCOLOR_GREEN(nSalColor
) * (1.0/255);
55 m_fRGBA
[2] = SALCOLOR_BLUE(nSalColor
) * (1.0/255);
56 m_fRGBA
[3] = 1.0; // opaque
59 inline RGBAColor::RGBAColor( float fRed
, float fGreen
, float fBlue
, float fAlpha
)
73 void SetTarget( int nWidth
, int nHeight
, int nBitmapDepth
, CGContextRef
, CGLayerRef
);
75 void Enable() { m_bIsEnabled
= true; }
76 void Disable() { m_bIsEnabled
= false; }
77 bool IsEnabled() const { return m_bIsEnabled
; }
78 CGContextRef
GetTargetContext() const { return m_xTargetContext
; }
79 CGContextRef
GetMaskContext() const { return (m_bIsEnabled
? m_xMaskContext
: NULL
); }
82 CGLayerRef m_xTargetLayer
;
83 CGContextRef m_xTargetContext
;
84 CGContextRef m_xMaskContext
;
85 CGContextRef m_xTempContext
;
86 sal_uLong
* m_pMaskBuffer
;
87 sal_uLong
* m_pTempBuffer
;
92 #endif // INCLUDED_VCL_INC_QUARTZ_SALGDICOMMON_HXX