ImageDescriptor Class Reference

This reference page is linked to from the following overview topics: Images.



Detailed Description

Describe an image, specifically how to interpret pixel data.

This class derives from PixelDescriptor and adds a bounding rectangle and spatial resolution.

Definition at line 1162 of file image.h.

#include <image.h>

Inheritance diagram for ImageDescriptor:
Inheritance graph
[legend]

List of all members.

Public Types

enum   ResUnit { k_PixelsPerInch = 1, k_PixelsPerCentimeter = 2 }
 

Resolution units (mainly used so resolution is preserved in PSD & TIFF files)

More...

Public Member Functions

  ImageDescriptor (int x, int y, int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
  Constructor -- make a descriptor...
  ImageDescriptor (int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
  Constructor -- make a descriptor...
  ImageDescriptor ()
  default constructor -- RGBA, premult, 4 channel uChar, size 0 x 0 pixels.
int  numBytes () const
  return the number of bytes the raw image pixels will occupy -- not necessarily accurate for VirtualImages
int  strideBytes () const
  return the number of bytes wide that the image is
int  xSize () const
  return the x Size of the image
int  ySize () const
  return the y Size of the image
int  cSize () const
  return the channel count of the image
bool  sizeEqual (const ImageDescriptor &o) const
  return true if the x and y dimensions are equal
void  setSize (int nx, int ny)
  Set the size of the image in pixels.
const ImgTile getBounds () const
  return the bounds of the image
void  getResolutionInfo (float &xRes, float &yRes, ResUnit &unit) const
  return the horizontal and vertical resolution of the image
void  setResolutionInfo (float xRes, float yRes, ResUnit unit)
  set the horizontal and vertical resolution of the image

Protected Attributes

ImgTile  m_Bounds
  Bounds of the image -- some images may not have a 0,0 origin.
float  m_xResolution
  horizontal resolution in pixels per unit
float  m_yResolution
  vertical resolution in pixels per unit
ResUnit  m_ResolutionUnits
  units -- 1 == inch, 2 == centimeter (same as in PSD files)

Friends

class  Image

Member Enumeration Documentation

enum ResUnit

Resolution units (mainly used so resolution is preserved in PSD & TIFF files)

Enumerator:
k_PixelsPerInch 

pixels per inch

k_PixelsPerCentimeter 

pixels per centimeter

Definition at line 1166 of file image.h.


Constructor & Destructor Documentation

ImageDescriptor ( int  x,
int  y,
int  nx,
int  ny,
MemoryChannelOrder  order = orderRGBA,
bool  premult = true,
char  nc = 4,
ChannelType  ct = uChar 
) [inline]

Constructor -- make a descriptor...

Parameters:
x x origin of the image
y y origin of the image
nx xSize of the image
ny ySize of the image
order channel ordering of the image
premult Are the RGB channels premultiplied by the A?
nc number of channels -- currently only 4 is supported
ct data type of the channels -- currently only uChar is supported.

Definition at line 1191 of file image.h.

                                                         :
        PixelDescriptor(nc, ct, order, premult),
        m_Bounds(x, y, nx, ny),
        m_xResolution(100.0f), m_yResolution(100.0f),
        m_ResolutionUnits(k_PixelsPerInch) {}
ImageDescriptor ( int  nx,
int  ny,
MemoryChannelOrder  order = orderRGBA,
bool  premult = true,
char  nc = 4,
ChannelType  ct = uChar 
) [inline]

Constructor -- make a descriptor...

Parameters:
nx xSize of the image
ny ySize of the image
order channel ordering of the image
premult Are the RGB channels premultiplied by the A?
nc number of channels -- currently only 4 is supported
ct data type of the channels -- currently only uChar is supported.

Definition at line 1210 of file image.h.

                                                         :
        PixelDescriptor(nc, ct, order, premult),
        m_Bounds(0, 0, nx, ny) {}
ImageDescriptor ( ) [inline]

default constructor -- RGBA, premult, 4 channel uChar, size 0 x 0 pixels.

Definition at line 1218 of file image.h.

                      :
        PixelDescriptor(4, uChar,  orderRGBA, true),
        m_Bounds(0,0,0,0) {}

Member Function Documentation

int numBytes ( ) const [inline]

return the number of bytes the raw image pixels will occupy -- not necessarily accurate for VirtualImages

Definition at line 1224 of file image.h.

{ return m_Bounds.nx * m_Bounds.ny * pixelSize(); }
int strideBytes ( ) const [inline]

return the number of bytes wide that the image is

Definition at line 1227 of file image.h.

{ return m_Bounds.nx * pixelSize(); }
int xSize ( ) const [inline]

return the x Size of the image

Definition at line 1230 of file image.h.

{ return m_Bounds.nx;  }
int ySize ( ) const [inline]

return the y Size of the image

Definition at line 1233 of file image.h.

{ return m_Bounds.ny;  }
int cSize ( ) const [inline]

return the channel count of the image

Definition at line 1236 of file image.h.

{ return m_cCount; }
bool sizeEqual ( const ImageDescriptor o ) const [inline]

return true if the x and y dimensions are equal

Parameters:
o the other descriptor to compare against.

Definition at line 1241 of file image.h.

        { return ((xSize() == o.xSize()) && (ySize() == o.ySize())); }
void setSize ( int  nx,
int  ny 
) [inline]

Set the size of the image in pixels.

Definition at line 1245 of file image.h.

{ m_Bounds.nx = nx; m_Bounds.ny = ny; }
const ImgTile& getBounds ( ) const [inline]

return the bounds of the image

Definition at line 1248 of file image.h.

{ return m_Bounds; }
void getResolutionInfo ( float &  xRes,
float &  yRes,
ResUnit unit 
) const [inline]

return the horizontal and vertical resolution of the image

Parameters:
xRes returned X Resolution in Pixels per unit
yRes returned y Resolution in Pixels per unit
unit returned resolution unit

Definition at line 1256 of file image.h.

    {
        xRes = m_xResolution; yRes = m_yResolution, unit = m_ResolutionUnits;
    }
void setResolutionInfo ( float  xRes,
float  yRes,
ResUnit  unit 
) [inline]

set the horizontal and vertical resolution of the image

Parameters:
xRes new X Resolution in Pixels per unit
yRes new y Resolution in Pixels per unit
unit new resolution unit

Definition at line 1267 of file image.h.

    {
        m_xResolution = xRes; m_yResolution = yRes, m_ResolutionUnits = unit;
    }

Friends And Related Function Documentation

friend class Image [friend]

Definition at line 1272 of file image.h.


Member Data Documentation

ImgTile m_Bounds [protected]

Bounds of the image -- some images may not have a 0,0 origin.

Definition at line 1171 of file image.h.

float m_xResolution [protected]

horizontal resolution in pixels per unit

Definition at line 1173 of file image.h.

float m_yResolution [protected]

vertical resolution in pixels per unit

Definition at line 1174 of file image.h.

units -- 1 == inch, 2 == centimeter (same as in PSD files)

Definition at line 1175 of file image.h.


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

ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor
ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor ImageDescriptor