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 _VCL_AQUA_SALGDICOMMON_H
21 #define _VCL_AQUA_SALGDICOMMON_H
23 // abstracting quartz color instead of having to use an CGFloat[] array
27 RGBAColor( SalColor
);
28 RGBAColor( float fRed
, float fGreen
, float fBlue
, float fAlpha
); //NOTUSEDYET
29 const CGFloat
* AsArray() const { return m_fRGBA
; }
30 bool IsVisible() const { return m_fRGBA
[3] > 0; }
31 void SetAlpha( float fAlpha
) { m_fRGBA
[3] = fAlpha
; }
33 CGFloat m_fRGBA
[4]; // red, green, blue, alpha
36 inline RGBAColor::RGBAColor( SalColor nSalColor
)
38 m_fRGBA
[0] = SALCOLOR_RED(nSalColor
) * (1.0/255);
39 m_fRGBA
[1] = SALCOLOR_GREEN(nSalColor
) * (1.0/255);
40 m_fRGBA
[2] = SALCOLOR_BLUE(nSalColor
) * (1.0/255);
41 m_fRGBA
[3] = 1.0; // opaque
44 inline RGBAColor::RGBAColor( float fRed
, float fGreen
, float fBlue
, float fAlpha
)
58 void SetTarget( int nWidth
, int nHeight
, int nBitmapDepth
, CGContextRef
, CGLayerRef
);
60 void Enable() { m_bIsEnabled
= true; }
61 void Disable() { m_bIsEnabled
= false; }
62 bool IsEnabled() const { return m_bIsEnabled
; }
63 CGContextRef
GetTargetContext() const { return m_xTargetContext
; }
64 CGContextRef
GetMaskContext() const { return (m_bIsEnabled
? m_xMaskContext
: NULL
); }
67 CGLayerRef m_xTargetLayer
;
68 CGContextRef m_xTargetContext
;
69 CGContextRef m_xMaskContext
;
70 CGContextRef m_xTempContext
;
71 sal_uLong
* m_pMaskBuffer
;
72 sal_uLong
* m_pTempBuffer
;
77 #endif /* _VCL_AQUA_SALGDICOMMON_H */