xref: /aoo41x/main/vcl/inc/canvasbitmap.hxx (revision ebfcd9af)
1*ebfcd9afSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ebfcd9afSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ebfcd9afSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ebfcd9afSAndrew Rist  * distributed with this work for additional information
6*ebfcd9afSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ebfcd9afSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ebfcd9afSAndrew Rist  * "License"); you may not use this file except in compliance
9*ebfcd9afSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ebfcd9afSAndrew Rist  *
11*ebfcd9afSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ebfcd9afSAndrew Rist  *
13*ebfcd9afSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ebfcd9afSAndrew Rist  * software distributed under the License is distributed on an
15*ebfcd9afSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ebfcd9afSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ebfcd9afSAndrew Rist  * specific language governing permissions and limitations
18*ebfcd9afSAndrew Rist  * under the License.
19*ebfcd9afSAndrew Rist  *
20*ebfcd9afSAndrew Rist  *************************************************************/
21*ebfcd9afSAndrew Rist 
22*ebfcd9afSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _VCL_CANVASBITMAP_HXX
25cdf0e10cSrcweir #define _VCL_CANVASBITMAP_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <cppuhelper/compbase3.hxx>
28cdf0e10cSrcweir #include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
29cdf0e10cSrcweir #include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
30cdf0e10cSrcweir #include <com/sun/star/rendering/XIntegerBitmap.hpp>
31cdf0e10cSrcweir #include <com/sun/star/rendering/XBitmapPalette.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vcl/bitmapex.hxx>
34cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace vcl
37cdf0e10cSrcweir {
38cdf0e10cSrcweir namespace unotools
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     class VCL_DLLPUBLIC VclCanvasBitmap :
41cdf0e10cSrcweir         public cppu::WeakImplHelper3< com::sun::star::rendering::XIntegerReadOnlyBitmap,
42cdf0e10cSrcweir                                       com::sun::star::rendering::XBitmapPalette,
43cdf0e10cSrcweir                                       com::sun::star::rendering::XIntegerBitmapColorSpace >
44cdf0e10cSrcweir     {
45cdf0e10cSrcweir     private:
46cdf0e10cSrcweir         BitmapEx                                       m_aBmpEx;
47cdf0e10cSrcweir         Bitmap                                         m_aBitmap;
48cdf0e10cSrcweir         Bitmap                                         m_aAlpha;
49cdf0e10cSrcweir         BitmapReadAccess*                              m_pBmpAcc;
50cdf0e10cSrcweir         BitmapReadAccess*                              m_pAlphaAcc;
51cdf0e10cSrcweir         com::sun::star::uno::Sequence<sal_Int8>        m_aComponentTags;
52cdf0e10cSrcweir         com::sun::star::uno::Sequence<sal_Int32>       m_aComponentBitCounts;
53cdf0e10cSrcweir         com::sun::star::rendering::IntegerBitmapLayout m_aLayout;
54cdf0e10cSrcweir         sal_Int32                                      m_nBitsPerInputPixel;
55cdf0e10cSrcweir         sal_Int32                                      m_nBitsPerOutputPixel;
56cdf0e10cSrcweir         sal_Int32                                      m_nRedIndex;
57cdf0e10cSrcweir         sal_Int32                                      m_nGreenIndex;
58cdf0e10cSrcweir         sal_Int32                                      m_nBlueIndex;
59cdf0e10cSrcweir         sal_Int32                                      m_nAlphaIndex;
60cdf0e10cSrcweir         sal_Int32                                      m_nIndexIndex;
61cdf0e10cSrcweir         sal_Int8                                       m_nEndianness;
62cdf0e10cSrcweir         bool                                           m_bSwap;
63cdf0e10cSrcweir         bool                                           m_bPalette;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         SAL_DLLPRIVATE void setComponentInfo( sal_uLong redShift, sal_uLong greenShift, sal_uLong blueShift );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir         virtual ~VclCanvasBitmap();
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     public:
70cdf0e10cSrcweir         // XBitmap
71cdf0e10cSrcweir         virtual com::sun::star::geometry::IntegerSize2D SAL_CALL getSize() throw (com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL hasAlpha(  ) throw (::com::sun::star::uno::RuntimeException);
73cdf0e10cSrcweir         virtual com::sun::star::uno::Reference< com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const com::sun::star::geometry::RealSize2D& newSize, sal_Bool beFast ) throw (com::sun::star::uno::RuntimeException);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         // XIntegerReadOnlyBitmap
76cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException);
77cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapPalette > SAL_CALL getPalette(  ) throw (::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir         virtual ::com::sun::star::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout(  ) throw (::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir         // XBitmapPalette
82cdf0e10cSrcweir         virtual sal_Int32 SAL_CALL getNumberOfEntries() throw (com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getIndex( ::com::sun::star::uno::Sequence< double >& entry, ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL setIndex( const ::com::sun::star::uno::Sequence< double >& color, ::sal_Bool transparency, ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getColorSpace(  ) throw (::com::sun::star::uno::RuntimeException);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         // XIntegerBitmapColorSpace
88cdf0e10cSrcweir         virtual ::sal_Int8 SAL_CALL getType(  ) throw (::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getComponentTags(  ) throw (::com::sun::star::uno::RuntimeException);
90cdf0e10cSrcweir         virtual ::sal_Int8 SAL_CALL getRenderingIntent(  ) throw (::com::sun::star::uno::RuntimeException);
91cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getProperties(  ) throw (::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertColorSpace( const ::com::sun::star::uno::Sequence< double >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace >& targetColorSpace ) throw (::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertToRGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToPARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir         virtual ::sal_Int32 SAL_CALL getBitsPerPixel(  ) throw (::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts(  ) throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir         virtual ::sal_Int8 SAL_CALL getEndianness(  ) throw (::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace >& targetColorSpace ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace >& targetColorSpace ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertIntegerToRGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
105cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
107cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
108cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         /** Create API wrapper for given BitmapEx
112cdf0e10cSrcweir 
113cdf0e10cSrcweir             @param rBitmap
114cdf0e10cSrcweir             Bitmap to wrap. As usual, changes to the original bitmap
115cdf0e10cSrcweir             are not reflected in this object (copy on write).
116cdf0e10cSrcweir          */
117cdf0e10cSrcweir         explicit VclCanvasBitmap( const BitmapEx& rBitmap );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir         /// Retrieve contained bitmap. Call me with locked Solar mutex!
120cdf0e10cSrcweir         BitmapEx getBitmapEx() const;
121cdf0e10cSrcweir    };
122cdf0e10cSrcweir }
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir #endif
126