1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cairo_spritedevicehelper.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CAIROCANVAS_SPRITEDEVICEHELPER_HXX
32 #define _CAIROCANVAS_SPRITEDEVICEHELPER_HXX
34 #include <com/sun/star/awt/Rectangle.hpp>
35 #include <com/sun/star/rendering/XGraphicDevice.hpp>
36 #include <com/sun/star/rendering/XBufferController.hpp>
38 #include <boost/utility.hpp>
40 #include <vcl/window.hxx>
41 #include <vcl/bitmap.hxx>
43 #include "cairo_cairo.hxx"
44 #include "cairo_devicehelper.hxx"
46 /* Definition of DeviceHelper class */
51 class SpriteCanvasHelper
;
53 class SpriteDeviceHelper
: public DeviceHelper
58 void init( Window
& rOutputWindow
,
59 SpriteCanvas
& rSpriteCanvas
,
60 const ::basegfx::B2ISize
& rSize
,
63 /// Dispose all internal references
66 // XWindowGraphicDevice
67 ::sal_Int32
createBuffers( ::sal_Int32 nBuffers
);
68 void destroyBuffers( );
69 ::sal_Bool
showBuffer( bool, ::sal_Bool
);
70 ::sal_Bool
switchBuffer( bool, ::sal_Bool bUpdateAll
);
72 ::com::sun::star::uno::Any
isAccelerated() const;
73 ::com::sun::star::uno::Any
getDeviceHandle() const;
74 ::com::sun::star::uno::Any
getSurfaceHandle() const;
76 void notifySizeUpdate( const ::com::sun::star::awt::Rectangle
& rBounds
);
77 void setSize( const ::basegfx::B2ISize
& rSize
);
79 ::cairo::SurfaceSharedPtr
getSurface();
80 ::cairo::SurfaceSharedPtr
getBufferSurface();
81 ::cairo::SurfaceSharedPtr
getWindowSurface();
82 ::cairo::SurfaceSharedPtr
createSurface( const ::basegfx::B2ISize
& rSize
, ::cairo::Content aContent
= CAIRO_CONTENT_COLOR_ALPHA
);
83 ::cairo::SurfaceSharedPtr
createSurface( BitmapSystemData
& rData
, const Size
& rSize
);
84 const ::basegfx::B2ISize
& getSizePixel();
88 /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
89 SpriteCanvas
* mpSpriteCanvas
;
91 ::cairo::SurfaceSharedPtr mpBufferSurface
;
93 ::basegfx::B2ISize maSize
;