xref: /trunk/main/canvas/source/directx/dx_bitmap.hxx (revision 91c99ff4)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DXCANVAS_DXBITMAP_HXX
25 #define _DXCANVAS_DXBITMAP_HXX
26 
27 #include <com/sun/star/rendering/XCanvas.hpp>
28 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
29 #include <boost/shared_ptr.hpp>
30 #include <basegfx/vector/b2ivector.hxx>
31 #include <basegfx/point/b2dpoint.hxx>
32 #include <basegfx/range/b2drange.hxx>
33 #include "dx_winstuff.hxx"
34 #include "dx_ibitmap.hxx"
35 #include "dx_graphicsprovider.hxx"
36 #include "dx_gdiplususer.hxx"
37 
38 namespace dxcanvas
39 {
40 	class DXBitmap : public IBitmap
41 	{
42     public:
43         DXBitmap( const BitmapSharedPtr& rBitmap,
44                   bool					 bWithAlpha );
45         DXBitmap( const ::basegfx::B2IVector& rSize,
46                   bool						  bWithAlpha );
47 
48         virtual GraphicsSharedPtr         getGraphics();
49 
50         virtual BitmapSharedPtr           getBitmap() const;
51         virtual ::basegfx::B2IVector      getSize() const;
52         virtual bool                      hasAlpha() const;
53 
54         ::com::sun::star::uno::Sequence< sal_Int8 > getData(
55             ::com::sun::star::rendering::IntegerBitmapLayout&		bitmapLayout,
56             const ::com::sun::star::geometry::IntegerRectangle2D&	rect );
57 
58         void setData(
59             const ::com::sun::star::uno::Sequence< sal_Int8 >&		data,
60             const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
61             const ::com::sun::star::geometry::IntegerRectangle2D&	rect );
62 
63         void setPixel(
64             const ::com::sun::star::uno::Sequence< sal_Int8 >&		color,
65             const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
66             const ::com::sun::star::geometry::IntegerPoint2D&		pos );
67 
68         ::com::sun::star::uno::Sequence< sal_Int8 > getPixel(
69             ::com::sun::star::rendering::IntegerBitmapLayout&		bitmapLayout,
70             const ::com::sun::star::geometry::IntegerPoint2D&		pos );
71 
72     private:
73         // Refcounted global GDI+ state container
74         GDIPlusUserSharedPtr mpGdiPlusUser;
75 
76         // size of this image in pixels [integral unit]
77         ::basegfx::B2IVector maSize;
78 
79 		BitmapSharedPtr      mpBitmap;
80         GraphicsSharedPtr    mpGraphics;
81 
82         // true if the bitmap contains an alpha channel
83         bool                 mbAlpha;
84 	};
85 
86     typedef ::boost::shared_ptr< DXBitmap > DXBitmapSharedPtr;
87 }
88 
89 #endif
90