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_SALBMP_H 25cdf0e10cSrcweir #define _SV_SALBMP_H 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "tools/gen.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "basebmp/bitmapdevice.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "vcl/salbtype.hxx" 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include "aqua/salconst.h" 34cdf0e10cSrcweir #include "aqua/salgdi.h" 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include "saldata.hxx" 37cdf0e10cSrcweir #include "salinst.hxx" 38cdf0e10cSrcweir #include "salvd.hxx" 39cdf0e10cSrcweir #include "salbmp.hxx" 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include "salcolorutils.hxx" 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir // -------------- 45cdf0e10cSrcweir // - SalBitmap - 46cdf0e10cSrcweir // -------------- 47cdf0e10cSrcweir 48cdf0e10cSrcweir struct BitmapBuffer; 49cdf0e10cSrcweir class BitmapColor; 50cdf0e10cSrcweir class BitmapPalette; 51cdf0e10cSrcweir class AquaSalVirtualDevice; 52cdf0e10cSrcweir class AquaSalGraphics; 53cdf0e10cSrcweir 54cdf0e10cSrcweir class AquaSalBitmap : public SalBitmap 55cdf0e10cSrcweir { 56cdf0e10cSrcweir public: 57cdf0e10cSrcweir CGContextRef mxGraphicContext; 58cdf0e10cSrcweir mutable CGImageRef mxCachedImage; 59cdf0e10cSrcweir BitmapPalette maPalette; 60cdf0e10cSrcweir basebmp::RawMemorySharedArray maUserBuffer; 61cdf0e10cSrcweir basebmp::RawMemorySharedArray maContextBuffer; 62cdf0e10cSrcweir sal_uInt16 mnBits; 63cdf0e10cSrcweir int mnWidth; 64cdf0e10cSrcweir int mnHeight; 65cdf0e10cSrcweir sal_uInt32 mnBytesPerRow; 66cdf0e10cSrcweir 67cdf0e10cSrcweir public: 68cdf0e10cSrcweir AquaSalBitmap(); 69cdf0e10cSrcweir virtual ~AquaSalBitmap(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir 73cdf0e10cSrcweir // SalBitmap methods 74cdf0e10cSrcweir bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ); 75cdf0e10cSrcweir bool Create( const SalBitmap& rSalBmp ); 76cdf0e10cSrcweir bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); 77cdf0e10cSrcweir bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir void Destroy(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir Size GetSize() const; 82cdf0e10cSrcweir sal_uInt16 GetBitCount() const; 83cdf0e10cSrcweir 84cdf0e10cSrcweir BitmapBuffer *AcquireBuffer( bool bReadOnly ); 85cdf0e10cSrcweir void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); 86cdf0e10cSrcweir 87cdf0e10cSrcweir bool GetSystemData( BitmapSystemData& rData ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir private: 90cdf0e10cSrcweir // quartz helper 91cdf0e10cSrcweir bool CreateContext(); 92cdf0e10cSrcweir void DestroyContext(); 93cdf0e10cSrcweir bool AllocateUserData(); 94cdf0e10cSrcweir 95cdf0e10cSrcweir void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight, 96cdf0e10cSrcweir sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData, 97cdf0e10cSrcweir sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir public: 100cdf0e10cSrcweir bool Create( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bMirrorVert = true ); 101cdf0e10cSrcweir 102cdf0e10cSrcweir public: 103cdf0e10cSrcweir CGImageRef CreateWithMask( const AquaSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const; 104cdf0e10cSrcweir CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const; 105cdf0e10cSrcweir CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const; 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir #endif // _SV_SALBMP_HXX 109