1*2d788491SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d788491SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d788491SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d788491SAndrew Rist * distributed with this work for additional information 6*2d788491SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d788491SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d788491SAndrew Rist * "License"); you may not use this file except in compliance 9*2d788491SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*2d788491SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*2d788491SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d788491SAndrew Rist * software distributed under the License is distributed on an 15*2d788491SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d788491SAndrew Rist * KIND, either express or implied. See the License for the 17*2d788491SAndrew Rist * specific language governing permissions and limitations 18*2d788491SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*2d788491SAndrew Rist *************************************************************/ 21*2d788491SAndrew Rist 22*2d788491SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _CPPCANVAS_VCLFACTORY_HXX 25cdf0e10cSrcweir #define _CPPCANVAS_VCLFACTORY_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <cppcanvas/canvas.hxx> 28cdf0e10cSrcweir #include <cppcanvas/bitmapcanvas.hxx> 29cdf0e10cSrcweir #include <cppcanvas/spritecanvas.hxx> 30cdf0e10cSrcweir #include <cppcanvas/polypolygon.hxx> 31cdf0e10cSrcweir #include <cppcanvas/bitmap.hxx> 32cdf0e10cSrcweir #include <cppcanvas/renderer.hxx> 33cdf0e10cSrcweir #include <cppcanvas/text.hxx> 34cdf0e10cSrcweir #include <cppcanvas/sprite.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir 37cdf0e10cSrcweir class Window; 38cdf0e10cSrcweir class Bitmap; 39cdf0e10cSrcweir class BitmapEx; 40cdf0e10cSrcweir class Polygon; 41cdf0e10cSrcweir class PolyPolygon; 42cdf0e10cSrcweir class Size; 43cdf0e10cSrcweir class Graphic; 44cdf0e10cSrcweir class GDIMetaFile; 45cdf0e10cSrcweir class Animation; 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace rtl 48cdf0e10cSrcweir { 49cdf0e10cSrcweir class OUString; 50cdf0e10cSrcweir } 51cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace rendering 52cdf0e10cSrcweir { 53cdf0e10cSrcweir class XBitmapCanvas; 54cdf0e10cSrcweir class XSpriteCanvas; 55cdf0e10cSrcweir } } } } 56cdf0e10cSrcweir 57cdf0e10cSrcweir /* Definition of VCLFactory class */ 58cdf0e10cSrcweir 59cdf0e10cSrcweir namespace cppcanvas 60cdf0e10cSrcweir { 61cdf0e10cSrcweir /** The VCLFactory creates Canvas objects for various VCL 62cdf0e10cSrcweir OutputDevice primitives, such as windows, polygons, bitmaps 63cdf0e10cSrcweir and metafiles. 64cdf0e10cSrcweir 65cdf0e10cSrcweir Please note that the objects created for a specific Canvas can 66cdf0e10cSrcweir only be drawn on exactly that canvas. You have to regenerate 67cdf0e10cSrcweir them for different canvases. 68cdf0e10cSrcweir */ 69cdf0e10cSrcweir class VCLFactory 70cdf0e10cSrcweir { 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir static VCLFactory& getInstance(); 73cdf0e10cSrcweir 74cdf0e10cSrcweir BitmapCanvasSharedPtr createCanvas( const ::Window& rVCLWindow ); 75cdf0e10cSrcweir BitmapCanvasSharedPtr createCanvas( const ::com::sun::star::uno::Reference< 76cdf0e10cSrcweir ::com::sun::star::rendering::XBitmapCanvas >& xCanvas ); 77cdf0e10cSrcweir 78cdf0e10cSrcweir SpriteCanvasSharedPtr createSpriteCanvas( const ::Window& rVCLWindow ) const; 79cdf0e10cSrcweir SpriteCanvasSharedPtr createSpriteCanvas( const ::com::sun::star::uno::Reference< 80cdf0e10cSrcweir ::com::sun::star::rendering::XSpriteCanvas >& xCanvas ) const; 81cdf0e10cSrcweir SpriteCanvasSharedPtr createFullscreenSpriteCanvas( const ::Window& rVCLWindow, const Size& rFullscreenSize ) const; 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** Create a polygon from a tools::Polygon 84cdf0e10cSrcweir 85cdf0e10cSrcweir The created polygon initially has the same size in user 86cdf0e10cSrcweir coordinate space as the source polygon 87cdf0e10cSrcweir */ 88cdf0e10cSrcweir PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::Polygon& rPoly ) const; 89cdf0e10cSrcweir PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::PolyPolygon& rPoly ) const; 90cdf0e10cSrcweir 91cdf0e10cSrcweir /** Create an uninitialized bitmap with the given size 92cdf0e10cSrcweir */ 93cdf0e10cSrcweir BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::Size& rSize ) const; 94cdf0e10cSrcweir 95cdf0e10cSrcweir /** Create an uninitialized alpha bitmap with the given size 96cdf0e10cSrcweir */ 97cdf0e10cSrcweir BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::Size& rSize ) const; 98cdf0e10cSrcweir 99cdf0e10cSrcweir /** Create a bitmap from a VCL Bitmap 100cdf0e10cSrcweir */ 101cdf0e10cSrcweir BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::Bitmap& rBitmap ) const; 102cdf0e10cSrcweir BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::BitmapEx& rBmpEx ) const; 103cdf0e10cSrcweir 104cdf0e10cSrcweir /** Create a renderer object from a Graphic 105cdf0e10cSrcweir 106cdf0e10cSrcweir The created renderer initially draws the graphic 107cdf0e10cSrcweir one-by-one units large, in user coordinate space 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir RendererSharedPtr createRenderer( const CanvasSharedPtr& rCanvas, 110cdf0e10cSrcweir const ::Graphic& rGraphic, 111cdf0e10cSrcweir const Renderer::Parameters& rParms ) const; 112cdf0e10cSrcweir /** Create a renderer object from a Metafile 113cdf0e10cSrcweir 114cdf0e10cSrcweir The created renderer initially draws the metafile 115cdf0e10cSrcweir one-by-one units large, in user coordinate space 116cdf0e10cSrcweir */ 117cdf0e10cSrcweir RendererSharedPtr createRenderer( const CanvasSharedPtr& rCanvas, 118cdf0e10cSrcweir const ::GDIMetaFile& rMtf, 119cdf0e10cSrcweir const Renderer::Parameters& rParms ) const; 120cdf0e10cSrcweir 121cdf0e10cSrcweir /** Create an animated sprite from a VCL animation 122cdf0e10cSrcweir */ 123cdf0e10cSrcweir SpriteSharedPtr createAnimatedSprite( const SpriteCanvasSharedPtr&, const ::Animation& rAnim ) const; 124cdf0e10cSrcweir 125cdf0e10cSrcweir /** Create a text portion with the given content string 126cdf0e10cSrcweir */ 127cdf0e10cSrcweir TextSharedPtr createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const; 128cdf0e10cSrcweir 129cdf0e10cSrcweir private: 130cdf0e10cSrcweir friend struct InitInstance; 131cdf0e10cSrcweir 132cdf0e10cSrcweir // singleton 133cdf0e10cSrcweir VCLFactory(); 134cdf0e10cSrcweir ~VCLFactory(); 135cdf0e10cSrcweir 136cdf0e10cSrcweir // default: disabled copy/assignment 137cdf0e10cSrcweir VCLFactory(const VCLFactory&); 138cdf0e10cSrcweir VCLFactory& operator=( const VCLFactory& ); 139cdf0e10cSrcweir }; 140cdf0e10cSrcweir 141cdf0e10cSrcweir } 142cdf0e10cSrcweir 143cdf0e10cSrcweir #endif /* _CPPCANVAS_VCLFACTORY_HXX */ 144