Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / vcl / inc / aqua / salbmp.h
blob18716117df28926b491544d99817598495985466
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _SV_SALBMP_H
21 #define _SV_SALBMP_H
23 #include "tools/gen.hxx"
25 #include "basebmp/bitmapdevice.hxx"
27 #include "vcl/salbtype.hxx"
29 #include "aqua/salconst.h"
30 #include "aqua/salgdi.h"
32 #include "saldata.hxx"
33 #include "salinst.hxx"
34 #include "salvd.hxx"
35 #include "salbmp.hxx"
37 #include "salcolorutils.hxx"
40 // --------------
41 // - SalBitmap -
42 // --------------
44 struct BitmapBuffer;
45 class BitmapColor;
46 class BitmapPalette;
47 class AquaSalVirtualDevice;
48 class AquaSalGraphics;
50 class AquaSalBitmap : public SalBitmap
52 public:
53 CGContextRef mxGraphicContext;
54 mutable CGImageRef mxCachedImage;
55 BitmapPalette maPalette;
56 basebmp::RawMemorySharedArray maUserBuffer;
57 basebmp::RawMemorySharedArray maContextBuffer;
58 sal_uInt16 mnBits;
59 int mnWidth;
60 int mnHeight;
61 sal_uInt32 mnBytesPerRow;
63 public:
64 AquaSalBitmap();
65 virtual ~AquaSalBitmap();
67 public:
69 // SalBitmap methods
70 bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal );
71 bool Create( const SalBitmap& rSalBmp );
72 bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics );
73 bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount );
74 virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
75 Size& rSize,
76 bool bMask = false );
78 void Destroy();
80 Size GetSize() const;
81 sal_uInt16 GetBitCount() const;
83 BitmapBuffer *AcquireBuffer( bool bReadOnly );
84 void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
86 bool GetSystemData( BitmapSystemData& rData );
88 private:
89 // quartz helper
90 bool CreateContext();
91 void DestroyContext();
92 bool AllocateUserData();
94 void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
95 sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData,
96 sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData );
98 public:
99 bool Create( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bMirrorVert = true );
101 public:
102 CGImageRef CreateWithMask( const AquaSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const;
103 CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const;
104 CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const;
107 #endif // _SV_SALBMP_HXX
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */