Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_RENDERGRAPHICRASTERIZER_HXX
30 : : #define _SV_RENDERGRAPHICRASTERIZER_HXX
31 : :
32 : : #include <vcl/rendergraphic.hxx>
33 : : #include <vcl/bitmapex.hxx>
34 : :
35 : : #include <com/sun/star/graphic/XGraphicRasterizer.hpp>
36 : :
37 : : #include <memory>
38 : : #include <deque>
39 : :
40 : : #define VCL_RASTERIZER_UNLIMITED_EXTENT 0x00000000
41 : : #define VCL_RASTERIZER_DEFAULT_EXTENT 0xffffffff
42 : :
43 : : namespace vcl
44 : : {
45 : : // ---------------------------
46 : : // - RenderGraphicRasterizer -
47 : : // ---------------------------
48 : :
49 : : class VCL_DLLPUBLIC RenderGraphicRasterizer
50 : : {
51 : : public:
52 : :
53 : : RenderGraphicRasterizer( const RenderGraphic& rData );
54 : :
55 : :
56 : : RenderGraphicRasterizer( const RenderGraphicRasterizer& rRenderGraphicRasterizer );
57 : :
58 : : virtual ~RenderGraphicRasterizer();
59 : :
60 : : RenderGraphicRasterizer& operator=( const RenderGraphicRasterizer& rRenderGraphicRasterizer );
61 : :
62 : 0 : inline const RenderGraphic& GetRenderGraphic() const
63 : : {
64 : 0 : return( maRenderGraphic );
65 : : }
66 : :
67 : : const Size& GetDefaultSizePixel() const;
68 : :
69 : : BitmapEx GetReplacement() const;
70 : :
71 : : virtual Size GetPrefSize() const;
72 : :
73 : : virtual MapMode GetPrefMapMode() const;
74 : :
75 : : virtual const BitmapEx& Rasterize( const Size& rSizePixel_UnrotatedUnsheared,
76 : : double fRotateAngle = 0.0,
77 : : double fShearAngleX = 0.0,
78 : : double fShearAngleY = 0.0,
79 : : sal_uInt32 nMaxExtent = VCL_RASTERIZER_DEFAULT_EXTENT ) const;
80 : :
81 : : protected:
82 : :
83 : : RenderGraphic maRenderGraphic;
84 : : mutable com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicRasterizer > mxRasterizer;
85 : :
86 : : virtual void InitializeRasterizer();
87 : :
88 : : private:
89 : :
90 : : RenderGraphicRasterizer();
91 : :
92 : : mutable BitmapEx maBitmapEx;
93 : : mutable Size maDefaultSizePixel;
94 : : mutable double mfRotateAngle;
95 : : mutable double mfShearAngleX;
96 : : mutable double mfShearAngleY;
97 : :
98 : : private:
99 : :
100 : : typedef ::std::deque< RenderGraphicRasterizer > RenderGraphicRasterizerCache;
101 : :
102 : : static RenderGraphicRasterizerCache& ImplGetCache();
103 : :
104 : : static bool ImplInitializeFromCache( RenderGraphicRasterizer& rRasterizer );
105 : : static bool ImplRasterizeFromCache( RenderGraphicRasterizer& rRasterizer,
106 : : const Size& rSizePixel, double fRotateAngle,
107 : : double fShearAngleX, double fShearAngleY );
108 : : static void ImplUpdateCache( const RenderGraphicRasterizer& rRasterizer );
109 : : };
110 : : }
111 : :
112 : : #endif // _SV_RENDERGRAPHICRASTERIZER_HXX
113 : :
114 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|