summaryrefslogtreecommitdiff
path: root/basebmp/inc/basebmp/bitmapdevice.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'basebmp/inc/basebmp/bitmapdevice.hxx')
-rw-r--r--basebmp/inc/basebmp/bitmapdevice.hxx71
1 files changed, 48 insertions, 23 deletions
diff --git a/basebmp/inc/basebmp/bitmapdevice.hxx b/basebmp/inc/basebmp/bitmapdevice.hxx
index dac7588b642e..4e5d106ae3bb 100644
--- a/basebmp/inc/basebmp/bitmapdevice.hxx
+++ b/basebmp/inc/basebmp/bitmapdevice.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: bitmapdevice.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: thb $ $Date: 2006-05-31 10:12:11 $
+ * last change: $Author: thb $ $Date: 2006-06-02 08:36:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -42,13 +42,14 @@
#include <sal/types.h>
#endif
#ifndef INCLUDED_BASEBMP_DRAWMODES_HXX
-#include "drawmodes.hxx"
+#include <basebmp/drawmodes.hxx>
#endif
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
#include <boost/noncopyable.hpp>
-
+#include <vector>
/* What to do first:
@@ -79,19 +80,20 @@ namespace basebmp
// Temporary. Use like the tools color object
class Color;
-typedef boost::shared_ptr< class BitmapDevice > BitmapDeviceSharedPtr;
-typedef boost::shared_ptr< sal_uInt8 > RawMemorySharedPtr;
+typedef boost::shared_ptr< class BitmapDevice > BitmapDeviceSharedPtr;
+typedef boost::shared_array< sal_uInt8 > RawMemorySharedArray;
+typedef boost::shared_ptr< const std::vector<Color> > PaletteMemorySharedVector;
struct ImplBitmapDevice;
/** Definition of BitmapDevice interface
- Use createBitmapDevice() factory method to create one instance.
+ Use the createBitmapDevice() factory method to create one instance.
Implementation note: the clip mask and bitmap parameter instances
of BitmapDevice that are passed to individual BitmapDevice
- instances work best with 1 bit MSB masks for the clip and a format
- matching that of the target BitmapDevice for the other
+ instances work best with 1 bit TC MSB masks for the clip and a
+ format matching that of the target BitmapDevice for the other
parameters. Everything else is accepted, but potentially slow.
*/
class BitmapDevice : private boost::noncopyable
@@ -121,17 +123,20 @@ public:
/** Get pointer to frame buffer
*/
- RawMemorySharedPtr getBuffer() const;
+ RawMemorySharedArray getBuffer() const;
/** Get pointer to palette
- @return pointer to array of getPaletteEntryCount() Color
- entries, if this is a palette format. If not, NULL is
- returned.
+ The returned pointer is const on purpose, since the
+ BitmapDevice might internally cache lookup information.
+
+ @return shared pointer to vector of Color entries.
*/
- const Color* getPalette() const;
+ PaletteMemorySharedVector getPalette() const;
+
+ /** Query number of palette entries.
- /** Query number of palette entries
+ This is just a frontend for getPalette->size()
*/
const sal_Int32 getPaletteEntryCount() const;
@@ -178,6 +183,14 @@ public:
*/
Color getPixel( const basegfx::B2IPoint& rPt );
+ /** Get underlying pixel data value at given position
+
+ This method returns the raw pixel data. In the case of
+ paletted bitmaps, this is the palette index, not the final
+ color value.
+ */
+ sal_uInt32 getPixelData( const basegfx::B2IPoint& rPt );
+
/** Draw a line
@param rPt1
@@ -276,11 +289,12 @@ public:
const BitmapDeviceSharedPtr& rClip );
protected:
- BitmapDevice( const basegfx::B2IVector& rSize,
- bool bTopDown,
- sal_Int32 nScanlineFormat,
- sal_Int32 nScanlineStride,
- const RawMemorySharedPtr& rMem );
+ BitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ sal_Int32 nScanlineStride,
+ const RawMemorySharedArray& rMem,
+ const PaletteMemorySharedVector& rPalette );
virtual ~BitmapDevice();
@@ -289,9 +303,6 @@ private:
virtual bool isCompatibleClipMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
virtual bool isCompatibleAlphaMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
- virtual const Color* getPalette_i() const = 0;
- virtual const sal_Int32 getPaletteEntryCount_i() const = 0;
-
virtual void clear_i( Color fillColor ) = 0;
virtual void setPixel_i( const basegfx::B2IPoint& rPt,
@@ -304,6 +315,8 @@ private:
virtual Color getPixel_i( const basegfx::B2IPoint& rPt ) = 0;
+ virtual sal_uInt32 getPixelData_i( const basegfx::B2IPoint& rPt ) = 0;
+
virtual void drawLine_i( const basegfx::B2DPoint& rPt1,
const basegfx::B2DPoint& rPt2,
Color lineColor,
@@ -376,6 +389,18 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize,
bool bTopDown,
sal_Int32 nScanlineFormat );
+/** Factory method to create a BitmapDevice for given scanline format
+ from the given piece of raw memory
+
+ Note: the provided memory must have sufficient size, to store the
+ image of the specified area and format.
+ */
+BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ const RawMemorySharedArray& rMem,
+ const PaletteMemorySharedVector& rPalette );
+
}
#endif /* INCLUDED_BASEBMP_BITMAPDEVICE_HXX */