[Libreoffice-commits] core.git: Branch 'feature/slideshowprimitives' - cppcanvas/CppunitTest_cppcanvas_test.mk cppcanvas/Library_cppcanvas.mk cppcanvas/Library_mtfrenderer.mk cppcanvas/Makefile cppcanvas/Module_cppcanvas.mk cppcanvas/qa cppcanvas/README cppcanvas/source
Thorsten Behrens
thb at documentfoundation.org
Tue Oct 29 19:09:27 CET 2013
cppcanvas/CppunitTest_cppcanvas_test.mk | 60
cppcanvas/Library_cppcanvas.mk | 74
cppcanvas/Library_mtfrenderer.mk | 42
cppcanvas/Makefile | 14
cppcanvas/Module_cppcanvas.mk | 34
cppcanvas/README | 5
cppcanvas/qa/unit/test.cxx | 93
cppcanvas/source/inc/action.hxx | 156
cppcanvas/source/inc/canvasgraphichelper.hxx | 78
cppcanvas/source/inc/implrenderer.hxx | 342 -
cppcanvas/source/inc/outdevstate.hxx | 126
cppcanvas/source/inc/tools.hxx | 50
cppcanvas/source/mtfrenderer/bitmapaction.cxx | 229 -
cppcanvas/source/mtfrenderer/bitmapaction.hxx | 75
cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx | 84
cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx | 89
cppcanvas/source/mtfrenderer/emfplus.cxx | 1940 ---------
cppcanvas/source/mtfrenderer/implrenderer.cxx | 3104 ---------------
cppcanvas/source/mtfrenderer/lineaction.cxx | 158
cppcanvas/source/mtfrenderer/lineaction.hxx | 67
cppcanvas/source/mtfrenderer/mtftools.cxx | 621 ---
cppcanvas/source/mtfrenderer/mtftools.hxx | 207 -
cppcanvas/source/mtfrenderer/pointaction.cxx | 178
cppcanvas/source/mtfrenderer/pointaction.hxx | 72
cppcanvas/source/mtfrenderer/polypolyaction.cxx | 514 --
cppcanvas/source/mtfrenderer/polypolyaction.hxx | 95
cppcanvas/source/mtfrenderer/textaction.cxx | 2283 -----------
cppcanvas/source/mtfrenderer/textaction.hxx | 95
cppcanvas/source/mtfrenderer/transparencygroupaction.cxx | 499 --
cppcanvas/source/mtfrenderer/transparencygroupaction.hxx | 106
cppcanvas/source/tools/canvasgraphichelper.cxx | 131
cppcanvas/source/tools/tools.cxx | 54
cppcanvas/source/uno/mtfrenderer.component | 15
cppcanvas/source/uno/uno_mtfrenderer.cxx | 58
cppcanvas/source/uno/uno_mtfrenderer.hxx | 44
cppcanvas/source/wrapper/basegfxfactory.cxx | 131
cppcanvas/source/wrapper/implbitmap.cxx | 118
cppcanvas/source/wrapper/implbitmap.hxx | 72
cppcanvas/source/wrapper/implbitmapcanvas.cxx | 65
cppcanvas/source/wrapper/implbitmapcanvas.hxx | 64
cppcanvas/source/wrapper/implcanvas.cxx | 133
cppcanvas/source/wrapper/implcanvas.hxx | 94
cppcanvas/source/wrapper/implcolor.cxx | 60
cppcanvas/source/wrapper/implcolor.hxx | 56
cppcanvas/source/wrapper/implcustomsprite.cxx | 74
cppcanvas/source/wrapper/implcustomsprite.hxx | 63
cppcanvas/source/wrapper/implfont.cxx | 83
cppcanvas/source/wrapper/implfont.hxx | 69
cppcanvas/source/wrapper/implpolypolygon.cxx | 193
cppcanvas/source/wrapper/implpolypolygon.hxx | 87
cppcanvas/source/wrapper/implsprite.cxx | 202
cppcanvas/source/wrapper/implsprite.hxx | 78
cppcanvas/source/wrapper/implspritecanvas.cxx | 138
cppcanvas/source/wrapper/implspritecanvas.hxx | 94
cppcanvas/source/wrapper/vclfactory.cxx | 113
55 files changed, 13779 deletions(-)
New commits:
commit 5705790b8e587306111bb7fad56e86061545bc91
Author: Thorsten Behrens <thb at documentfoundation.org>
Date: Tue Oct 29 19:08:11 2013 +0100
Die, wrapper code, die.
Change-Id: I987703958621abb38d877b3089aaaa7d0f97f5e9
diff --git a/cppcanvas/CppunitTest_cppcanvas_test.mk b/cppcanvas/CppunitTest_cppcanvas_test.mk
deleted file mode 100644
index 8112fd3..0000000
--- a/cppcanvas/CppunitTest_cppcanvas_test.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-#*************************************************************************
-
-$(eval $(call gb_CppunitTest_CppunitTest,cppcanvas_test))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,cppcanvas_test, \
- cppcanvas/qa/unit/test \
-))
-
-$(eval $(call gb_CppunitTest_unset_headless,cppcanvas_test))
-
-$(eval $(call gb_CppunitTest_use_external,cppcanvas_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_use_libraries,cppcanvas_test, \
- cppcanvas \
- basegfx \
- canvastools \
- comphelper \
- cppu \
- cppuhelper \
- i18nlangtag \
- sal \
- svt \
- test \
- tl \
- vcl \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_CppunitTest_use_api,cppcanvas_test,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_CppunitTest_use_ure,cppcanvas_test))
-
-$(eval $(call gb_CppunitTest_use_components,cppcanvas_test,\
- canvas/source/cairo/cairocanvas \
- canvas/source/factory/canvasfactory \
- configmgr/source/configmgr \
- fileaccess/source/fileacc \
- i18npool/util/i18npool \
- linguistic/source/lng \
- package/util/package2 \
- sax/source/expatwrap/expwrap \
- ucb/source/core/ucb1 \
- unoxml/source/service/unoxml \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,cppcanvas_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/cppcanvas/Library_cppcanvas.mk b/cppcanvas/Library_cppcanvas.mk
deleted file mode 100644
index 7f69cf9..0000000
--- a/cppcanvas/Library_cppcanvas.mk
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-$(eval $(call gb_Library_Library,cppcanvas))
-
-$(eval $(call gb_Library_set_include,cppcanvas,\
- -I$(SRCDIR)/cppcanvas/source/inc \
- $$(INCLUDE) \
-))
-
-$(eval $(call gb_Library_use_sdk_api,cppcanvas))
-$(eval $(call gb_Library_add_defs,cppcanvas,\
- -DCPPCANVAS_DLLIMPLEMENTATION \
-))
-
-$(eval $(call gb_Library_use_external,cppcanvas,boost_headers))
-
-$(eval $(call gb_Library_use_libraries,cppcanvas,\
- basegfx \
- canvastools \
- comphelper \
- cppu \
- cppuhelper \
- i18nlangtag \
- sal \
- svt \
- tl \
- vcl \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_Library_add_exception_objects,cppcanvas,\
- cppcanvas/source/mtfrenderer/bitmapaction \
- cppcanvas/source/mtfrenderer/cachedprimitivebase \
- cppcanvas/source/mtfrenderer/emfplus \
- cppcanvas/source/mtfrenderer/implrenderer \
- cppcanvas/source/mtfrenderer/lineaction \
- cppcanvas/source/mtfrenderer/mtftools \
- cppcanvas/source/mtfrenderer/pointaction \
- cppcanvas/source/mtfrenderer/polypolyaction \
- cppcanvas/source/mtfrenderer/textaction \
- cppcanvas/source/mtfrenderer/transparencygroupaction \
- cppcanvas/source/tools/canvasgraphichelper \
- cppcanvas/source/tools/tools \
- cppcanvas/source/wrapper/basegfxfactory \
- cppcanvas/source/wrapper/implbitmap \
- cppcanvas/source/wrapper/implbitmapcanvas \
- cppcanvas/source/wrapper/implcanvas \
- cppcanvas/source/wrapper/implcolor \
- cppcanvas/source/wrapper/implcustomsprite \
- cppcanvas/source/wrapper/implfont \
- cppcanvas/source/wrapper/implpolypolygon \
- cppcanvas/source/wrapper/implsprite \
- cppcanvas/source/wrapper/implspritecanvas \
- cppcanvas/source/wrapper/vclfactory \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/cppcanvas/Library_mtfrenderer.mk b/cppcanvas/Library_mtfrenderer.mk
deleted file mode 100644
index 4a33ac0..0000000
--- a/cppcanvas/Library_mtfrenderer.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-$(eval $(call gb_Library_Library,mtfrenderer))
-
-$(eval $(call gb_Library_set_componentfile,mtfrenderer,cppcanvas/source/uno/mtfrenderer))
-
-$(eval $(call gb_Library_use_external,mtfrenderer,boost_headers))
-
-$(eval $(call gb_Library_use_libraries,mtfrenderer,\
- sal \
- cppu \
- cppuhelper \
- comphelper \
- cppcanvas \
- basegfx \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_Library_use_sdk_api,mtfrenderer))
-
-$(eval $(call gb_Library_add_exception_objects,mtfrenderer,\
- cppcanvas/source/uno/uno_mtfrenderer \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/cppcanvas/Makefile b/cppcanvas/Makefile
deleted file mode 100644
index 0997e62..0000000
--- a/cppcanvas/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
-
-include $(module_directory)/../solenv/gbuild/partial_build.mk
-
-# vim: set noet sw=4 ts=4:
diff --git a/cppcanvas/Module_cppcanvas.mk b/cppcanvas/Module_cppcanvas.mk
deleted file mode 100644
index 9894f9c..0000000
--- a/cppcanvas/Module_cppcanvas.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-$(eval $(call gb_Module_Module,cppcanvas))
-
-$(eval $(call gb_Module_add_targets,cppcanvas,\
- Library_cppcanvas \
- Library_mtfrenderer \
-))
-
-# FIXME: should generalize these ...
-ifeq ($(ENABLE_CAIRO_CANVAS),TRUE)
-$(eval $(call gb_Module_add_check_targets,cppcanvas,\
- CppunitTest_cppcanvas_test \
-))
-endif
-
-# vim: set noet sw=4 ts=4:
diff --git a/cppcanvas/README b/cppcanvas/README
deleted file mode 100644
index 1e90831..0000000
--- a/cppcanvas/README
+++ /dev/null
@@ -1,5 +0,0 @@
-Helper C++ classes for [[canvas]], plus a GDIMetaFile-to-XCanvas converter.
-
-== EMF+ ==
-
-For cppcanvas/source/mtfrenderer, see the README in vcl (the EMF+ part).
diff --git a/cppcanvas/qa/unit/test.cxx b/cppcanvas/qa/unit/test.cxx
deleted file mode 100644
index af652a3..0000000
--- a/cppcanvas/qa/unit/test.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <test/bootstrapfixture.hxx>
-
-#include <osl/file.hxx>
-#include <osl/process.h>
-#include <vcl/svapp.hxx>
-#include <vcl/wrkwin.hxx>
-#include <vcl/canvastools.hxx>
-
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#include <com/sun/star/rendering/XBitmap.hpp>
-#include <com/sun/star/rendering/XCanvas.hpp>
-#include <com/sun/star/rendering/XBitmapCanvas.hpp>
-
-using namespace ::com::sun::star;
-
-class CanvasTest : public test::BootstrapFixture
-{
-public:
- CanvasTest() : BootstrapFixture(true, false) {}
-
- void testComposite();
-
- CPPUNIT_TEST_SUITE(CanvasTest);
- CPPUNIT_TEST(testComposite);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void CanvasTest::testComposite()
-{
-#ifdef LINUX
- Window* pWin = new WorkWindow( (Window *)NULL );
- CPPUNIT_ASSERT( pWin != NULL );
-
- uno::Reference<rendering::XCanvas> xCanvas = pWin->GetCanvas ();
- if( !xCanvas.is() )
- return; // can't get a canvas working at all - truly headless ?
-
- // a huge canvas ...
- Size aSize (1, 1);
- uno::Reference<rendering::XBitmap> xBitmap;
- xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap(
- vcl::unotools::integerSize2DFromSize( aSize ) );
- CPPUNIT_ASSERT( xBitmap.is() );
-
- uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap, uno::UNO_QUERY );
- CPPUNIT_ASSERT( xBitmapCanvas.is() );
-
- BitmapEx aBitmapEx;
- {
- // clear the canvas and basic sanity check ...
- xBitmapCanvas->clear();
- CPPUNIT_ASSERT( aBitmapEx.Create( xBitmapCanvas, aSize ) );
- CPPUNIT_ASSERT( aBitmapEx.IsAlpha() );
- CPPUNIT_ASSERT( aBitmapEx.GetAlpha() );
- }
-
- {
- // render something
- rendering::RenderState aDefaultState;
- uno::Sequence< double > aRedTransparent( 4 );
- aRedTransparent[0] = 1.0; // R
- aRedTransparent[1] = 0.0; // G
- aRedTransparent[2] = 0.0; // B
- aRedTransparent[3] = 0.5; // A
- aDefaultState.DeviceColor = aRedTransparent;
-#if 0
- // words fail me to describe the sheer beauty of allocating an UNO
- // object to represent a polygon, and manually handling the ViewState
- // and there being no public helper for this - to render ... a rectangle.
- XCachedPrimitive fillPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState )
-#endif
- }
-
-#endif
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(CanvasTest);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/inc/action.hxx b/cppcanvas/source/inc/action.hxx
deleted file mode 100644
index 3beaa8c..0000000
--- a/cppcanvas/source/inc/action.hxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CPPCANVAS_ACTION_HXX
-#define _CPPCANVAS_ACTION_HXX
-
-#include <sal/types.h>
-
-#include <boost/shared_ptr.hpp>
-
-namespace basegfx
-{
- class B2DHomMatrix;
- class B2DRange;
-}
-
-
-/* Definition of Action interface */
-
-namespace cppcanvas
-{
- namespace internal
- {
- /** Interface for internal render actions
-
- This interface is implemented by all objects generated
- from the metafile renderer, and corresponds roughly to the
- VCL meta action.
- */
- class Action
- {
- public:
- /** Used for rendering action subsets
-
- There are several cases where an Action might have
- subsettable content, e.g. text, or referenced
- metafiles, like the transparent action.
-
- Generally, at the metafile renderer, all actions are
- 'flattened' out, i.e. a meta action rendering the
- string "Hello" counts five indices, and a transparent
- action containing a metafile with 100 actions counts
- at least 100 indices (contained transparency or text
- actions recursively add to this value). From the
- outside, the subset to render is referenced via this
- flat index range
- */
- struct Subset
- {
- /** Denotes start of the subset.
-
- The index given here specifies the first subaction
- to render.
- */
- sal_Int32 mnSubsetBegin;
-
- /** Denotes end of the subset
-
- The index given here specifies the first subaction
- <em>not<em> to render, i.e. one action behind the
- subset to be rendered
- */
- sal_Int32 mnSubsetEnd;
- };
-
- virtual ~Action() {}
-
- /** Render this action to the associated canvas
-
- @param rTransformation
- Transformation matrix to apply before rendering
-
- @return true, if rendering was successful. If
- rendering failed, false is returned.
- */
- virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const = 0;
-
- /** Render the given part of the action to the associated
- canvas.
-
- @param rTransformation
- Transformation matrix to apply before rendering
-
- @param rSubset
- Subset of the action to render. See Subset description
- for index semantics.
-
- @return true, if rendering was successful. If the
- specified subset is invalid for this action, or if
- rendering failed for other reasons, false is returned.
- */
- virtual bool renderSubset( const ::basegfx::B2DHomMatrix& rTransformation,
- const Subset& rSubset ) const = 0;
-
- /** Query bounds of this action on the associated canvas
-
- @param rTransformation
- Transformation matrix to apply
-
- @return the bounds for this action in device
- coordinate space.
- */
- virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const = 0;
-
- /** Query bounds for the given part of the action on the
- associated canvas.
-
- @param rTransformation
- Transformation matrix to apply.
-
- @param rSubset
- Subset of the action to query. See Subset description
- for index semantics.
-
- @return the bounds for the given subset in device
- coordinate space.
- */
- virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
- const Subset& rSubset ) const = 0;
-
- /** Query action count.
-
- This method returns the number of subset actions
- contained in this action. The render( Subset ) method
- must accept subset ranges up to the value returned
- here.
-
- @return the number of subset actions
- */
- virtual sal_Int32 getActionCount() const = 0;
- };
-
- typedef ::boost::shared_ptr< Action > ActionSharedPtr;
-
- }
-}
-
-#endif /* _CPPCANVAS_ACTION_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/inc/canvasgraphichelper.hxx b/cppcanvas/source/inc/canvasgraphichelper.hxx
deleted file mode 100644
index f0ab8bc..0000000
--- a/cppcanvas/source/inc/canvasgraphichelper.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CPPCANVAS_CANVASGRAPHICHELPER_HXX
-#define _CPPCANVAS_CANVASGRAPHICHELPER_HXX
-
-#include <com/sun/star/rendering/RenderState.hpp>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-
-#include <cppcanvas/canvasgraphic.hxx>
-
-#include <boost/optional.hpp>
-
-namespace com { namespace sun { namespace star { namespace rendering
-{
- class XGraphicDevice;
-} } } }
-
-
-/* Definition of CanvasGraphicHelper class */
-
-namespace cppcanvas
-{
-
- namespace internal
- {
-
- class CanvasGraphicHelper : public virtual CanvasGraphic
- {
- public:
- CanvasGraphicHelper( const CanvasSharedPtr& rParentCanvas );
-
- // CanvasGraphic implementation
- virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix );
- virtual ::basegfx::B2DHomMatrix getTransformation() const;
- virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly );
- virtual void setClip();
- virtual ::basegfx::B2DPolyPolygon const* getClip() const;
- virtual void setCompositeOp( CompositeOp aOp );
- virtual CompositeOp getCompositeOp() const;
-
- protected:
- // for our clients
- // ===============
- CanvasSharedPtr getCanvas() const;
- ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > getGraphicDevice() const;
- const ::com::sun::star::rendering::RenderState& getRenderState() const;
-
- private:
- mutable ::com::sun::star::rendering::RenderState maRenderState;
-
- boost::optional<basegfx::B2DPolyPolygon> maClipPolyPolygon;
- CanvasSharedPtr mpCanvas;
- ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > mxGraphicDevice;
- };
-
- }
-}
-
-#endif /* _CPPCANVAS_CANVASGRAPHICHELPER_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
deleted file mode 100644
index c70bf54..0000000
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ /dev/null
@@ -1,342 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CPPCANVAS_IMPLRENDERER_HXX
-#define _CPPCANVAS_IMPLRENDERER_HXX
-
-#include <sal/types.h>
-
-#include <boost/shared_ptr.hpp>
-#include <cppcanvas/renderer.hxx>
-#include <cppcanvas/canvas.hxx>
-
-#include <canvasgraphichelper.hxx>
-#include <action.hxx>
-#include <outdevstate.hxx>
-
-#include <vector>
-#include <map>
-
-class GDIMetaFile;
-class VirtualDevice;
-class Gradient;
-class Rectangle;
-class Font;
-class PolyPolygon;
-class Point;
-class MetaCommentAction;
-
-namespace basegfx {
- class B2DPolyPolygon;
- class B2DPolygon;
-}
-
-namespace cppcanvas
-{
-
- namespace internal
- {
- struct OutDevState;
- struct ActionFactoryParameters;
- struct XForm;
-
- struct EMFPObject
- {
- virtual ~EMFPObject() {}
- };
-
- // state stack of OutputDevice, to correctly handle
- // push/pop actions
- class VectorOfOutDevStates
- {
- public:
- OutDevState& getState();
- const OutDevState& getState() const;
- void pushState(sal_uInt16 nFlags);
- void popState();
- void clearStateStack();
- private:
- ::std::vector< OutDevState > m_aStates;
- };
-
- // EMF+
- // TODO: replace?
- struct XForm
- {
- float eM11;
- float eM12;
- float eM21;
- float eM22;
- float eDx;
- float eDy;
- XForm()
- {
- SetIdentity ();
- };
-
- void SetIdentity ()
- {
- eM11 = eM22 = 1.0f;
- eDx = eDy = eM12 = eM21 = 0.0f;
- }
-
- void Set (float m11, float m12, float dx, float m21, float m22, float dy)
- {
- eM11 = m11;
- eM12 = m12;
- eDx = dx;
- eM21 = m21;
- eM22 = m22;
- eDy = dy;
- }
-
- void Set (XForm f)
- {
- eM11 = f.eM11;
- eM12 = f.eM12;
- eM21 = f.eM21;
- eM22 = f.eM22;
- eDx = f.eDx;
- eDy = f.eDy;
- }
-
- void Multiply (float m11, float m12, float dx, float m21, float m22, float dy)
- {
- eM11 = eM11*m11 + eM12*m21;
- eM12 = eM11*m12 + eM12*m22;
- eM21 = eM21*m11 + eM22*m21;
- eM22 = eM21*m12 + eM22*m22;
- eDx *= eDx*m11 + eDy*m21 + dx;
- eDy *= eDx*m12 + eDy*m22 + dy;
- }
-
- void Multiply (XForm f)
- {
- eM11 = eM11*f.eM11 + eM12*f.eM21;
- eM12 = eM11*f.eM12 + eM12*f.eM22;
- eM21 = eM21*f.eM11 + eM22*f.eM21;
- eM22 = eM21*f.eM12 + eM22*f.eM22;
- eDx *= eDx*f.eM11 + eDy*f.eM21 + f.eDx;
- eDy *= eDx*f.eM12 + eDy*f.eM22 + f.eDy;
- }
-
-#ifdef OSL_BIGENDIAN
-// currently unused
-static float GetSwapFloat( SvStream& rSt )
-{
- float fTmp;
- sal_Int8* pPtr = (sal_Int8*)&fTmp;
- rSt >> pPtr[3] >> pPtr[2] >> pPtr[1] >> pPtr[0]; // Little Endian <-> Big Endian switch
- return fTmp;
-}
-#endif
-
- friend SvStream& operator>>( SvStream& rIn, XForm& rXForm )
- {
- if ( sizeof( float ) != 4 )
- {
- OSL_FAIL( "EnhWMFReader::sizeof( float ) != 4" );
- rXForm = XForm();
- }
- else
- {
-#ifdef OSL_BIGENDIAN
- rXForm.eM11 = GetSwapFloat( rIn );
- rXForm.eM12 = GetSwapFloat( rIn );
- rXForm.eM21 = GetSwapFloat( rIn );
- rXForm.eM22 = GetSwapFloat( rIn );
- rXForm.eDx = GetSwapFloat( rIn );
- rXForm.eDy = GetSwapFloat( rIn );
-#else
- rIn >> rXForm.eM11 >> rXForm.eM12 >> rXForm.eM21 >> rXForm.eM22
- >> rXForm.eDx >> rXForm.eDy;
-#endif
- }
- return rIn;
- }
- };
-
- // EMF+
- typedef struct {
- XForm aWorldTransform;
- OutDevState aDevState;
- } EmfPlusGraphicState;
-
- typedef ::std::map<int,EmfPlusGraphicState> GraphicStateMap;
-
- class ImplRenderer : public virtual Renderer, protected CanvasGraphicHelper
- {
- public:
- ImplRenderer( const CanvasSharedPtr& rCanvas,
- const GDIMetaFile& rMtf,
- const Parameters& rParms );
-
- virtual ~ImplRenderer();
-
- virtual bool draw() const;
- virtual bool drawSubset( sal_Int32 nStartIndex,
- sal_Int32 nEndIndex ) const;
- virtual ::basegfx::B2DRange getSubsetArea( sal_Int32 nStartIndex,
- sal_Int32 nEndIndex ) const;
-
-
- // element of the Renderer's action vector. Need to be
- // public, since some functors need it, too.
- struct MtfAction
- {
- MtfAction( const ActionSharedPtr& rAction,
- sal_Int32 nOrigIndex ) :
- mpAction( rAction ),
- mnOrigIndex( nOrigIndex )
- {
- }
-
- ActionSharedPtr mpAction;
- sal_Int32 mnOrigIndex;
- };
-
- // prefetched and prepared canvas actions
- // (externally not visible)
- typedef ::std::vector< MtfAction > ActionVector;
-
- /* EMF+ */
- void ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false);
- void ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags);
- void MapToDevice (double &x, double &y);
- ::basegfx::B2DPoint Map (double ix, double iy);
- ::basegfx::B2DSize MapSize (double iwidth, double iheight);
- void GraphicStatePush (GraphicStateMap& map, sal_Int32 index, OutDevState& rState);
- void GraphicStatePop (GraphicStateMap& map, sal_Int32 index, OutDevState& rState);
-
- private:
- // default: disabled copy/assignment
- ImplRenderer(const ImplRenderer&);
- ImplRenderer& operator=( const ImplRenderer& );
-
- void updateClipping( const ::basegfx::B2DPolyPolygon& rClipPoly,
- const ActionFactoryParameters& rParms,
- bool bIntersect );
-
- void updateClipping( const ::Rectangle& rClipRect,
- const ActionFactoryParameters& rParms,
- bool bIntersect );
-
- ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XCanvasFont > createFont( double& o_rFontRotation,
- const ::Font& rFont,
- const ActionFactoryParameters& rParms ) const;
- bool createActions( GDIMetaFile& rMtf,
- const ActionFactoryParameters& rParms,
- bool bSubsettableActions );
- bool createFillAndStroke( const ::basegfx::B2DPolyPolygon& rPolyPoly,
- const ActionFactoryParameters& rParms );
- bool createFillAndStroke( const ::basegfx::B2DPolygon& rPoly,
- const ActionFactoryParameters& rParms );
- void skipContent( GDIMetaFile& rMtf,
- const char* pCommentString,
- sal_Int32& io_rCurrActionIndex ) const;
-
- bool isActionContained( GDIMetaFile& rMtf,
- const char* pCommentString,
- sal_uInt16 nType ) const;
-
- void createGradientAction( const ::PolyPolygon& rPoly,
- const ::Gradient& rGradient,
- const ActionFactoryParameters& rParms,
- bool bIsPolygonRectangle,
- bool bSubsettableActions );
-
- void createTextAction( const ::Point& rStartPoint,
- const OUString rString,
- int nIndex,
- int nLength,
- const sal_Int32* pCharWidths,
- const ActionFactoryParameters& rParms,
- bool bSubsettable );
-
- bool getSubsetIndices( sal_Int32& io_rStartIndex,
- sal_Int32& io_rEndIndex,
- ActionVector::const_iterator& o_rRangeBegin,
- ActionVector::const_iterator& o_rRangeEnd ) const;
-
- void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, sal_Bool bUseWholeStream = sal_False);
-
- /* EMF+ */
- void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
- double setFont( sal_uInt8 objectId, const ActionFactoryParameters& rParms, OutDevState& rState );
- void EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex);
- void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
-
- ActionVector maActions;
-
- /* EMF+ */
- XForm aBaseTransform;
- XForm aWorldTransform;
- EMFPObject* aObjects [256];
- float fPageScale;
- sal_Int32 nOriginX;
- sal_Int32 nOriginY;
- sal_Int32 nHDPI;
- sal_Int32 nVDPI;
- /* EMF+ emf header info */
- sal_Int32 nFrameLeft;
- sal_Int32 nFrameTop;
- sal_Int32 nFrameRight;
- sal_Int32 nFrameBottom;
- sal_Int32 nPixX;
- sal_Int32 nPixY;
- sal_Int32 nMmX;
- sal_Int32 nMmY;
- /* multipart object data */
- bool mbMultipart;
- sal_uInt16 mMFlags;
- SvMemoryStream mMStream;
- /* emf+ graphic state stack */
- GraphicStateMap mGSStack;
- GraphicStateMap mGSContainerStack;
- };
-
-
- /// Common parameters when creating actions
- struct ActionFactoryParameters
- {
- ActionFactoryParameters( VectorOfOutDevStates& rStates,
- const CanvasSharedPtr& rCanvas,
- ::VirtualDevice& rVDev,
- const Renderer::Parameters& rParms,
- sal_Int32& io_rCurrActionIndex ) :
- mrStates(rStates),
- mrCanvas(rCanvas),
- mrVDev(rVDev),
- mrParms(rParms),
- mrCurrActionIndex(io_rCurrActionIndex)
- {}
-
- VectorOfOutDevStates& mrStates;
- const CanvasSharedPtr& mrCanvas;
- ::VirtualDevice& mrVDev;
- const Renderer::Parameters& mrParms;
- sal_Int32& mrCurrActionIndex;
- };
- }
-}
-
-#endif /* _CPPCANVAS_IMPLRENDERER_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/inc/outdevstate.hxx b/cppcanvas/source/inc/outdevstate.hxx
deleted file mode 100644
index 26e1026..0000000
--- a/cppcanvas/source/inc/outdevstate.hxx
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CPPCANVAS_OUTDEVSTATE_HXX
-#define _CPPCANVAS_OUTDEVSTATE_HXX
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <com/sun/star/rendering/StringContext.hpp>
-#include <com/sun/star/rendering/RenderState.hpp>
-#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
-#include <com/sun/star/rendering/XCanvasFont.hpp>
-#include <com/sun/star/rendering/TextDirection.hpp>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <vcl/fntstyle.hxx>
-#include <vcl/vclenum.hxx>
-#include <vcl/outdev.hxx>
-
-
-namespace cppcanvas
-{
- namespace internal
- {
- struct OutDevState
- {
- OutDevState() :
- clip(),
- clipRect(),
- xClipPoly(),
-
- lineColor(),
- fillColor(),
- textColor(),
- textFillColor(),
- textLineColor(),
-
- xFont(),
- transform(),
- mapModeTransform(),
- fontRotation(0.0),
-
- textEmphasisMarkStyle(EMPHASISMARK_NONE),
- pushFlags(PUSH_ALL),
- textDirection(::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT),
- textAlignment(0), // TODO(Q2): Synchronize with implrenderer
- // and possibly new rendering::TextAlignment
- textReliefStyle(RELIEF_NONE),
- textOverlineStyle(UNDERLINE_NONE),
- textUnderlineStyle(UNDERLINE_NONE),
- textStrikeoutStyle(STRIKEOUT_NONE),
- textReferencePoint(ALIGN_BASELINE),
-
- isTextOutlineModeSet( false ),
- isTextEffectShadowSet( false ),
- isTextWordUnderlineSet( false ),
-
- isLineColorSet( false ),
- isFillColorSet( false ),
- isTextFillColorSet( false ),
- isTextLineColorSet( false )
- {
- }
-
- ::basegfx::B2DPolyPolygon clip;
- ::Rectangle clipRect;
- ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > xClipPoly;
-
- ::com::sun::star::uno::Sequence< double > lineColor;
- ::com::sun::star::uno::Sequence< double > fillColor;
- ::com::sun::star::uno::Sequence< double > textColor;
- ::com::sun::star::uno::Sequence< double > textFillColor;
- ::com::sun::star::uno::Sequence< double > textLineColor;
-
- /** Current font.
-
- @attention Beware, this member can be NULL, and
- nevertheless text output is generated.
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > xFont;
- ::basegfx::B2DHomMatrix transform;
- ::basegfx::B2DHomMatrix mapModeTransform;
- double fontRotation;
-
- sal_uInt16 textEmphasisMarkStyle;
- sal_uInt16 pushFlags;
- sal_Int8 textDirection;
- sal_Int8 textAlignment;
- sal_Int8 textReliefStyle;
- sal_Int8 textOverlineStyle;
- sal_Int8 textUnderlineStyle;
- sal_Int8 textStrikeoutStyle;
- TextAlign textReferencePoint;
-
- bool isTextOutlineModeSet;
- bool isTextEffectShadowSet;
- bool isTextWordUnderlineSet;
-
- bool isLineColorSet;
- bool isFillColorSet;
- bool isTextFillColorSet;
- bool isTextLineColorSet;
- };
- }
-}
-
-#endif /* _CPPCANVAS_OUTDEVSTATE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/inc/tools.hxx b/cppcanvas/source/inc/tools.hxx
deleted file mode 100644
index f1d60ed..0000000
--- a/cppcanvas/source/inc/tools.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CPPCANVAS_TOOLS_HXX
-#define _CPPCANVAS_TOOLS_HXX
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <cppcanvas/color.hxx>
-
-namespace com { namespace sun { namespace star { namespace rendering
-{
- class XGraphicDevice;
-} } } }
-
-
-namespace cppcanvas
-{
- namespace tools
- {
- ::com::sun::star::uno::Sequence< double >
- intSRGBAToDoubleSequence( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XGraphicDevice >&,
- Color::IntSRGBA );
-
- Color::IntSRGBA doubleSequenceToIntSRGBA( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
- const ::com::sun::star::uno::Sequence< double >& rColor );
- }
-}
-
-#endif /* _CPPCANVAS_TOOLS_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.cxx b/cppcanvas/source/mtfrenderer/bitmapaction.cxx
deleted file mode 100644
index d3b61fa..0000000
--- a/cppcanvas/source/mtfrenderer/bitmapaction.cxx
+++ /dev/null
@@ -1,229 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <com/sun/star/rendering/XBitmap.hpp>
-#include <com/sun/star/rendering/RepaintResult.hpp>
-#include <com/sun/star/rendering/XCachedPrimitive.hpp>
-#include <vcl/bitmapex.hxx>
-#include <tools/gen.hxx>
-#include <vcl/canvastools.hxx>
-#include <canvas/canvastools.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/vector/b2dsize.hxx>
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/range/b2drange.hxx>
-#include <basegfx/tools/canvastools.hxx>
-#include <boost/utility.hpp>
-#include "cachedprimitivebase.hxx"
-#include "bitmapaction.hxx"
-#include "outdevstate.hxx"
-#include "mtftools.hxx"
-#include <basegfx/matrix/b2dhommatrixtools.hxx>
-
-
-using namespace ::com::sun::star;
-
-namespace cppcanvas
-{
- namespace internal
- {
- namespace
- {
-
- class BitmapAction : public CachedPrimitiveBase
- {
- public:
- BitmapAction( const ::BitmapEx&,
- const ::basegfx::B2DPoint& rDstPoint,
- const CanvasSharedPtr&,
- const OutDevState& );
- BitmapAction( const ::BitmapEx&,
- const ::basegfx::B2DPoint& rDstPoint,
- const ::basegfx::B2DVector& rDstSize,
- const CanvasSharedPtr&,
- const OutDevState& );
-
- virtual bool renderSubset( const ::basegfx::B2DHomMatrix& rTransformation,
- const Subset& rSubset ) const;
-
- virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const;
- virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
- const Subset& rSubset ) const;
-
- virtual sal_Int32 getActionCount() const;
-
- private:
- using Action::render;
- virtual bool renderPrimitive( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
- const ::basegfx::B2DHomMatrix& rTransformation ) const;
-
- uno::Reference< rendering::XBitmap > mxBitmap;
- CanvasSharedPtr mpCanvas;
- rendering::RenderState maState;
- };
-
-
- BitmapAction::BitmapAction( const ::BitmapEx& rBmpEx,
- const ::basegfx::B2DPoint& rDstPoint,
- const CanvasSharedPtr& rCanvas,
- const OutDevState& rState ) :
- CachedPrimitiveBase( rCanvas, true ),
- mxBitmap( ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(),
- rBmpEx ) ),
- mpCanvas( rCanvas ),
- maState()
- {
- tools::initRenderState(maState,rState);
-
- // Setup transformation such that the next render call is
- // moved rPoint away.
- const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createTranslateB2DHomMatrix(rDstPoint));
- ::canvas::tools::appendToRenderState( maState,
- aLocalTransformation );
-
- // correct clip (which is relative to original transform)
- tools::modifyClip( maState,
- rState,
- rCanvas,
- rDstPoint,
- NULL,
- NULL );
- }
-
- BitmapAction::BitmapAction( const ::BitmapEx& rBmpEx,
- const ::basegfx::B2DPoint& rDstPoint,
- const ::basegfx::B2DVector& rDstSize,
- const CanvasSharedPtr& rCanvas,
- const OutDevState& rState ) :
- CachedPrimitiveBase( rCanvas, true ),
- mxBitmap( ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(),
- rBmpEx ) ),
- mpCanvas( rCanvas ),
- maState()
- {
- tools::initRenderState(maState,rState);
-
- // Setup transformation such that the next render call is
- // moved rPoint away, and scaled according to the ratio
- // given by src and dst size.
- const ::Size aBmpSize( rBmpEx.GetSizePixel() );
-
- const ::basegfx::B2DVector aScale( rDstSize.getX() / aBmpSize.Width(),
- rDstSize.getY() / aBmpSize.Height() );
- const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createScaleTranslateB2DHomMatrix(
- aScale, rDstPoint));
- ::canvas::tools::appendToRenderState( maState, aLocalTransformation );
-
- // correct clip (which is relative to original transform)
- tools::modifyClip( maState,
- rState,
- rCanvas,
- rDstPoint,
- &aScale,
- NULL );
- }
-
- bool BitmapAction::renderPrimitive( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
- const ::basegfx::B2DHomMatrix& rTransformation ) const
- {
- SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::BitmapAction::renderPrimitive()" );
- SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::BitmapAction: 0x" << std::hex << this );
-
- rendering::RenderState aLocalState( maState );
- ::canvas::tools::prependToRenderState(aLocalState, rTransformation);
-
- rCachedPrimitive = mpCanvas->getUNOCanvas()->drawBitmap( mxBitmap,
- mpCanvas->getViewState(),
- aLocalState );
-
- return true;
- }
-
- bool BitmapAction::renderSubset( const ::basegfx::B2DHomMatrix& rTransformation,
- const Subset& rSubset ) const
- {
- // bitmap only contains a single action, fail if subset
- // requests different range
- if( rSubset.mnSubsetBegin != 0 ||
- rSubset.mnSubsetEnd != 1 )
- return false;
-
- return CachedPrimitiveBase::render( rTransformation );
- }
-
- ::basegfx::B2DRange BitmapAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
- {
- rendering::RenderState aLocalState( maState );
- ::canvas::tools::prependToRenderState(aLocalState, rTransformation);
-
- const geometry::IntegerSize2D aSize( mxBitmap->getSize() );
-
- return tools::calcDevicePixelBounds( ::basegfx::B2DRange( 0,0,
- aSize.Width,
- aSize.Height ),
- mpCanvas->getViewState(),
- aLocalState );
- }
-
- ::basegfx::B2DRange BitmapAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
- const Subset& rSubset ) const
- {
- // bitmap only contains a single action, empty bounds
- // if subset requests different range
- if( rSubset.mnSubsetBegin != 0 ||
- rSubset.mnSubsetEnd != 1 )
- return ::basegfx::B2DRange();
-
- return getBounds( rTransformation );
- }
-
- sal_Int32 BitmapAction::getActionCount() const
- {
- return 1;
- }
- }
-
- ActionSharedPtr BitmapActionFactory::createBitmapAction( const ::BitmapEx& rBmpEx,
- const ::basegfx::B2DPoint& rDstPoint,
- const CanvasSharedPtr& rCanvas,
- const OutDevState& rState )
- {
- return ActionSharedPtr( new BitmapAction(rBmpEx,
- rDstPoint,
- rCanvas,
- rState ) );
- }
-
- ActionSharedPtr BitmapActionFactory::createBitmapAction( const ::BitmapEx& rBmpEx,
- const ::basegfx::B2DPoint& rDstPoint,
- const ::basegfx::B2DVector& rDstSize,
- const CanvasSharedPtr& rCanvas,
- const OutDevState& rState )
- {
- return ActionSharedPtr( new BitmapAction(rBmpEx,
- rDstPoint,
- rDstSize,
- rCanvas,
- rState ) );
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.hxx b/cppcanvas/source/mtfrenderer/bitmapaction.hxx
deleted file mode 100644
index f960747..0000000
--- a/cppcanvas/source/mtfrenderer/bitmapaction.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CPPCANVAS_BITMAPACTION_HXX
-#define _CPPCANVAS_BITMAPACTION_HXX
-
-#include <cppcanvas/canvas.hxx>
-#include <action.hxx>
-
-namespace basegfx {
- class B2DPoint;
- class B2DVector;
-}
-class BitmapEx;
-
-/* Definition of internal::BitmapActionFactory class */
-
-namespace cppcanvas
-{
- namespace internal
- {
- struct OutDevState;
-
- /** Creates encapsulated converters between GDIMetaFile and
- XCanvas. The Canvas argument is deliberately placed at the
- constructor, to force reconstruction of this object for a
- new canvas. This considerably eases internal state
- handling, since a lot of the internal state (e.g. fonts,
- text layout) is Canvas-dependent.
- */
- class BitmapActionFactory
- {
- public:
- /// Unscaled bitmap action, only references destination point
- static ActionSharedPtr createBitmapAction( const ::BitmapEx&,
- const ::basegfx::B2DPoint& rDstPoint,
- const CanvasSharedPtr&,
- const OutDevState& );
-
- /// Scaled bitmap action, dest point and dest size
- static ActionSharedPtr createBitmapAction( const ::BitmapEx&,
- const ::basegfx::B2DPoint& rDstPoint,
- const ::basegfx::B2DVector& rDstSize,
- const CanvasSharedPtr&,
- const OutDevState& );
-
- private:
- // static factory, disable big four
- BitmapActionFactory();
- ~BitmapActionFactory();
- BitmapActionFactory(const BitmapActionFactory&);
- BitmapActionFactory& operator=( const BitmapActionFactory& );
- };
- }
-}
-
-#endif /*_CPPCANVAS_BITMAPACTION_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx b/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx
deleted file mode 100644
index 02de858..0000000
--- a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-
-#include <com/sun/star/rendering/RepaintResult.hpp>
-
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <canvas/canvastools.hxx>
-#include <cppcanvas/canvas.hxx>
-
-#include "cachedprimitivebase.hxx"
-
-using namespace ::com::sun::star;
-
-namespace cppcanvas
-{
- namespace internal
- {
- CachedPrimitiveBase::CachedPrimitiveBase( const CanvasSharedPtr& rCanvas,
- bool bOnlyRedrawWithSameTransform ) :
- mpCanvas( rCanvas ),
- mxCachedPrimitive(),
- maLastTransformation(),
- mbOnlyRedrawWithSameTransform( bOnlyRedrawWithSameTransform )
- {
- // TODO(F2): also store last view transform, and refuse to
- // redraw if changed.
- }
-
- bool CachedPrimitiveBase::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
- {
- SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::CachedPrimitiveBase::render()" );
- SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::CachedPrimitiveBase: 0x" << std::hex << this );
-
- const rendering::ViewState& rViewState( mpCanvas->getViewState() );
- ::basegfx::B2DHomMatrix aTotalTransform;
-
- ::canvas::tools::getViewStateTransform( aTotalTransform,
- rViewState );
- aTotalTransform *= rTransformation;
-
- // can we use the cached primitive? For that, it must be
- // present in the first place, and, if
- // mbOnlyRedrawWithSameTransform is true, the overall
- // transformation must be the same.
- if( mxCachedPrimitive.is() &&
- (!mbOnlyRedrawWithSameTransform ||
- maLastTransformation == aTotalTransform) )
- {
- if( mxCachedPrimitive->redraw( rViewState ) ==
- rendering::RepaintResult::REDRAWN )
- {
- // cached repaint succeeded, done.
- return true;
- }
- }
-
- maLastTransformation = aTotalTransform;
-
- // delegate rendering to derived classes
- return renderPrimitive( mxCachedPrimitive,
- rTransformation );
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx b/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx
deleted file mode 100644
index e7b4248..0000000
--- a/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CPPCANVAS_CACHEDPRIMITIVEBASE_HXX
-#define _CPPCANVAS_CACHEDPRIMITIVEBASE_HXX
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/rendering/XCanvas.hpp>
-
-#include <cppcanvas/canvas.hxx>
-#include <boost/utility.hpp>
-
-#include "action.hxx"
-
-namespace basegfx { class B2DHomMatrix; }
-
-
-/* Definition of internal::CachedPrimitiveBase class */
-
-namespace cppcanvas
-{
- namespace internal
- {
- /** Base class providing cached re-rendering, if XCanvas
- returns XCachedPrimitive
-
- Derive from this class and implement private render()
- method to perform the actual primitive rendering. Return
- cached primitive into given reference. Next time this
- class' public render() method gets called, the cached
- representation is taken.
- */
- class CachedPrimitiveBase : public Action,
- private ::boost::noncopyable
- {
- public:
- /** Constructor
-
- @param rCanvas
- Canvas on which this primitive is to appear
-
- @param bOnlyRedrawWithSameTransform
- When true, this class only reuses the cached
- primitive, if the overall transformation stays the
- same. Otherwise, repaints are always performed via the
- cached primitive.
- */
- CachedPrimitiveBase( const CanvasSharedPtr& rCanvas,
- bool bOnlyRedrawWithSameTransform );
- virtual ~CachedPrimitiveBase() {}
-
- virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
-
- protected:
- using Action::render;
-
- private:
- virtual bool renderPrimitive( ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XCachedPrimitive >& rCachedPrimitive,
- const ::basegfx::B2DHomMatrix& rTransformation ) const = 0;
-
- CanvasSharedPtr mpCanvas;
- mutable ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XCachedPrimitive > mxCachedPrimitive;
- mutable ::basegfx::B2DHomMatrix maLastTransformation;
- const bool mbOnlyRedrawWithSameTransform;
- };
- }
-}
-
-#endif /*_CPPCANVAS_CACHEDPRIMITIVEBASE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
deleted file mode 100644
index 5685c49..0000000
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ /dev/null
@@ -1,1940 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <tools/stream.hxx>
-#include <vcl/metaact.hxx>
-#include <vcl/graphicfilter.hxx>
-#include <basegfx/tools/canvastools.hxx>
-#include <basegfx/tools/gradienttools.hxx>
-#include <basegfx/tools/tools.hxx>
-#include <basegfx/numeric/ftools.hxx>
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/vector/b2dsize.hxx>
-#include <basegfx/range/b2drange.hxx>
-#include <basegfx/range/b2drectangle.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <vcl/canvastools.hxx>
-#include <rtl/ustring.hxx>
-#include <sal/alloca.h>
-
-#include <com/sun/star/rendering/XCanvas.hpp>
-#include <com/sun/star/rendering/TexturingMode.hpp>
-
-#include <bitmapaction.hxx>
-#include <implrenderer.hxx>
-#include <outdevstate.hxx>
-#include <polypolyaction.hxx>
-#include <textaction.hxx>
-#include <stdio.h>
-
-#define EmfPlusRecordTypeHeader 16385
-#define EmfPlusRecordTypeEndOfFile 16386
-#define EmfPlusRecordTypeGetDC 16388
-#define EmfPlusRecordTypeObject 16392
-#define EmfPlusRecordTypeFillRects 16394
-#define EmfPlusRecordTypeFillPolygon 16396
-#define EmfPlusRecordTypeDrawLines 16397
-#define EmfPlusRecordTypeFillEllipse 16398
-#define EmfPlusRecordTypeDrawEllipse 16399
-#define EmfPlusRecordTypeFillPie 16400
-#define EmfPlusRecordTypeFillPath 16404
-#define EmfPlusRecordTypeDrawPath 16405
-#define EmfPlusRecordTypeDrawImage 16410
-#define EmfPlusRecordTypeDrawImagePoints 16411
-#define EmfPlusRecordTypeDrawString 16412
-#define EmfPlusRecordTypeSetRenderingOrigin 16413
-#define EmfPlusRecordTypeSetAntiAliasMode 16414
-#define EmfPlusRecordTypeSetTextRenderingHint 16415
-#define EmfPlusRecordTypeSetInterpolationMode 16417
-#define EmfPlusRecordTypeSetPixelOffsetMode 16418
-#define EmfPlusRecordTypeSetCompositingQuality 16420
-#define EmfPlusRecordTypeSave 16421
-#define EmfPlusRecordTypeRestore 16422
-#define EmfPlusRecordTypeBeginContainerNoParams 16424
-#define EmfPlusRecordTypeEndContainer 16425
-#define EmfPlusRecordTypeSetWorldTransform 16426
-#define EmfPlusRecordTypeResetWorldTransform 16427
-#define EmfPlusRecordTypeMultiplyWorldTransform 16428
-#define EmfPlusRecordTypeSetPageTransform 16432
-#define EmfPlusRecordTypeSetClipRect 16434
-#define EmfPlusRecordTypeSetClipPath 16435
-#define EmfPlusRecordTypeSetClipRegion 16436
-#define EmfPlusRecordTypeDrawDriverString 16438
-
-#define EmfPlusObjectTypeBrush 0x100
-#define EmfPlusObjectTypePen 0x200
-#define EmfPlusObjectTypePath 0x300
-#define EmfPlusObjectTypeRegion 0x400
-#define EmfPlusObjectTypeImage 0x500
-#define EmfPlusObjectTypeFont 0x600
-
-#define EmfPlusRegionInitialStateInfinite 0x10000003
-
-using namespace ::com::sun::star;
-using namespace ::basegfx;
-
-namespace cppcanvas
-{
- namespace internal
- {
-
-#if OSL_DEBUG_LEVEL > 1
- void dumpWords (SvStream& s, int i)
- {
- sal_uInt32 pos = s.Tell ();
- sal_Int16 data;
- SAL_INFO ("cppcanvas.emf", "EMF+ dumping words");
- for (; i > 0; i --) {
- s >> data;
- SAL_INFO ("cppcanvas.emf", "EMF+\tdata: " << std::hex << data << std::dec);
- }
- SAL_INFO ("cppcanvas.emf", "EMF+ end dumping words");
- s.Seek (pos);
- }
-#endif
-
- struct EMFPPath : public EMFPObject
- {
- ::basegfx::B2DPolyPolygon aPolygon;
- sal_Int32 nPoints;
- float* pPoints;
- sal_uInt8* pPointTypes;
-
- public:
- EMFPPath (sal_Int32 _nPoints, bool bLines = false)
- {
- if( _nPoints<0 || sal_uInt32(_nPoints)>SAL_MAX_INT32/(2*sizeof(float)) )
- _nPoints = SAL_MAX_INT32/(2*sizeof(float));
- nPoints = _nPoints;
- pPoints = new float [nPoints*2];
- if (!bLines)
- pPointTypes = new sal_uInt8 [_nPoints];
- else
- pPointTypes = NULL;
- }
-
- ~EMFPPath ()
- {
- delete [] pPoints;
- delete [] pPointTypes;
- }
-
- // TODO: remove rR argument when debug code is not longer needed
- void Read (SvStream& s, sal_uInt32 pathFlags, ImplRenderer& rR)
- {
- for (int i = 0; i < nPoints; i ++) {
- if (pathFlags & 0x4000) {
- // points are stored in short 16bit integer format
- sal_uInt16 x, y;
-
- s >> x >> y;
- SAL_INFO ("cppcanvas.emf", "EMF+\tpoint [x,y]: " << x << "," << y);
- pPoints [i*2] = x;
- pPoints [i*2 + 1] = y;
- } else {
- // points are stored in Single (float) format
- s >> pPoints [i*2] >> pPoints [i*2 + 1];
- SAL_INFO ("cppcanvas.emf", "EMF+\tpoint [x,y]: " << pPoints [i*2] << "," << pPoints [i*2 + 1]);
- }
- }
-
- if (pPointTypes)
- for (int i = 0; i < nPoints; i ++) {
- s >> pPointTypes [i];
- SAL_INFO ("cppcanvas.emf", "EMF+\tpoint type: " << (int)pPointTypes [i]);
- }
-
- aPolygon.clear ();
-
-#if OSL_DEBUG_LEVEL > 1
- const ::basegfx::B2DRectangle aBounds (::basegfx::tools::getRange (GetPolygon (rR)));
-
- SAL_INFO ("cppcanvas.emf",
- "EMF+\tpolygon bounding box: " << aBounds.getMinX () << "," << aBounds.getMinY () << aBounds.getWidth () << "x" << aBounds.getHeight () << " (mapped)");
-#else
- (void) rR; // avoid warnings
-#endif
- }
-
- ::basegfx::B2DPolyPolygon& GetPolygon (ImplRenderer& rR, bool bMapIt = true)
- {
- ::basegfx::B2DPolygon polygon;
-
- aPolygon.clear ();
-
- int last_normal = 0, p = 0;
- ::basegfx::B2DPoint prev, mapped;
- bool hasPrev = false;
- for (int i = 0; i < nPoints; i ++) {
- if (p && pPointTypes && (pPointTypes [i] == 0)) {
- aPolygon.append (polygon);
- last_normal = i;
- p = 0;
- polygon.clear ();
- }
-
- if (bMapIt)
- mapped = rR.Map (pPoints [i*2], pPoints [i*2 + 1]);
- else
- mapped = ::basegfx::B2DPoint (pPoints [i*2], pPoints [i*2 + 1]);
- if (pPointTypes) {
- if ((pPointTypes [i] & 0x07) == 3) {
- if (((i - last_normal )% 3) == 1) {
- polygon.setNextControlPoint (p - 1, mapped);
- SAL_INFO ("cppcanvas.emf", "polygon append next: " << p - 1 << " mapped: " << mapped.getX () << "," << mapped.getY ());
- continue;
- } else if (((i - last_normal) % 3) == 2) {
- prev = mapped;
- hasPrev = true;
- continue;
- }
- } else
- last_normal = i;
- }
- polygon.append (mapped);
- SAL_INFO ("cppcanvas.emf", "polygon append point: " << pPoints [i*2] << "," << pPoints [i*2 + 1] << " mapped: " << mapped.getX () << ":" << mapped.getY ());
- if (hasPrev) {
- polygon.setPrevControlPoint (p, prev);
- SAL_INFO ("cppcanvas.emf", "polygon append prev: " << p << " mapped: " << prev.getX () << "," << prev.getY ());
- hasPrev = false;
- }
- p ++;
- if (pPointTypes && (pPointTypes [i] & 0x80)) { // closed polygon
- polygon.setClosed (true);
- aPolygon.append (polygon);
- SAL_INFO ("cppcanvas.emf", "close polygon");
- last_normal = i + 1;
- p = 0;
- polygon.clear ();
- }
- }
-
- if (polygon.count ()) {
- aPolygon.append (polygon);
-
-#if OSL_DEBUG_LEVEL > 1
- for (unsigned int i=0; i<aPolygon.count(); i++) {
- polygon = aPolygon.getB2DPolygon(i);
- SAL_INFO ("cppcanvas.emf", "polygon: " << i);
- for (unsigned int j=0; j<polygon.count(); j++) {
- ::basegfx::B2DPoint point = polygon.getB2DPoint(j);
- SAL_INFO ("cppcanvas.emf", "point: " << point.getX() << "," << point.getY());
- if (polygon.isPrevControlPointUsed(j)) {
- point = polygon.getPrevControlPoint(j);
- SAL_INFO ("cppcanvas.emf", "prev: " << point.getX() << "," << point.getY());
- }
- if (polygon.isNextControlPointUsed(j)) {
- point = polygon.getNextControlPoint(j);
- SAL_INFO ("cppcanvas.emf", "next: " << point.getX() << "," << point.getY());
- }
- }
- }
-#endif
- }
-
- return aPolygon;
- }
- };
-
- struct EMFPRegion : public EMFPObject
- {
- sal_Int32 parts;
- sal_Int32 *combineMode;
- sal_Int32 initialState;
- EMFPPath *initialPath;
- float ix, iy, iw, ih;
-
- EMFPRegion ()
- {
- combineMode = NULL;
- initialPath = NULL;
- }
-
- ~EMFPRegion ()
- {
- if (combineMode) {
- delete [] combineMode;
- combineMode = NULL;
- }
- if (initialPath) {
- delete initialPath;
- initialPath = NULL;
- }
- }
-
- void Read (SvStream& s)
- {
- sal_uInt32 header;
-
- s >> header >> parts;
-
- SAL_INFO ("cppcanvas.emf", "EMF+\tregion");
- SAL_INFO ("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " parts: " << parts << std::dec );
-
- if (parts) {
- if( parts<0 || sal_uInt32(parts)>SAL_MAX_INT32/sizeof(sal_Int32) )
- parts = SAL_MAX_INT32/sizeof(sal_Int32);
-
- combineMode = new sal_Int32 [parts];
-
- for (int i = 0; i < parts; i ++) {
- s >> combineMode [i];
- SAL_INFO ("cppcanvas.emf", "EMF+\tcombine mode [" << i << "]: 0x" << std::hex << combineMode [i] << std::dec);
- }
- }
-
- s >> initialState;
- SAL_INFO ("cppcanvas.emf", "EMF+\tinitial state: 0x" << std::hex << initialState << std::dec);
- }
- };
-
- struct EMFPBrush : public EMFPObject
- {
- ::Color solidColor;
- sal_uInt32 type;
- sal_uInt32 additionalFlags;
-
- /* linear gradient */
- sal_Int32 wrapMode;
- float areaX, areaY, areaWidth, areaHeight;
- ::Color secondColor; // first color is stored in solidColor;
- XForm transformation;
- bool hasTransformation;
- sal_Int32 blendPoints;
- float* blendPositions;
- float* blendFactors;
- sal_Int32 colorblendPoints;
- float* colorblendPositions;
- ::Color* colorblendColors;
- sal_Int32 surroundColorsNumber;
- ::Color* surroundColors;
- EMFPPath *path;
-
- public:
- EMFPBrush ()
- {
- blendPositions = NULL;
- colorblendPositions = NULL;
- colorblendColors = NULL;
- surroundColors = NULL;
- path = NULL;
- hasTransformation = false;
- }
-
- ~EMFPBrush ()
- {
- if (blendPositions != NULL) {
- delete[] blendPositions;
- blendPositions = NULL;
- }
- if (colorblendPositions != NULL) {
- delete[] colorblendPositions;
- colorblendPositions = NULL;
- }
- if (colorblendColors != NULL) {
- delete[] colorblendColors;
- colorblendColors = NULL;
- }
- if (surroundColors != NULL) {
- delete[] surroundColors;
- surroundColors = NULL;
- }
- if (path) {
- delete path;
- path = NULL;
- }
- }
-
- sal_uInt32 GetType() const { return type; }
- const ::Color& GetColor() const { return solidColor; }
-
- void Read (SvStream& s, ImplRenderer& rR)
- {
- sal_uInt32 header;
-
- s >> header >> type;
-
- SAL_INFO ("cppcanvas.emf", "EMF+\tbrush");
- SAL_INFO ("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec);
-
- switch (type) {
- case 0:
- {
- sal_uInt32 color;
-
- s >> color;
- solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
- SAL_INFO ("cppcanvas.emf", "EMF+\tsolid color: 0x" << std::hex << color << std::dec);
-
- break;
- }
- // path gradient
- case 3:
- {
- s >> additionalFlags >> wrapMode;
-
- SAL_INFO ("cppcanvas.emf", "EMF+\tpath gradient, additional flags: 0x" << std::hex << additionalFlags << std::dec);
-
- sal_uInt32 color;
-
- s >> color;
- solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
- SAL_INFO("cppcanvas.emf", "EMF+\tcenter color: 0x" << std::hex << color << std::dec);
-
- s >> areaX >> areaY;
- SAL_INFO("cppcanvas.emf", "EMF+\tcenter point: " << areaX << "," << areaY);
-
- s >> surroundColorsNumber;
- SAL_INFO("cppcanvas.emf", "EMF+\tsurround colors: " << surroundColorsNumber);
-
- if( surroundColorsNumber<0 || sal_uInt32(surroundColorsNumber)>SAL_MAX_INT32/sizeof(::Color) )
- surroundColorsNumber = SAL_MAX_INT32/sizeof(::Color);
-
- surroundColors = new ::Color [surroundColorsNumber];
- for (int i = 0; i < surroundColorsNumber; i++) {
- s >> color;
- surroundColors[i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
- if (i == 0)
- secondColor = surroundColors [0];
- SAL_INFO("cppcanvas.emf", "EMF+\tsurround color[" << i << "]: 0x" << std::hex << color << std::dec);
- }
-
- if (additionalFlags & 0x01) {
- sal_Int32 pathLength;
-
- s >> pathLength;
- SAL_INFO("cppcanvas.emf", "EMF+\tpath length: " << pathLength);
-
- sal_uInt32 pos = s.Tell ();
-#if OSL_DEBUG_LEVEL > 1
- dumpWords (s, 32);
-#endif
-
- sal_uInt32 pathHeader;
- sal_Int32 pathPoints, pathFlags;
- s >> pathHeader >> pathPoints >> pathFlags;
-
- SAL_INFO("cppcanvas.emf", "EMF+\tpath (brush path gradient)");
- SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec );
-
- path = new EMFPPath (pathPoints);
- path->Read (s, pathFlags, rR);
-
- s.Seek (pos + pathLength);
-
- const ::basegfx::B2DRectangle aBounds (::basegfx::tools::getRange (path->GetPolygon (rR, false)));
- areaWidth = aBounds.getWidth ();
- areaHeight = aBounds.getHeight ();
-
- SAL_INFO("cppcanvas.emf", "EMF+\tpolygon bounding box: " << aBounds.getMinX () << "," << aBounds.getMinY () << " " << aBounds.getWidth () << "x" << aBounds.getHeight ());
-
-
- if (additionalFlags & 0x02) {
- SAL_INFO("cppcanvas.emf", "EMF+\tuse transformation");
- s >> transformation;
- hasTransformation = true;
- SAL_INFO("cppcanvas.emf",
- "EMF+\tm11: " << transformation.eM11 << " m12: " << transformation.eM12 <<
- "\nEMF+\tm21: " << transformation.eM21 << " m22: " << transformation.eM22 <<
- "\nEMF+\tdx: " << transformation.eDx << " dy: " << transformation.eDy);
-
- }
- if (additionalFlags & 0x08) {
- s >> blendPoints;
- SAL_INFO("cppcanvas.emf", "EMF+\tuse blend, points: " << blendPoints);
- if( blendPoints<0 || sal_uInt32(blendPoints)>SAL_MAX_INT32/(2*sizeof(float)) )
- blendPoints = SAL_MAX_INT32/(2*sizeof(float));
- blendPositions = new float [2*blendPoints];
- blendFactors = blendPositions + blendPoints;
- for (int i=0; i < blendPoints; i ++) {
- s >> blendPositions [i];
- SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << blendPositions [i]);
- }
- for (int i=0; i < blendPoints; i ++) {
- s >> blendFactors [i];
- SAL_INFO("cppcanvas.emf", "EMF+\tfactor[" << i << "]: " << blendFactors [i]);
- }
- }
-
- if (additionalFlags & 0x04) {
- s >> colorblendPoints;
- SAL_INFO("cppcanvas.emf", "EMF+\tuse color blend, points: " << colorblendPoints);
- if( colorblendPoints<0 || sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(float) )
- colorblendPoints = SAL_MAX_INT32/sizeof(float);
- if( sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(::Color) )
- colorblendPoints = SAL_MAX_INT32/sizeof(::Color);
- colorblendPositions = new float [colorblendPoints];
- colorblendColors = new ::Color [colorblendPoints];
- for (int i=0; i < colorblendPoints; i ++) {
- s >> colorblendPositions [i];
- SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << colorblendPositions [i]);
- }
- for (int i=0; i < colorblendPoints; i ++) {
- s >> color;
- colorblendColors [i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
- SAL_INFO("cppcanvas.emf", "EMF+\tcolor[" << i << "]: 0x" << std::hex << color << std::dec);
- }
- }
- } else {
-#if OSL_DEBUG_LEVEL > 1
- dumpWords (s, 1024);
-#endif
- }
- break;
- }
- // linear gradient
- case 4:
- {
- s >> additionalFlags >> wrapMode;
-
- SAL_INFO("cppcanvas.emf", "EMF+\tlinear gradient, additional flags: 0x" << std::hex << additionalFlags << std::dec);
-
- s >> areaX >> areaY >> areaWidth >> areaHeight;
-
- SAL_INFO("cppcanvas.emf", "EMF+\tarea: " << areaX << "," << areaY << " - " << areaWidth << "x" << areaHeight);
-
- sal_uInt32 color;
-
- s >> color;
- solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
- SAL_INFO("cppcanvas.emf", "EMF+\tfirst color: 0x" << std::hex << color << std::dec);
-
- s >> color;
- secondColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
- SAL_INFO("cppcanvas.emf", "EMF+\tsecond color: 0x" << std::hex << color << std::dec);
-
- // repeated colors, unknown meaning, see http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/ObjectBrush.html
- s >> color;
- s >> color;
-
- if (additionalFlags & 0x02) {
- SAL_INFO("cppcanvas.emf", "EMF+\tuse transformation");
- s >> transformation;
- hasTransformation = true;
- SAL_INFO("cppcanvas.emf",
- "EMF+\tm11: " << transformation.eM11 << " m12: " << transformation.eM12 <<
- "\nEMF+\tm21: " << transformation.eM21 << " m22: " << transformation.eM22 <<
- "\nEMF+\tdx: " << transformation.eDx << " dy: " << transformation.eDy);
- }
- if (additionalFlags & 0x08) {
- s >> blendPoints;
- SAL_INFO("cppcanvas.emf", "EMF+\tuse blend, points: " << blendPoints);
- if( blendPoints<0 || sal_uInt32(blendPoints)>SAL_MAX_INT32/(2*sizeof(float)) )
- blendPoints = SAL_MAX_INT32/(2*sizeof(float));
- blendPositions = new float [2*blendPoints];
- blendFactors = blendPositions + blendPoints;
- for (int i=0; i < blendPoints; i ++) {
- s >> blendPositions [i];
- SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << blendPositions [i]);
- }
- for (int i=0; i < blendPoints; i ++) {
- s >> blendFactors [i];
- SAL_INFO("cppcanvas.emf", "EMF+\tfactor[" << i << "]: " << blendFactors [i]);
- }
- }
-
- if (additionalFlags & 0x04) {
- s >> colorblendPoints;
- SAL_INFO("cppcanvas.emf", "EMF+\tuse color blend, points: " << colorblendPoints);
- if( colorblendPoints<0 || sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(float) )
- colorblendPoints = SAL_MAX_INT32/sizeof(float);
- if( sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(::Color) )
- colorblendPoints = sal_uInt32(SAL_MAX_INT32)/sizeof(::Color);
- colorblendPositions = new float [colorblendPoints];
- colorblendColors = new ::Color [colorblendPoints];
- for (int i=0; i < colorblendPoints; i ++) {
- s >> colorblendPositions [i];
- SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << colorblendPositions [i]);
- }
- for (int i=0; i < colorblendPoints; i ++) {
- s >> color;
- colorblendColors [i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
- SAL_INFO("cppcanvas.emf", "EMF+\tcolor[" << i << "]: 0x" << std::hex << color << std::dec);
- }
- }
-
- break;
- }
- default:
- SAL_INFO("cppcanvas.emf", "EMF+\tunhandled brush type: " << std::hex << type << std::dec);
- }
- }
- };
-
- struct EMFPPen : public EMFPBrush
- {
- XForm transformation;
- float width;
- sal_Int32 startCap;
- sal_Int32 endCap;
- sal_Int32 lineJoin;
- float mitterLimit;
- sal_Int32 dashStyle;
- sal_Int32 dashCap;
- float dashOffset;
- sal_Int32 dashPatternLen;
- float *dashPattern;
- sal_Int32 alignment;
- sal_Int32 compoundArrayLen;
- float *compoundArray;
- sal_Int32 customStartCapLen;
- sal_uInt8 *customStartCap;
- sal_Int32 customEndCapLen;
- sal_uInt8 *customEndCap;
-
- public:
- EMFPPen () : EMFPBrush ()
- {
- dashPattern = NULL;
- compoundArray = NULL;
- customStartCap = NULL;
- customEndCap = NULL;
- }
-
- ~EMFPPen ()
- {
- delete[] dashPattern;
- delete[] compoundArray;
- delete[] customStartCap;
- delete[] customEndCap;
- }
-
- void SetStrokeAttributes (rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState)
- {
-#if OSL_DEBUG_LEVEL > 1
- if (width == 0.0) {
- SAL_INFO ("cppcanvas.emf", "TODO: pen with zero width - using minimal which might not be correct\n");
- }
-#endif
- rStrokeAttributes.StrokeWidth = (rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX ();
- }
-
- void Read (SvStream& s, ImplRenderer& rR, sal_Int32, sal_Int32 )
- {
- sal_uInt32 header, unknown, penFlags, unknown2;
- int i;
-
- s >> header >> unknown >> penFlags >> unknown2 >> width;
-
- SAL_INFO("cppcanvas.emf", "EMF+\tpen");
- SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " unknown: 0x" << unknown <<
- " additional flags: 0x" << penFlags << " unknown: 0x" << unknown2 << " width: " << std::dec << width );
-
- if (penFlags & 1)
- s >> transformation;
-
- if (penFlags & 2)
- s >> startCap;
- else
- startCap = 0;
-
- if (penFlags & 4)
- s >> endCap;
- else
- endCap = 0;
-
- if (penFlags & 8)
- s >> lineJoin;
- else
- lineJoin = 0;
-
- if (penFlags & 16)
- s >> mitterLimit;
- else
- mitterLimit = 0;
-
- if (penFlags & 32)
- s >> dashStyle;
- else
- dashStyle = 0;
-
- if (penFlags & 64)
- s >> dashCap;
- else
- dashCap = 0;
-
- if (penFlags & 128)
- s >> dashOffset;
- else
- dashOffset = 0;
-
- if (penFlags & 256) {
- s >> dashPatternLen;
- if( dashPatternLen<0 || sal_uInt32(dashPatternLen)>SAL_MAX_INT32/sizeof(float) )
- dashPatternLen = SAL_MAX_INT32/sizeof(float);
- dashPattern = new float [dashPatternLen];
- for (i = 0; i < dashPatternLen; i++)
- s >> dashPattern [i];
- } else
- dashPatternLen = 0;
-
- if (penFlags & 512)
- s >> alignment;
- else
- alignment = 0;
-
- if (penFlags & 1024) {
- s >> compoundArrayLen;
- if( compoundArrayLen<0 || sal_uInt32(compoundArrayLen)>SAL_MAX_INT32/sizeof(float) )
- compoundArrayLen = SAL_MAX_INT32/sizeof(float);
- compoundArray = new float [compoundArrayLen];
- for (i = 0; i < compoundArrayLen; i++)
- s >> compoundArray [i];
- } else
- compoundArrayLen = 0;
-
- if (penFlags & 2048) {
- s >> customStartCapLen;
- if( customStartCapLen<0 )
- customStartCapLen=0;
- customStartCap = new sal_uInt8 [customStartCapLen];
- for (i = 0; i < customStartCapLen; i++)
- s >> customStartCap [i];
- } else
- customStartCapLen = 0;
-
- if (penFlags & 4096) {
- s >> customEndCapLen;
- if( customEndCapLen<0 )
- customEndCapLen=0;
- customEndCap = new sal_uInt8 [customEndCapLen];
- for (i = 0; i < customEndCapLen; i++)
- s >> customEndCap [i];
- } else
- customEndCapLen = 0;
-
- EMFPBrush::Read (s, rR);
- }
- };
-
- struct EMFPImage : public EMFPObject
- {
- sal_uInt32 type;
- sal_Int32 width;
- sal_Int32 height;
- sal_Int32 stride;
- sal_Int32 pixelFormat;
- Graphic graphic;
-
-
- void Read (SvMemoryStream &s, sal_uInt32 dataSize, sal_Bool bUseWholeStream)
- {
- sal_uInt32 header, unknown;
-
- s >> header >> type;
-
- SAL_INFO("cppcanvas.emf", "EMF+\timage\nEMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec );
-
- if (type == 1) { // bitmap
- s >> width >> height >> stride >> pixelFormat >> unknown;
- SAL_INFO("cppcanvas.emf", "EMF+\tbitmap width: " << width << " height: " << height << " stride: " << "pixelFormat: 0x" << std::hex << pixelFormat << std::dec);
- if (width == 0) { // non native formats
- GraphicFilter filter;
-
- filter.ImportGraphic (graphic, OUString(), s);
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list