1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salbmp.h,v $
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 ************************************************************************/
34 #include "tools/gen.hxx"
36 #include "vcl/salbtype.hxx"
37 #include "saldata.hxx"
38 #include "vcl/salinst.hxx"
40 #include "vcl/salvd.hxx"
41 #include "salcolorutils.hxx"
42 #include "salpixmaputils.hxx"
43 #include "vcl/salbmp.hxx"
45 #include "basebmp/bitmapdevice.hxx"
54 class AquaSalVirtualDevice
;
55 class AquaSalGraphics
;
57 class AquaSalBitmap
: public SalBitmap
60 CGContextRef mxGraphicContext
;
61 mutable CGImageRef mxCachedImage
;
62 BitmapPalette maPalette
;
63 basebmp::RawMemorySharedArray maUserBuffer
;
64 basebmp::RawMemorySharedArray maContextBuffer
;
68 sal_uInt32 mnBytesPerRow
;
72 virtual ~AquaSalBitmap();
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
,
88 USHORT
GetBitCount() const;
90 BitmapBuffer
*AcquireBuffer( bool bReadOnly
);
91 void ReleaseBuffer( BitmapBuffer
* pBuffer
, bool bReadOnly
);
93 bool GetSystemData( BitmapSystemData
& rData
);
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
);
106 bool Create( CGLayerRef xLayer
, int nBitCount
, int nX
, int nY
, int nWidth
, int nHeight
, bool bMirrorVert
= true );
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