ZBar.Image Class Reference

Representation of an image in ZBar. More...

List of all members.

Public Member Functions

 Image ()
 Create/allocate a new uninitialized image.
 Image (string filename)
 Load image from file in the same format as written by Dump().
void Dump (string filebase)
 Dump raw image data to a file for debug.
Image Convert (uint format)
 Image format conversion. refer to the documentation for supported image formats.
void Dispose ()
 Release resources held by this object.

Protected Member Functions

virtual void Dispose (bool disposing)
 Dispose this object.

Properties

internal IntPtr Handle [get]
uint Width [get, set]
uint Height [get, set]
uint Format [get, set]
uint SequenceNumber [get, set]
byte[] Data [get, set]
IEnumerable< SymbolSymbols [get]

Private Member Functions

internal Image (IntPtr handle, bool incRef)
 Create a new image from a pointer to an unmanaged resource.
 ~Image ()
 Finalize this object.
static IntPtr zbar_image_create ()
 new image constructor.
static void zbar_image_destroy (IntPtr image)
 image destructor. all images created by or returned to the application should be destroyed using this function. when an image is destroyed, the associated data cleanup handler will be invoked if available
static void zbar_image_ref (IntPtr image, int refs)
 image reference count manipulation. increment the reference count when you store a new reference to the image. decrement when the reference is no longer used. do not refer to the image any longer once the count is decremented. zbar_image_ref(image, -1) is the same as zbar_image_destroy(image)
static IntPtr zbar_image_convert (IntPtr image, uint format)
 image format conversion. refer to the documentation for supported image formats
static IntPtr zbar_image_convert_resize (IntPtr image, uint format, uint width, uint height)
 image format conversion with crop/pad. if the requested size is larger than the image, the last row/column are duplicated to cover the difference. if the requested size is smaller than the image, the extra rows/columns are dropped from the right/bottom.
static uint zbar_image_get_format (IntPtr image)
 retrieve the image format.
static uint zbar_image_get_sequence (IntPtr image)
 retrieve a "sequence" (page/frame) number associated with this image.
static uint zbar_image_get_width (IntPtr image)
 retrieve the width of the image.
static uint zbar_image_get_height (IntPtr image)
 retrieve the height of the image.
static IntPtr zbar_image_get_data (IntPtr image)
 return the image sample data. the returned data buffer is only valid until zbar_image_destroy() is called
static uint zbar_image_get_data_length (IntPtr img)
 return the size of image data.
static IntPtr zbar_image_first_symbol (IntPtr image)
 image_scanner decode result iterator.
static void zbar_image_set_format (IntPtr image, uint format)
 specify the fourcc image format code for image sample data. refer to the documentation for supported formats.
static void zbar_image_set_sequence (IntPtr image, uint sequence_num)
 associate a "sequence" (page/frame) number with this image.
static void zbar_image_set_size (IntPtr image, uint width, uint height)
 specify the pixel size of the image.
delegate void zbar_image_cleanup_handler (IntPtr image)
 Cleanup handler callback for image data.
static void zbar_image_set_data (IntPtr image, IntPtr data, uint data_byte_length, zbar_image_cleanup_handler cleanup_handler)
 specify image sample data. when image data is no longer needed by the library the specific data cleanup handler will be called (unless NULL)
static void zbar_image_free_data (IntPtr image)
 built-in cleanup handler. passes the image data buffer to free()
static void zbar_image_set_userdata (IntPtr image, IntPtr userdata)
 associate user specified data value with an image.
static IntPtr zbar_image_get_userdata (IntPtr image)
 return user specified data value associated with the image.
static int zbar_image_write (IntPtr image, string filebase)
 dump raw image data to a file for debug.
static IntPtr zbar_image_read (string filename)
 read back an image in the format written by zbar_image_write()

Private Attributes

IntPtr handle

Detailed Description

Representation of an image in ZBar.

Definition at line 33 of file Image.cs.


Constructor & Destructor Documentation

internal ZBar.Image.Image ( IntPtr  handle,
bool  incRef 
) [private]

Create a new image from a pointer to an unmanaged resource.

This resource will be managed by this Image instance.

Parameters:
handle A IntPtr to unmananged ZBar image.
incRef Whether or not to increment the reference counter.

Definition at line 47 of file Image.cs.

ZBar.Image.Image (  ) 

Create/allocate a new uninitialized image.

Be aware that this image is NOT initialized, allocated. And you must set width, height, format, data etc...

Definition at line 63 of file Image.cs.

ZBar.Image.Image ( string  filename  ) 

Load image from file in the same format as written by Dump().

Parameters:
filename Path to the file to load the image from

Definition at line 75 of file Image.cs.

ZBar.Image.~Image (  )  [private]

Finalize this object.

Definition at line 252 of file Image.cs.


Member Function Documentation

Image ZBar.Image.Convert ( uint  format  ) 

Image format conversion. refer to the documentation for supported image formats.

The converted image size may be rounded (up) due to format constraints

Parameters:
format FourCC format to convert to.
Returns:
A new Image with the sample data from the original image converted to the requested format. The original image is unaffected.

Definition at line 206 of file Image.cs.

void ZBar.Image.Dispose (  ) 

Release resources held by this object.

Definition at line 243 of file Image.cs.

virtual void ZBar.Image.Dispose ( bool  disposing  )  [protected, virtual]

Dispose this object.

This boolean disposing parameter here ensures that objects with a finalizer is not disposed, this is method is invoked from the finalizer. Do overwrite, and call, this method in base classes if you use any unmanaged resources.

Parameters:
disposing A System.Boolean False if called from the finalizer, True if called from Dispose.

Definition at line 230 of file Image.cs.

void ZBar.Image.Dump ( string  filebase  ) 

Dump raw image data to a file for debug.

the data will be prefixed with a 16 byte header consisting of: 4 bytes uint = 0x676d697a ("zimg") 4 bytes format fourcc 2 bytes width 2 bytes height 4 bytes size of following image data in bytes

Parameters:
filebase base filename, appended with ".XXXX.zimg" where XXXX is the format fourcc

Definition at line 107 of file Image.cs.

delegate void ZBar.Image.zbar_image_cleanup_handler ( IntPtr  image  )  [private]

Cleanup handler callback for image data.

static IntPtr ZBar.Image.zbar_image_convert ( IntPtr  image,
uint  format 
) [private]

image format conversion. refer to the documentation for supported image formats

Returns:
a new image with the sample data from the original image converted to the requested format. the original image is unaffected.

the converted image size may be rounded (up) due to format constraints

static IntPtr ZBar.Image.zbar_image_convert_resize ( IntPtr  image,
uint  format,
uint  width,
uint  height 
) [private]

image format conversion with crop/pad. if the requested size is larger than the image, the last row/column are duplicated to cover the difference. if the requested size is smaller than the image, the extra rows/columns are dropped from the right/bottom.

Returns:
a new image with the sample data from the original image converted to the requested format and size.

the image is not scaled

static IntPtr ZBar.Image.zbar_image_create (  )  [private]

new image constructor.

Returns:
a new image object with uninitialized data and format. this image should be destroyed (using zbar_image_destroy()) as soon as the application is finished with it
static void ZBar.Image.zbar_image_destroy ( IntPtr  image  )  [private]

image destructor. all images created by or returned to the application should be destroyed using this function. when an image is destroyed, the associated data cleanup handler will be invoked if available

make no assumptions about the image or the data buffer. they may not be destroyed/cleaned immediately if the library is still using them. if necessary, use the cleanup handler hook to keep track of image data buffers

static IntPtr ZBar.Image.zbar_image_first_symbol ( IntPtr  image  )  [private]

image_scanner decode result iterator.

Returns:
the first decoded symbol result for an image or NULL if no results are available
static void ZBar.Image.zbar_image_free_data ( IntPtr  image  )  [private]

built-in cleanup handler. passes the image data buffer to free()

static IntPtr ZBar.Image.zbar_image_get_data ( IntPtr  image  )  [private]

return the image sample data. the returned data buffer is only valid until zbar_image_destroy() is called

static uint ZBar.Image.zbar_image_get_data_length ( IntPtr  img  )  [private]

return the size of image data.

static uint ZBar.Image.zbar_image_get_format ( IntPtr  image  )  [private]

retrieve the image format.

Returns:
the fourcc describing the format of the image sample data
static uint ZBar.Image.zbar_image_get_height ( IntPtr  image  )  [private]

retrieve the height of the image.

Returns:
the height in sample rows
static uint ZBar.Image.zbar_image_get_sequence ( IntPtr  image  )  [private]

retrieve a "sequence" (page/frame) number associated with this image.

static IntPtr ZBar.Image.zbar_image_get_userdata ( IntPtr  image  )  [private]

return user specified data value associated with the image.

static uint ZBar.Image.zbar_image_get_width ( IntPtr  image  )  [private]

retrieve the width of the image.

Returns:
the width in sample columns
static IntPtr ZBar.Image.zbar_image_read ( string  filename  )  [private]

read back an image in the format written by zbar_image_write()

static void ZBar.Image.zbar_image_ref ( IntPtr  image,
int  refs 
) [private]

image reference count manipulation. increment the reference count when you store a new reference to the image. decrement when the reference is no longer used. do not refer to the image any longer once the count is decremented. zbar_image_ref(image, -1) is the same as zbar_image_destroy(image)

static void ZBar.Image.zbar_image_set_data ( IntPtr  image,
IntPtr  data,
uint  data_byte_length,
zbar_image_cleanup_handler  cleanup_handler 
) [private]

specify image sample data. when image data is no longer needed by the library the specific data cleanup handler will be called (unless NULL)

application image data will not be modified by the library

static void ZBar.Image.zbar_image_set_format ( IntPtr  image,
uint  format 
) [private]

specify the fourcc image format code for image sample data. refer to the documentation for supported formats.

this does not convert the data! (see zbar_image_convert() for that)

static void ZBar.Image.zbar_image_set_sequence ( IntPtr  image,
uint  sequence_num 
) [private]

associate a "sequence" (page/frame) number with this image.

static void ZBar.Image.zbar_image_set_size ( IntPtr  image,
uint  width,
uint  height 
) [private]

specify the pixel size of the image.

this does not affect the data!

static void ZBar.Image.zbar_image_set_userdata ( IntPtr  image,
IntPtr  userdata 
) [private]

associate user specified data value with an image.

static int ZBar.Image.zbar_image_write ( IntPtr  image,
string  filebase 
) [private]

dump raw image data to a file for debug.

Rhe data will be prefixed with a 16 byte header consisting of:

  • 4 bytes uint = 0x676d697a ("zimg")
  • 4 bytes format fourcc
  • 2 bytes width
  • 2 bytes height
  • 4 bytes size of following image data in bytes this header can be dumped w/eg:
    		///        od -Ax -tx1z -N16 -w4 [file]
    		/// 
    for some formats the image can be displayed/converted using ImageMagick, eg:
    		///        display -size 640x480+16 [-depth ?] [-sampling-factor ?x?] \
    		///            {GRAY,RGB,UYVY,YUV}:[file]
    		/// 
Parameters:
image the image object to dump
filebase base filename, appended with ".XXXX.zimg" where XXXX is the format fourcc
Returns:
0 on success or a system error code on failure

Member Data Documentation

IntPtr ZBar.Image.handle [private]

Definition at line 35 of file Image.cs.


Property Documentation

byte [] ZBar.Image.Data [get, set]

Get/set the data associated with this image

This method copies that data, using Marshal.Copy.

Definition at line 165 of file Image.cs.

uint ZBar.Image.Format [get, set]

Get/set the fourcc image format code for image sample data.

Chaning this doesn't affect the data.

Definition at line 140 of file Image.cs.

internal IntPtr ZBar.Image.Handle [get, private]

Get a pointer to the unmanaged image resource.

Definition at line 84 of file Image.cs.

uint ZBar.Image.Height [get, set]

Get/set the height of the image, doesn't affect the data

Definition at line 127 of file Image.cs.

uint ZBar.Image.SequenceNumber [get, set]

Get/set a "sequence" (page/frame) number associated with this image.

Definition at line 152 of file Image.cs.

IEnumerable<Symbol> ZBar.Image.Symbols [get]

Get ImageScanner decode result iterator.

Definition at line 185 of file Image.cs.

uint ZBar.Image.Width [get, set]

Get/set the width of the image, doesn't affect the data

Definition at line 115 of file Image.cs.


The documentation for this class was generated from the following file:

Foodolini 1.0.0 Documentation, generated with DoxyGen.