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