diff options
Diffstat (limited to 'cppcanvas/inc/cppcanvas')
-rw-r--r-- | cppcanvas/inc/cppcanvas/basegfxfactory.hxx | 104 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/bitmap.hxx | 80 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/bitmapcanvas.hxx | 66 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/canvas.hxx | 116 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/canvasgraphic.hxx | 170 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/color.hxx | 95 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/customsprite.hxx | 53 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/font.hxx | 65 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/polypolygon.hxx | 93 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/renderer.hxx | 147 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/sprite.hxx | 116 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/spritecanvas.hxx | 81 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/text.hxx | 55 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/vclfactory.hxx | 147 |
14 files changed, 1388 insertions, 0 deletions
diff --git a/cppcanvas/inc/cppcanvas/basegfxfactory.hxx b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx new file mode 100644 index 000000000000..268292eb4a55 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_BASEGFXFACTORY_HXX +#define _CPPCANVAS_BASEGFXFACTORY_HXX + +#include <cppcanvas/canvas.hxx> +#include <cppcanvas/bitmapcanvas.hxx> +#include <cppcanvas/spritecanvas.hxx> +#include <cppcanvas/polypolygon.hxx> +#include <cppcanvas/bitmap.hxx> +#include <cppcanvas/renderer.hxx> +#include <cppcanvas/text.hxx> +#include <cppcanvas/sprite.hxx> +#include <basegfx/vector/b2isize.hxx> + + +namespace basegfx +{ + class B2DPolygon; + class B2DPolyPolygon; +} + +namespace rtl +{ + class OUString; +} + +/* Definition of BaseGfxFactory class */ + +namespace cppcanvas +{ + /** The BaseGfxFactory creates Canvas objects for various basegfx + primitives, such as polygons and bitmaps (not yet + implemented). + + Please note that the objects created for a specific Canvas can + only be drawn on exactly that canvas. You have to regenerate + them for different canvases. + */ + class BaseGfxFactory + { + public: + static BaseGfxFactory& getInstance(); + + /** Create a polygon from a ::basegfx::B2DPolygon + + The created polygon initially has the same size in user + coordinate space as the source polygon + */ + PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const; + PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolyPolygon& rPoly ) const; + + /** Create an uninitialized bitmap with the given size + */ + BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const; + + /** Create an uninitialized alpha bitmap with the given size + */ + BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const; + + /** Create a text portion with the given content string + */ + TextSharedPtr createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const; + + private: + friend struct InitInstance2; + + // singleton + BaseGfxFactory(); + ~BaseGfxFactory(); + + // default: disabled copy/assignment + BaseGfxFactory(const BaseGfxFactory&); + BaseGfxFactory& operator=( const BaseGfxFactory& ); + }; + +} + +#endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */ diff --git a/cppcanvas/inc/cppcanvas/bitmap.hxx b/cppcanvas/inc/cppcanvas/bitmap.hxx new file mode 100644 index 000000000000..cd17ec1837c9 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/bitmap.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_BITMAP_HXX +#define _CPPCANVAS_BITMAP_HXX + +#include <com/sun/star/uno/Reference.hxx> + +#include <boost/shared_ptr.hpp> +#include <cppcanvas/canvasgraphic.hxx> +#include <cppcanvas/bitmapcanvas.hxx> + +namespace com { namespace sun { namespace star { namespace rendering +{ + class XBitmap; +} } } } + + +/* Definition of Bitmap interface */ + +namespace cppcanvas +{ + + /** This interface defines a Bitmap canvas object + + Consider this object part of the view, and not of the model + data, as this bitmap can only be painted on its parent canvas + */ + class Bitmap : public virtual CanvasGraphic + { + public: + /** Render to parent canvas, with global alpha. + + This method renders the content to the parent canvas, + i.e. the canvas this object was constructed for. + + @param nAlphaModulation + Global alpha value, with which each pixel alpha value gets + multiplied. For a normal, opaque bitmap, this will make + the bitmap appear transparent with the given alpha value + (value must be in the range [0,1]). + + @return whether the rendering finished successfully. + */ + virtual bool drawAlphaModulated( double nAlphaModulation ) const = 0; + + virtual BitmapCanvasSharedPtr getBitmapCanvas() const = 0; + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XBitmap > getUNOBitmap() const = 0; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr; +} + +#endif /* _CPPCANVAS_BITMAP_HXX */ diff --git a/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx b/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx new file mode 100644 index 000000000000..896f0c72845e --- /dev/null +++ b/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_BITMAPCANVAS_HXX +#define _CPPCANVAS_BITMAPCANVAS_HXX + +#include <sal/types.h> +#include <osl/diagnose.h> + +#include <boost/shared_ptr.hpp> +#include <basegfx/vector/b2isize.hxx> +#include <cppcanvas/canvas.hxx> + + +/* Definition of BitmapCanvas */ + +namespace cppcanvas +{ + class BitmapCanvas; + + // forward declaration, since cloneBitmapCanvas() also references BitmapCanvas + typedef ::boost::shared_ptr< BitmapCanvas > BitmapCanvasSharedPtr; + + /** BitmapCanvas interface + */ + class BitmapCanvas : public virtual Canvas + { + public: + virtual ::basegfx::B2ISize getSize() const = 0; + + // shared_ptr does not allow for covariant return types + BitmapCanvasSharedPtr cloneBitmapCanvas() const + { + BitmapCanvasSharedPtr p( ::boost::dynamic_pointer_cast< BitmapCanvas >(this->clone()) ); + OSL_ENSURE(p.get(), "BitmapCanvas::cloneBitmapCanvas(): dynamic cast failed"); + return p; + } + }; + +} + +#endif /* _CPPCANVAS_BITMAPCANVAS_HXX */ diff --git a/cppcanvas/inc/cppcanvas/canvas.hxx b/cppcanvas/inc/cppcanvas/canvas.hxx new file mode 100644 index 000000000000..e08adeac2912 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/canvas.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_CANVAS_HXX +#define _CPPCANVAS_CANVAS_HXX + +#include <com/sun/star/uno/Reference.hxx> + +#include <boost/shared_ptr.hpp> +#include <cppcanvas/font.hxx> +#include <cppcanvas/color.hxx> + +namespace rtl +{ + class OUString; +} + +namespace basegfx +{ + class B2DHomMatrix; + class B2DPolyPolygon; +} + +namespace com { namespace sun { namespace star { namespace rendering +{ + class XCanvas; + struct ViewState; +} } } } + + +/* Definition of BitmapCanvas */ + +namespace cppcanvas +{ + class PolyPolygon; + class Canvas; + + // forward declaration, since PolyPolygon also references Canvas + typedef ::boost::shared_ptr< PolyPolygon > PolyPolygonSharedPtr; + + // forward declaration, since cloneCanvas() also references Canvas + typedef ::boost::shared_ptr< Canvas > CanvasSharedPtr; + + /** Canvas interface + */ + class Canvas + { + public: + enum + { + /** Extra pixel used when canvas anti-aliases. + + Enlarge the bounding box of drawing primitives by this + amount in both dimensions, and on both sides of the + bounds, to account for extra pixel touched outside the + actual primitive bounding box, when the canvas + performs anti-aliasing. + */ + ANTIALIASING_EXTRA_SIZE=2 + }; + + virtual ~Canvas() {} + + virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0; + virtual ::basegfx::B2DHomMatrix getTransformation() const = 0; + + virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0; + virtual void setClip() = 0; + + /** Get current clip + + @return NULL, if no clip is set, otherwise the current clip poly-polygon + */ + virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0; + + virtual FontSharedPtr createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const = 0; + + virtual ColorSharedPtr createColor() const = 0; + + virtual CanvasSharedPtr clone() const = 0; + virtual void clear() const = 0; + + // this should be considered private. if RTTI gets enabled + // someday, remove that to a separate interface + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XCanvas > getUNOCanvas() const = 0; + virtual ::com::sun::star::rendering::ViewState getViewState() const = 0; + }; + +} + +#endif /* _CPPCANVAS_CANVAS_HXX */ diff --git a/cppcanvas/inc/cppcanvas/canvasgraphic.hxx b/cppcanvas/inc/cppcanvas/canvasgraphic.hxx new file mode 100644 index 000000000000..24467771dc50 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/canvasgraphic.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_CANVASGRAPHIC_HXX +#define _CPPCANVAS_CANVASGRAPHIC_HXX + +#include <sal/types.h> + +#include <boost/shared_ptr.hpp> +#include <cppcanvas/color.hxx> +#include <cppcanvas/canvas.hxx> + +namespace basegfx +{ + class B2DHomMatrix; + class B2DPolyPolygon; +} + + +/* Definition of CanvasGraphic interface */ + +namespace cppcanvas +{ + // forward declaration, since PolyPolygon also derives from CanvasGraphic + typedef ::boost::shared_ptr< class PolyPolygon > PolyPolygonSharedPtr; + + + /** This interface defines basic properties of + objects that can be painted on a Canvas + */ + class CanvasGraphic + { + public: + + /** These enums determine how the primitive color is combined + with the background. When performing this calculations, it + is assumed that all color values are premultiplied with + the corresponding alpha values (if no alpha is specified, + 1.0 is assumed). Then, the following general compositing + operation is performed: + + C = Ca * Fa + Cb * Fb + + where C is the result color, Ca and Cb are the input + colors, premultiplied with alpha, and Fa and Fb are + described for the different composite modes (wherein Aa + and Ab denote source and destination alpha, respectively). + */ + enum CompositeOp + { + /// Clear destination. Fa = Fb = 0. + CLEAR, + + /// Copy source as-is to destination. Fa = 1, Fb = 0. + SOURCE, + + /// Leave destination as-is. Fa = 0, Fb = 1. + DESTINATION, + + /// Copy source over destination. Fa = 1, Fb = 1-Aa. + OVER, + + /// Copy source under destination. Fa = 1-Ab, Fb = 1. + UNDER, + + /// Copy source to destination, but limited to where the destination is. Fa = Ab, Fb = 0. + INSIDE, + + /// Leave destination as is, but only where source was. Fa = 0, Fb = Aa. + INSIDE_REVERSE, + + /// Copy source to destination, but limited to where destination is not. Fa = 1-Ab, Fb = 0. + OUTSIDE, + + /// Leave destination as is, but only where source has not been. Fa = 0, Fb = 1-Aa. + OUTSIDE_REVERSE, + + /// Copy source over destination, but only where destination is. Keep destination. Fa = Ab, Fb = 1-Aa. + ATOP, + + /// Copy destination over source, but only where source is. Keep source. Fa = 1-Ab, Fb = Aa. + ATOP_REVERSE, + + /// Take only parts where either source or destination, but not both are. Fa = 1-Ab, Fb = 1-Aa. + XOR, + + /** simply add contributions of both source and destination. The + resulting color values are limited to the permissible color + range, and clipped to the maximal value, if exceeded. Fa = 1, Fb = 1. + */ + ADD, + + /// Fa = min(1,(1-Ab)/Aa), Fb = 1 + SATURATE + }; + + virtual ~CanvasGraphic() {} + + /** Set object transformation matrix + */ + virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0; + /** Get object transformation matrix + */ + virtual ::basegfx::B2DHomMatrix getTransformation() const = 0; + + /** Set object clipping polygon + */ + virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0; + /** Clear object clipping polygon + */ + virtual void setClip() = 0; + /** Get object clipping polygon + + @return NULL, if no clip is set; otherwise, the current clip poly-polygon is returned + */ + virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0; + + /** Set object color + */ + virtual void setRGBAColor( Color::IntSRGBA ) = 0; + /** Get object color + */ + virtual Color::IntSRGBA getRGBAColor() const = 0; + + /** Set object composite mode + */ + virtual void setCompositeOp( CompositeOp aOp ) = 0; + /** Get object composite mode + */ + virtual CompositeOp getCompositeOp() const = 0; + + /** Render to parent canvas + + This method renders the content to the parent canvas, + i.e. the canvas this object was constructed for. + + @return whether the rendering finished successfully. + */ + virtual bool draw() const = 0; + + }; + + typedef ::boost::shared_ptr< ::cppcanvas::CanvasGraphic > CanvasGraphicSharedPtr; +} + +#endif /* _CPPCANVAS_CANVASGRAPHIC_HXX */ diff --git a/cppcanvas/inc/cppcanvas/color.hxx b/cppcanvas/inc/cppcanvas/color.hxx new file mode 100644 index 000000000000..9a5237c264b7 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/color.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_COLOR_HXX +#define _CPPCANVAS_COLOR_HXX + +#include <com/sun/star/uno/Sequence.hxx> + +#include <boost/shared_ptr.hpp> + + +/* Definition of Color class */ + +namespace cppcanvas +{ + class Color + { + public: + /** Color in the sRGB color space, plus alpha channel + + The four bytes of the sal_uInt32 are allocated as follows + to the color channels and alpha: 0xRRGGBBAA. + */ + typedef sal_uInt32 IntSRGBA; + + virtual ~Color() {} + + virtual IntSRGBA getIntSRGBA( ::com::sun::star::uno::Sequence< double >& rDeviceColor ) const = 0; + virtual ::com::sun::star::uno::Sequence< double > getDeviceColor( IntSRGBA aSRGBA ) const = 0; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::Color > ColorSharedPtr; + + inline sal_uInt8 getRed( Color::IntSRGBA nCol ) + { + return static_cast<sal_uInt8>( (nCol&0xFF000000U) >> 24U ); + } + + inline sal_uInt8 getGreen( Color::IntSRGBA nCol ) + { + return static_cast<sal_uInt8>( (nCol&0x00FF0000U) >> 16U ); + } + + inline sal_uInt8 getBlue( Color::IntSRGBA nCol ) + { + return static_cast<sal_uInt8>( (nCol&0x0000FF00U) >> 8U ); + } + + inline sal_uInt8 getAlpha( Color::IntSRGBA nCol ) + { + return static_cast<sal_uInt8>( nCol&0x000000FFU ); + } + + inline Color::IntSRGBA makeColor( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nAlpha ) + { + return (nRed << 24U)|(nGreen << 16U)|(nBlue << 8U)|(nAlpha); + } + + inline sal_Int32 unMakeColor( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue) + { + return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue); + } + + inline sal_Int32 makeColorARGB( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue) + { + return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue); + } + +} + +#endif /* _CPPCANVAS_COLOR_HXX */ diff --git a/cppcanvas/inc/cppcanvas/customsprite.hxx b/cppcanvas/inc/cppcanvas/customsprite.hxx new file mode 100644 index 000000000000..15e1c1185aad --- /dev/null +++ b/cppcanvas/inc/cppcanvas/customsprite.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_CUSTOMSPRITE_HXX +#define _CPPCANVAS_CUSTOMSPRITE_HXX + +#include <sal/types.h> + +#include <boost/shared_ptr.hpp> +#include <cppcanvas/sprite.hxx> +#include <cppcanvas/canvas.hxx> + + +/* Definition of CustomSprite class */ + +namespace cppcanvas +{ + + class CustomSprite : public virtual Sprite + { + public: + + virtual CanvasSharedPtr getContentCanvas() const = 0; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr; +} + +#endif /* _CPPCANVAS_CUSTOMSPRITE_HXX */ diff --git a/cppcanvas/inc/cppcanvas/font.hxx b/cppcanvas/inc/cppcanvas/font.hxx new file mode 100644 index 000000000000..2077ae811c85 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/font.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_FONT_HXX +#define _CPPCANVAS_FONT_HXX + +#include <com/sun/star/uno/Reference.hxx> + +#include <boost/shared_ptr.hpp> + +namespace rtl +{ + class OUString; +} + +namespace com { namespace sun { namespace star { namespace rendering +{ + class XCanvasFont; +} } } } + +/* Definition of Font class */ + +namespace cppcanvas +{ + + class Font + { + public: + virtual ~Font() {} + + virtual ::rtl::OUString getName() const = 0; + virtual double getCellSize() const = 0; + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XCanvasFont > getUNOFont() const = 0; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::Font > FontSharedPtr; +} + +#endif /* _CPPCANVAS_FONT_HXX */ diff --git a/cppcanvas/inc/cppcanvas/polypolygon.hxx b/cppcanvas/inc/cppcanvas/polypolygon.hxx new file mode 100644 index 000000000000..a32e0c19ae50 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/polypolygon.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_POLYPOLYGON_HXX +#define _CPPCANVAS_POLYPOLYGON_HXX + +#include <com/sun/star/uno/Reference.hxx> + +#include <boost/shared_ptr.hpp> +#include <cppcanvas/canvasgraphic.hxx> + +namespace basegfx +{ + class B2DPolygon; + class B2DPolyPolygon; +} + +namespace com { namespace sun { namespace star { namespace rendering +{ + class XPolyPolygon2D; +} } } } + + +/* Definition of PolyPolygon interface */ + +namespace cppcanvas +{ + + /** This interface defines a PolyPolygon canvas object + + Consider this object part of the view, and not of the model + data. Although the given polygon is typically copied and held + internally (to facilitate migration to incompatible canvases), + ::basegfx::B2DPolygon et al. are ref-counted copy-on-write + classes, i.e. memory shouldn't be wasted. On the other hand, + the API polygon created internally _does_ necessarily + duplicate the data held, but can be easily flushed away via + flush(). + */ + class PolyPolygon : public virtual CanvasGraphic + { + public: + virtual void addPolygon( const ::basegfx::B2DPolygon& rPoly ) = 0; + virtual void addPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ) = 0; + + /** Set polygon fill color + */ + virtual void setRGBAFillColor( Color::IntSRGBA ) = 0; + /** Set polygon line color + */ + virtual void setRGBALineColor( Color::IntSRGBA ) = 0; + /** Get polygon fill color + */ + virtual Color::IntSRGBA getRGBAFillColor() const = 0; + /** Get polygon line color + */ + virtual Color::IntSRGBA getRGBALineColor() const = 0; + + virtual void setStrokeWidth( const double& rStrokeWidth ) = 0; + virtual double getStrokeWidth() const = 0; + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XPolyPolygon2D > getUNOPolyPolygon() const = 0; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::PolyPolygon > PolyPolygonSharedPtr; +} + +#endif /* _CPPCANVAS_POLYPOLYGON_HXX */ diff --git a/cppcanvas/inc/cppcanvas/renderer.hxx b/cppcanvas/inc/cppcanvas/renderer.hxx new file mode 100644 index 000000000000..0b8bb43d7e3e --- /dev/null +++ b/cppcanvas/inc/cppcanvas/renderer.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_RENDERER_HXX +#define _CPPCANVAS_RENDERER_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> + +#include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <cppcanvas/canvasgraphic.hxx> +#include <cppcanvas/color.hxx> + +namespace basegfx +{ + class B2DRange; +} + +/* Definition of Renderer interface */ + +namespace cppcanvas +{ + + class Renderer : public virtual CanvasGraphic + { + public: + /** Render subset of metafile to given canvas + + This method renders the given subset of the content to the + associated canvas. + + @param nStartIndex + The index of the first action to be rendered (the indices + correspond roughly to the action indices of the + originating GDIMetaFile. Note, although, that certain + actions, e.g. text, accounts for more than one index: a + text produces as many addressable indices as it has + characters). + + @param nEndIndex + The index of the first action _not_ painted anymore, + i.e. the action after the last action rendered (the + indices correspond roughly to the action indices of the + originating GDIMetaFile. Note, although, that certain + actions, e.g. text, accounts for more than one index: a + text produces as many addressable indices as it has + characters). + + @return whether the rendering finished successfully. + */ + virtual bool drawSubset( sal_Int32 nStartIndex, + sal_Int32 nEndIndex ) const = 0; + + /** Query bounding box of metafile subset + + This method queries the actual bounding box of the given + subset, when rendered on the associated canvas. + + @param nStartIndex + The index of the first action to be rendered (the indices + correspond roughly to the action indices of the + originating GDIMetaFile. Note, although, that certain + actions, e.g. text, accounts for more than one index: a + text produces as many addressable indices as it has + characters). + + @param nEndIndex + The index of the first action _not_ painted anymore, + i.e. the action after the last action rendered (the + indices correspond roughly to the action indices of the + originating GDIMetaFile. Note, although, that certain + actions, e.g. text, accounts for more than one index: a + text produces as many addressable indices as it has + characters). + + @return the bounding box of the specified subset + */ + virtual ::basegfx::B2DRange getSubsetArea( sal_Int32 nStartIndex, + sal_Int32 nEndIndex ) const = 0; + + /** Parameters for the Renderer + */ + struct Parameters + { + /// Optionally forces the fill color attribute for all actions + ::boost::optional< Color::IntSRGBA > maFillColor; + + /// Optionally forces the line color attribute for all actions + ::boost::optional< Color::IntSRGBA > maLineColor; + + /// Optionally forces the text color attribute for all actions + ::boost::optional< Color::IntSRGBA > maTextColor; + + /// Optionally forces the given fontname for all text actions + ::boost::optional< ::rtl::OUString > maFontName; + + /** Optionally transforms all text output actions with the + given matrix (in addition to the overall canvas + transformation). + + Note that the matrix given here is applied to the unit + rect coordinate system, i.e. the metafile is assumed + to be contained in the unit rect. + */ + ::boost::optional< ::basegfx::B2DHomMatrix > maTextTransformation; + + /// Optionally forces the given font weight for all text actions + ::boost::optional< sal_Int8 > maFontWeight; + + /// Optionally forces the given font letter form (italics etc.) for all text actions + ::boost::optional< sal_Int8 > maFontLetterForm; + + /// Optionally forces underlining for all text actions + ::boost::optional< bool > maFontUnderline; + }; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr; +} + +#endif /* _CPPCANVAS_RENDERER_HXX */ diff --git a/cppcanvas/inc/cppcanvas/sprite.hxx b/cppcanvas/inc/cppcanvas/sprite.hxx new file mode 100644 index 000000000000..3a80a8137754 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/sprite.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_SPRITE_HXX +#define _CPPCANVAS_SPRITE_HXX + +#include <com/sun/star/uno/Reference.hxx> + +#include <boost/shared_ptr.hpp> + +namespace basegfx +{ + class B2DHomMatrix; + class B2DPolyPolygon; + class B2DPoint; +} + +namespace com { namespace sun { namespace star { namespace rendering +{ + class XSprite; +} } } } + + +/* Definition of Sprite class */ + +namespace cppcanvas +{ + + class Sprite + { + public: + virtual ~Sprite() {} + + virtual void setAlpha( const double& rAlpha ) = 0; + + /** Set the sprite position on screen + + This method differs from the XSprite::move() insofar, as + no viewstate/renderstate transformations are applied to + the specified position. The given position is interpreted + in device coordinates (i.e. screen pixel) + */ + virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0; + + /** Set the sprite position on screen + + This method sets the sprite position in the view + coordinate system of the parent canvas + */ + virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0; + + virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0; + + /** Set output clipping + + This method differs from the XSprite::clip() insofar, as + no viewstate/renderstate transformations are applied to + the specified clip polygon. The given polygon is + interpreted in device coordinates (i.e. screen pixel) + */ + virtual void setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0; + + /** Set output clipping + + This method applies the clip poly-polygon interpreted in + the view coordinate system of the parent canvas. + */ + virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0; + + virtual void setClip() = 0; + + virtual void show() = 0; + virtual void hide() = 0; + + /** Change the sprite priority + + @param fPriority + New sprite priority. The higher the priority, the further + towards the viewer the sprite appears. That is, sprites + with higher priority appear before ones with lower + priority. + */ + virtual void setPriority( double fPriority ) = 0; + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XSprite > getUNOSprite() const = 0; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::Sprite > SpriteSharedPtr; +} + +#endif /* _CPPCANVAS_SPRITE_HXX */ diff --git a/cppcanvas/inc/cppcanvas/spritecanvas.hxx b/cppcanvas/inc/cppcanvas/spritecanvas.hxx new file mode 100644 index 000000000000..e5fda82d2e41 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/spritecanvas.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_SPRITECANVAS_HXX +#define _CPPCANVAS_SPRITECANVAS_HXX + +#include <sal/types.h> +#include <osl/diagnose.h> +#include <basegfx/vector/b2dsize.hxx> + +#include <boost/shared_ptr.hpp> + + +#include <cppcanvas/bitmapcanvas.hxx> +#include <cppcanvas/sprite.hxx> +#include <cppcanvas/customsprite.hxx> + +namespace com { namespace sun { namespace star { namespace rendering +{ + class XSpriteCanvas; +} } } } + + +/* Definition of SpriteCanvas */ + +namespace cppcanvas +{ + class SpriteCanvas; + + // forward declaration, since cloneSpriteCanvas() also references SpriteCanvas + typedef ::boost::shared_ptr< ::cppcanvas::SpriteCanvas > SpriteCanvasSharedPtr; + + /** SpriteCanvas interface + */ + class SpriteCanvas : public virtual BitmapCanvas + { + public: + virtual bool updateScreen( bool bUpdateAll ) const = 0; + + virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const = 0; + virtual SpriteSharedPtr createClonedSprite( const SpriteSharedPtr& ) const = 0; + + // shared_ptr does not allow for covariant return types + SpriteCanvasSharedPtr cloneSpriteCanvas() const + { + SpriteCanvasSharedPtr p( ::boost::dynamic_pointer_cast< SpriteCanvas >(this->clone()) ); + OSL_ENSURE(p.get(), "SpriteCanvas::cloneSpriteCanvas(): dynamic cast failed"); + return p; + } + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XSpriteCanvas > getUNOSpriteCanvas() const = 0; + }; + +} + +#endif /* _CPPCANVAS_SPRITECANVAS_HXX */ diff --git a/cppcanvas/inc/cppcanvas/text.hxx b/cppcanvas/inc/cppcanvas/text.hxx new file mode 100644 index 000000000000..6fd54b4e0106 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/text.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_TEXT_HXX +#define _CPPCANVAS_TEXT_HXX + +#include <boost/shared_ptr.hpp> +#include <cppcanvas/canvasgraphic.hxx> + + +namespace rtl +{ + class OUString; +} + + +/* Definition of Text interface */ + +namespace cppcanvas +{ + class Text : public virtual CanvasGraphic + { + public: + virtual void setFont( const FontSharedPtr& ) = 0; + virtual FontSharedPtr getFont() = 0; + }; + + typedef ::boost::shared_ptr< ::cppcanvas::Text > TextSharedPtr; +} + +#endif /* _CPPCANVAS_TEXT_HXX */ diff --git a/cppcanvas/inc/cppcanvas/vclfactory.hxx b/cppcanvas/inc/cppcanvas/vclfactory.hxx new file mode 100644 index 000000000000..b95102f31472 --- /dev/null +++ b/cppcanvas/inc/cppcanvas/vclfactory.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPCANVAS_VCLFACTORY_HXX +#define _CPPCANVAS_VCLFACTORY_HXX + +#include <cppcanvas/canvas.hxx> +#include <cppcanvas/bitmapcanvas.hxx> +#include <cppcanvas/spritecanvas.hxx> +#include <cppcanvas/polypolygon.hxx> +#include <cppcanvas/bitmap.hxx> +#include <cppcanvas/renderer.hxx> +#include <cppcanvas/text.hxx> +#include <cppcanvas/sprite.hxx> + + +class Window; +class Bitmap; +class BitmapEx; +class Polygon; +class PolyPolygon; +class Size; +class Graphic; +class GDIMetaFile; +class Animation; + +namespace rtl +{ + class OUString; +} +namespace com { namespace sun { namespace star { namespace rendering +{ + class XBitmapCanvas; + class XSpriteCanvas; +} } } } + +/* Definition of VCLFactory class */ + +namespace cppcanvas +{ + /** The VCLFactory creates Canvas objects for various VCL + OutputDevice primitives, such as windows, polygons, bitmaps + and metafiles. + + Please note that the objects created for a specific Canvas can + only be drawn on exactly that canvas. You have to regenerate + them for different canvases. + */ + class VCLFactory + { + public: + static VCLFactory& getInstance(); + + BitmapCanvasSharedPtr createCanvas( const ::Window& rVCLWindow ); + BitmapCanvasSharedPtr createCanvas( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XBitmapCanvas >& xCanvas ); + + SpriteCanvasSharedPtr createSpriteCanvas( const ::Window& rVCLWindow ) const; + SpriteCanvasSharedPtr createSpriteCanvas( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XSpriteCanvas >& xCanvas ) const; + SpriteCanvasSharedPtr createFullscreenSpriteCanvas( const ::Window& rVCLWindow, const Size& rFullscreenSize ) const; + + /** Create a polygon from a tools::Polygon + + The created polygon initially has the same size in user + coordinate space as the source polygon + */ + PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::Polygon& rPoly ) const; + PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::PolyPolygon& rPoly ) const; + + /** Create an uninitialized bitmap with the given size + */ + BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::Size& rSize ) const; + + /** Create an uninitialized alpha bitmap with the given size + */ + BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::Size& rSize ) const; + + /** Create a bitmap from a VCL Bitmap + */ + BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::Bitmap& rBitmap ) const; + BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::BitmapEx& rBmpEx ) const; + + /** Create a renderer object from a Graphic + + The created renderer initially draws the graphic + one-by-one units large, in user coordinate space + */ + RendererSharedPtr createRenderer( const CanvasSharedPtr& rCanvas, + const ::Graphic& rGraphic, + const Renderer::Parameters& rParms ) const; + /** Create a renderer object from a Metafile + + The created renderer initially draws the metafile + one-by-one units large, in user coordinate space + */ + RendererSharedPtr createRenderer( const CanvasSharedPtr& rCanvas, + const ::GDIMetaFile& rMtf, + const Renderer::Parameters& rParms ) const; + + /** Create an animated sprite from a VCL animation + */ + SpriteSharedPtr createAnimatedSprite( const SpriteCanvasSharedPtr&, const ::Animation& rAnim ) const; + + /** Create a text portion with the given content string + */ + TextSharedPtr createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const; + + private: + friend struct InitInstance; + + // singleton + VCLFactory(); + ~VCLFactory(); + + // default: disabled copy/assignment + VCLFactory(const VCLFactory&); + VCLFactory& operator=( const VCLFactory& ); + }; + +} + +#endif /* _CPPCANVAS_VCLFACTORY_HXX */ |