merge the formfield patch from ooo-build
[ooovba.git] / vcl / aqua / inc / salbmp.h
blob8cc1dc4b23af7ba3320f250025c11378f0d277a9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salbmp.h,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SV_SALBMP_H
32 #define _SV_SALBMP_H
34 #include "tools/gen.hxx"
35 #include "vcl/sv.h"
36 #include "vcl/salbtype.hxx"
37 #include "saldata.hxx"
38 #include "vcl/salinst.hxx"
39 #include "salconst.h"
40 #include "vcl/salvd.hxx"
41 #include "salcolorutils.hxx"
42 #include "salpixmaputils.hxx"
43 #include "vcl/salbmp.hxx"
44 #include "salgdi.h"
45 #include "basebmp/bitmapdevice.hxx"
47 // --------------
48 // - SalBitmap -
49 // --------------
51 struct BitmapBuffer;
52 class BitmapColor;
53 class BitmapPalette;
54 class AquaSalVirtualDevice;
55 class AquaSalGraphics;
57 class AquaSalBitmap : public SalBitmap
59 public:
60 CGContextRef mxGraphicContext;
61 mutable CGImageRef mxCachedImage;
62 BitmapPalette maPalette;
63 basebmp::RawMemorySharedArray maUserBuffer;
64 basebmp::RawMemorySharedArray maContextBuffer;
65 sal_uInt16 mnBits;
66 int mnWidth;
67 int mnHeight;
68 sal_uInt32 mnBytesPerRow;
70 public:
71 AquaSalBitmap();
72 virtual ~AquaSalBitmap();
74 public:
76 // SalBitmap methods
77 bool Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal );
78 bool Create( const SalBitmap& rSalBmp );
79 bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics );
80 bool Create( const SalBitmap& rSalBmp, USHORT nNewBitCount );
81 virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
82 Size& rSize,
83 bool bMask = false );
85 void Destroy();
87 Size GetSize() const;
88 USHORT GetBitCount() const;
90 BitmapBuffer *AcquireBuffer( bool bReadOnly );
91 void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
93 bool GetSystemData( BitmapSystemData& rData );
95 private:
96 // quartz helper
97 bool CreateContext();
98 void DestroyContext();
99 bool AllocateUserData();
101 void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
102 sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData,
103 sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData );
105 public:
106 bool Create( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bMirrorVert = true );
108 public:
109 CGImageRef CreateWithMask( const AquaSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const;
110 CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const;
111 CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const;
114 #endif // _SV_SALBMP_HXX