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