1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SURFACEBITMAP_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SURFACEBITMAP_HXX
23 #include <canvas/rendering/isurfaceproxy.hxx>
24 #include <canvas/rendering/isurfaceproxymanager.hxx>
25 #include "dx_ibitmap.hxx"
26 #include "dx_canvasfont.hxx"
27 #include "dx_gdiplususer.hxx"
28 #include "dx_rendermodule.hxx"
32 class DXSurfaceBitmap
: public IBitmap
35 DXSurfaceBitmap( const ::basegfx::B2IVector
& rSize
,
36 const canvas::ISurfaceProxyManagerSharedPtr
& rMgr
,
37 const IDXRenderModuleSharedPtr
& rRenderModule
,
40 bool resize( const ::basegfx::B2IVector
& rSize
);
43 virtual GraphicsSharedPtr
getGraphics();
45 virtual BitmapSharedPtr
getBitmap() const;
46 virtual ::basegfx::B2IVector
getSize() const;
47 virtual bool hasAlpha() const;
49 COMReference
<surface_type
> getSurface() const { return mpSurface
; }
51 bool draw( double fAlpha
,
52 const ::basegfx::B2DPoint
& rPos
,
53 const ::basegfx::B2DHomMatrix
& rTransform
);
55 bool draw( const ::basegfx::B2IRange
& rArea
);
57 bool draw( double fAlpha
,
58 const ::basegfx::B2DPoint
& rPos
,
59 const ::basegfx::B2DRange
& rArea
,
60 const ::basegfx::B2DHomMatrix
& rTransform
);
62 bool draw( double fAlpha
,
63 const ::basegfx::B2DPoint
& rPos
,
64 const ::basegfx::B2DPolyPolygon
& rClipPoly
,
65 const ::basegfx::B2DHomMatrix
& rTransform
);
67 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> getData(
68 ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
69 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
72 const ::com::sun::star::uno::Sequence
< sal_Int8
>& data
,
73 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
74 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
76 virtual void setPixel(
77 const ::com::sun::star::uno::Sequence
< sal_Int8
>& color
,
78 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
79 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
81 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> getPixel(
82 ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
83 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
85 #ifdef DX_DEBUG_IMAGES
91 // Refcounted global GDI+ state container
92 GDIPlusUserSharedPtr mpGdiPlusUser
;
94 // size of this image in pixels [integral unit]
95 ::basegfx::B2IVector maSize
;
97 // pointer to the rendermodule, needed to create surfaces
98 // which are used as container for the actual pixel data.
99 // generally we could use any kind of storage, but GDI+
100 // is not willing to render antialiased fonts unless we
101 // use this special kind of container, don't ask me why...
102 IDXRenderModuleSharedPtr mpRenderModule
;
104 // pointer to the surface manager, needed in case clients
105 // want to resize the bitmap.
106 canvas::ISurfaceProxyManagerSharedPtr mpSurfaceManager
;
108 // access point to the surface proxy which handles
109 // the hardware-dependent rendering stuff.
110 canvas::ISurfaceProxySharedPtr mpSurfaceProxy
;
112 // container for pixel data, we need to use a directx
113 // surface since GDI+ sucks...
114 COMReference
<surface_type
> mpSurface
;
116 // since GDI+ does not work correctly in case we
117 // run on a 16bit display [don't ask me why] we need
118 // to occasionally render to a native GDI+ bitmap.
119 BitmapSharedPtr mpGDIPlusBitmap
;
120 // Graphics for the mpGDIPlusBitmap
121 GraphicsSharedPtr mpGraphics
;
123 // internal implementation of the iColorBuffer interface
124 canvas::IColorBufferSharedPtr mpColorBuffer
;
126 // indicates whether the associated surface needs
127 // to refresh its contents or not. in other words,
128 // this flag is set iff both representations are
130 mutable bool mbIsSurfaceDirty
;
132 // true if the bitmap contains an alpha channel
136 typedef ::boost::shared_ptr
< DXSurfaceBitmap
> DXSurfaceBitmapSharedPtr
;
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */