core/vidl/vidl_pixel_iterator.h
Go to the documentation of this file.
00001 // This is core/vidl/vidl_pixel_iterator.h
00002 #ifndef vidl_pixel_iterator_h_
00003 #define vidl_pixel_iterator_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Iterators over pixels in a frame
00010 //
00011 // \author Matt Leotta 
00012 // \date 16 Jan 2006
00013 //
00014 // This file contains the classes and functions to use pixel iterators
00015 // in a polymorphic way.  Note that pixel iterators are not fast.
00016 // They are intended to allow for the automatic generation of conversion
00017 // routines between any pair of pixel formats.  Fast conversion functions
00018 // for specific formats can be written to override the default ones when needed.
00019 
00020 
00021 #include "vidl_pixel_format.h"
00022 #include "vidl_frame.h"
00023 
00024 
00025 //-----------------------------------------------------------------------------
00026 
00027 //: Abstract pixel iterator base class
00028 // A concrete pixel iterator for each pixel format is
00029 // derived from this class (see vidl_pixel_format.txx) 
00030 class vidl_pixel_iterator
00031 {
00032   public:
00033     //: Destructor
00034     virtual ~vidl_pixel_iterator(){}
00035     //: Return the pixel format
00036     virtual vidl_pixel_format pixel_format() const = 0;
00037     //: Pre-increment: step to the next pixel
00038     virtual vidl_pixel_iterator& operator++ () = 0;
00039     //: Copy the pixel data into a byte array
00040     virtual void get_data(vxl_byte* data) const = 0;
00041     //: Set the pixel data from a byte array
00042     virtual void set_data(const vxl_byte* data) = 0;
00043 };
00044 
00045 
00046 //: Pixel iterator factory
00047 // Creates a new pixel iterator on the heap
00048 // The iterator is initialized to the first pixel in the frame
00049 // \note The user is responsible for deleting the iterator
00050 vidl_pixel_iterator*
00051 vidl_make_pixel_iterator(const vidl_frame& frame);
00052 
00053 
00054 //: Return true if the pixel format has a valid pixel iterator implementation
00055 bool vidl_has_pixel_iterator(vidl_pixel_format FMT);
00056 
00057 
00058 
00059 
00060 #endif // vidl_pixel_iterator_h_
00061