summaryrefslogtreecommitdiff
path: root/basebmp
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-06-27 11:40:23 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-06-27 11:40:23 +0000
commit952dcc17eb70a7100bc5e888551e9654749ebb83 (patch)
tree1cb09d4a20cd3220375da14e19efe8286e44b68b /basebmp
parentbb71a3a5d82df192ec08287ed803031701e931ae (diff)
INTEGRATION: CWS basebmp01 (1.1.2); FILE ADDED
2007/05/22 09:59:17 thb 1.1.2.1: #147378# Added support for foreign formats (via GenericColorImageAccessor); fixed typos in CompositeIterator and StridedArrayIterator; fixed comparisons for (Packed)PixelIterator and StridedArrayIterator (which got negative strides wrong); avoiding unnecessary copying in scale_image() now; cleaned up bitmapdevice.cxx from cruft/ad hoc debug code; made unit tests run again
Diffstat (limited to 'basebmp')
-rw-r--r--basebmp/inc/basebmp/genericcolorimageaccessor.hxx90
1 files changed, 90 insertions, 0 deletions
diff --git a/basebmp/inc/basebmp/genericcolorimageaccessor.hxx b/basebmp/inc/basebmp/genericcolorimageaccessor.hxx
new file mode 100644
index 000000000000..2861aac8b722
--- /dev/null
+++ b/basebmp/inc/basebmp/genericcolorimageaccessor.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: genericcolorimageaccessor.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2007-06-27 12:40:23 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX
+#define INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/bitmapdevice.hxx>
+
+namespace basebmp
+{
+ /** Access a BitmapDevice generically
+
+ This accessor deals with an opaque BitmapDevice generically,
+ via getPixel()/setPixel() at the published interface.
+ */
+ class GenericColorImageAccessor
+ {
+ BitmapDeviceSharedPtr mpDevice;
+ DrawMode meDrawMode;
+
+ public:
+ typedef Color value_type;
+
+ explicit GenericColorImageAccessor( BitmapDeviceSharedPtr const& rTarget ) :
+ mpDevice(rTarget),
+ meDrawMode(DrawMode_PAINT)
+ {}
+
+ GenericColorImageAccessor( BitmapDeviceSharedPtr const& rTarget,
+ DrawMode eDrawMode ) :
+ mpDevice(rTarget),
+ meDrawMode(eDrawMode)
+ {}
+
+ template< typename Iterator >
+ Color operator()( Iterator const& i ) const
+ { return mpDevice->getPixel( basegfx::B2IPoint( i->x,i->y ) ); }
+
+ template< typename Iterator, typename Difference >
+ Color operator()( Iterator const& i, Difference const& diff) const
+ { return mpDevice->getPixel( basegfx::B2IPoint( i[diff]->x,
+ i[diff]->y ) ); }
+
+ template< typename Iterator >
+ void set(Color const& value, Iterator const& i) const
+ { return mpDevice->setPixel( basegfx::B2IPoint( i->x,i->y ),
+ value, meDrawMode ); }
+
+ template< class Iterator, class Difference >
+ void set(value_type const& value, Iterator const& i, Difference const& diff) const
+ { return mpDevice->setPixel( basegfx::B2IPoint( i[diff]->x,
+ i[diff]->y ),
+ value, meDrawMode ); }
+ };
+}
+
+#endif /* INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX */