Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Image4 Class Reference

RGBA image with 32-bit floating point storage for each channel. More...

#include <Image4.h>

Inherits G3D::Map2D< Color4, Color4 >.

List of all members.

Public Types

typedef Color4 ComputeType
typedef Image4Ref Ref
typedef Color4 StorageType
typedef Image4 Type

Public Member Functions

Color4 bicubic (const Vector2 &p) const
Color4 bicubic (const Vector2 &p, WrapMode wrap) const
Color4 bicubic (float x, float y) const
Color4 bicubic (float x, float y, WrapMode wrap) const
Color4 bilinear (const Vector2 &p, WrapMode wrap) const
Color4 bilinear (const Vector2 &p) const
Color4 bilinear (float x, float y) const
Color4 bilinear (float x, float y, WrapMode wrap) const
bool changed ()
void flipHorizontal ()
void flipVertical ()
Color4get (const Vector2int16 &p)
Color4get (int x, int y)
Color4get (int x, int y, WrapMode wrap)
const Color4get (const Vector2int16 &p, WrapMode wrap) const
const Color4get (const Vector2int16 &p) const
const Color4get (int x, int y) const
const Color4get (int x, int y, WrapMode wrap) const
const Array< Color4 > & getArray () const
Array< Color4 > & getArray ()
const Color4getCArray () const
Color4getCArray ()
uint32 height () const
bool inBounds (const Vector2int16 &v) const
bool inBounds (int x, int y) const
void load (const std::string &filename, GImage::Format fmt=GImage::AUTODETECT)
Color4 nearest (const Vector2 &p) const
Color4 nearest (float x, float y) const
Color4 nearest (float x, float y, WrapMode wrap) const
Rect2D rect2DBounds () const
void ReferenceCountedObject_zeroWeakPointers ()
void resize (uint32 newW, uint32 newH)
void save (const std::string &filename, GImage::Format fmt=GImage::AUTODETECT)
void set (int x, int y, const Color4 &v)
void set (int x, int y, const Color4 &v, WrapMode wrap)
void set (const Vector2int16 &p, const Color4 &v)
void setAll (const Color4 &v)
void setChanged (bool c)
void setWrapMode (WrapMode m)
Vector2int16 size () const
size_t sizeInMemory () const
uint32 width () const
WrapMode wrapMode () const

Static Public Member Functions

static Ref create (int w=0, int h=0, WrapMode wrap=WrapMode::ERROR)
static Ref createEmpty (WrapMode wrap=WrapMode::ERROR)
static Ref createEmpty (int width, int height, WrapMode wrap=WrapMode::ERROR)
static Ref fromArray (const class Color4 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR)
static Ref fromArray (const class Color3 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR)
static Ref fromArray (const class Color1 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR)
static Ref fromArray (const class Color4uint8 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR)
static Ref fromArray (const class Color3uint8 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR)
static Ref fromArray (const class Color1uint8 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR)
static Ref fromFile (const std::string &filename, WrapMode wrap=WrapMode::ERROR, GImage::Format fmt=GImage::AUTODETECT)
static Ref fromGImage (const class GImage &im, WrapMode wrap=WrapMode::ERROR)
static Ref fromImage4uint8 (const ReferenceCountedPointer< class Image4uint8 > &im)

Public Attributes

GMutex mutex
AtomicInt32 ReferenceCountedObject_refCount
_WeakPtrLinkedListReferenceCountedObject_weakPointer

Protected Member Functions

Color4 bicubic (const Color4 *ctrl, double s) const
void copyArray (const Color4uint8 *src, int w, int h)
void copyArray (const Color3uint8 *src, int w, int h)
void copyArray (const Color1uint8 *src, int w, int h)
void copyArray (const Color4 *src, int w, int h)
void copyArray (const Color3 *src, int w, int h)
void copyArray (const Color1 *src, int w, int h)
void copyGImage (const class GImage &im)
const Color4fastGet (int x, int y) const
void fastSet (int x, int y, const Color4 &v)
 Image4 (int w, int h, WrapMode wrap)
const Color4slowGet (int x, int y, WrapMode wrap)

Protected Attributes

WrapMode _wrapMode
Array< Color4data
uint32 h
AtomicInt32 m_changed
uint32 w
Color4 ZERO


Detailed Description

RGBA image with 32-bit floating point storage for each channel.

Whenever a method needs to convert from RGB to ARGB, A=1 is assumed.

See also G3D::Image4uint8, G3D::GImage.


Member Typedef Documentation

typedef Color4 G3D::Map2D< Color4 , Color4 >::ComputeType [inherited]

typedef Color4 G3D::Map2D< Color4 , Color4 >::StorageType [inherited]


Constructor & Destructor Documentation

G3D::Image4::Image4 ( int  w,
int  h,
WrapMode  wrap 
) [protected]


Member Function Documentation

Color4 G3D::Map2D< Color4 , Color4 >::bicubic ( const Vector2 p  )  const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::bicubic ( const Vector2 p,
WrapMode  wrap 
) const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::bicubic ( float  x,
float  y 
) const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::bicubic ( float  x,
float  y,
WrapMode  wrap 
) const [inline, inherited]

Uses Catmull-Rom splines to interpolate between grid values.

Guaranteed to match nearest(x, y) at integers.

Color4 G3D::Map2D< Color4 , Color4 >::bicubic ( const Color4 ctrl,
double  s 
) const [inline, protected, inherited]

Given four control points and a value on the range [0, 1) evaluates the Catmull-rom spline between the times of the middle two control points.

Color4 G3D::Map2D< Color4 , Color4 >::bilinear ( const Vector2 p,
WrapMode  wrap 
) const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::bilinear ( const Vector2 p  )  const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::bilinear ( float  x,
float  y 
) const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::bilinear ( float  x,
float  y,
WrapMode  wrap 
) const [inline, inherited]

Needs to access elements from (floor(x), floor(y)) to (floor(x) + 1, floor(y) + 1) and will use the wrap mode appropriately (possibly generating out of bounds errors).

Guaranteed to match nearest(x, y) at integers.

bool G3D::Map2D< Color4 , Color4 >::changed (  )  [inline, inherited]

Returns true if this map has been written to since the last call to setChanged(false).

This is useful if you are caching a texture map other value that must be recomputed whenever this changes.

void G3D::Image4::copyArray ( const Color4uint8 src,
int  w,
int  h 
) [protected]

void G3D::Image4::copyArray ( const Color3uint8 src,
int  w,
int  h 
) [protected]

void G3D::Image4::copyArray ( const Color1uint8 src,
int  w,
int  h 
) [protected]

void G3D::Image4::copyArray ( const Color4 src,
int  w,
int  h 
) [protected]

void G3D::Image4::copyArray ( const Color3 src,
int  w,
int  h 
) [protected]

void G3D::Image4::copyArray ( const Color1 src,
int  w,
int  h 
) [protected]

void G3D::Image4::copyGImage ( const class GImage im  )  [protected]

static Ref G3D::Map2D< Color4 , Color4 >::create ( int  w = 0,
int  h = 0,
WrapMode  wrap = WrapMode::ERROR 
) [inline, static, inherited]

static Ref G3D::Image4::createEmpty ( WrapMode  wrap = WrapMode::ERROR  )  [static]

Creates a 0 x 0 image.

static Ref G3D::Image4::createEmpty ( int  width,
int  height,
WrapMode  wrap = WrapMode::ERROR 
) [static]

Creates an all-zero width x height image.

const Color4 & G3D::Map2D< Color4 , Color4 >::fastGet ( int  x,
int  y 
) const [inline, protected, inherited]

void G3D::Map2D< Color4 , Color4 >::fastSet ( int  x,
int  y,
const Color4 v 
) [inline, protected, inherited]

void G3D::Map2D< Color4 , Color4 >::flipHorizontal (  )  [inline, inherited]

void G3D::Map2D< Color4 , Color4 >::flipVertical (  )  [inline, inherited]

static Ref G3D::Image4::fromArray ( const class Color4 ptr,
int  width,
int  height,
WrapMode  wrap = WrapMode::ERROR 
) [static]

static Ref G3D::Image4::fromArray ( const class Color3 ptr,
int  width,
int  height,
WrapMode  wrap = WrapMode::ERROR 
) [static]

static Ref G3D::Image4::fromArray ( const class Color1 ptr,
int  width,
int  height,
WrapMode  wrap = WrapMode::ERROR 
) [static]

static Ref G3D::Image4::fromArray ( const class Color4uint8 ptr,
int  width,
int  height,
WrapMode  wrap = WrapMode::ERROR 
) [static]

static Ref G3D::Image4::fromArray ( const class Color3uint8 ptr,
int  width,
int  height,
WrapMode  wrap = WrapMode::ERROR 
) [static]

static Ref G3D::Image4::fromArray ( const class Color1uint8 ptr,
int  width,
int  height,
WrapMode  wrap = WrapMode::ERROR 
) [static]

static Ref G3D::Image4::fromFile ( const std::string &  filename,
WrapMode  wrap = WrapMode::ERROR,
GImage::Format  fmt = GImage::AUTODETECT 
) [static]

static Ref G3D::Image4::fromGImage ( const class GImage im,
WrapMode  wrap = WrapMode::ERROR 
) [static]

static Ref G3D::Image4::fromImage4uint8 ( const ReferenceCountedPointer< class Image4uint8 > &  im  )  [static]

Color4 & G3D::Map2D< Color4 , Color4 >::get ( const Vector2int16 p  )  [inline, inherited]

Color4 & G3D::Map2D< Color4 , Color4 >::get ( int  x,
int  y 
) [inline, inherited]

Color4 & G3D::Map2D< Color4 , Color4 >::get ( int  x,
int  y,
WrapMode  wrap 
) [inline, inherited]

const Color4 & G3D::Map2D< Color4 , Color4 >::get ( const Vector2int16 p,
WrapMode  wrap 
) const [inline, inherited]

const Color4 & G3D::Map2D< Color4 , Color4 >::get ( const Vector2int16 p  )  const [inline, inherited]

const Color4 & G3D::Map2D< Color4 , Color4 >::get ( int  x,
int  y 
) const [inline, inherited]

const Color4 & G3D::Map2D< Color4 , Color4 >::get ( int  x,
int  y,
WrapMode  wrap 
) const [inline, inherited]

Get the value at (x, y).

Note that the type of image->get(x, y) is the storage type, not the computation type. If the constructor promoting Storage to Compute rescales values (as, for example Color3(Color3uint8&) does), this will not match the value returned by Map2D::nearest.

const Array<Color4 >& G3D::Map2D< Color4 , Color4 >::getArray (  )  const [inline, inherited]

Array<Color4 >& G3D::Map2D< Color4 , Color4 >::getArray (  )  [inline, inherited]

Row-major array.

You should call setChanged(true) if you mutate the array.

const Color4 * G3D::Map2D< Color4 , Color4 >::getCArray (  )  const [inline, inherited]

Color4 * G3D::Map2D< Color4 , Color4 >::getCArray (  )  [inline, inherited]

Returns a pointer to the underlying row-major data.

There is no padding at the end of the row. Be careful--this will be reallocated during a resize. You should call setChanged(true) if you mutate the array.

uint32 G3D::Map2D< Color4 , Color4 >::height (  )  const [inline, inherited]

Pixel height.

bool G3D::Map2D< Color4 , Color4 >::inBounds ( const Vector2int16 v  )  const [inline, inherited]

is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode

bool G3D::Map2D< Color4 , Color4 >::inBounds ( int  x,
int  y 
) const [inline, inherited]

is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode

void G3D::Image4::load ( const std::string &  filename,
GImage::Format  fmt = GImage::AUTODETECT 
)

Loads from any of the file formats supported by G3D::GImage.

Color4 G3D::Map2D< Color4 , Color4 >::nearest ( const Vector2 p  )  const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::nearest ( float  x,
float  y 
) const [inline, inherited]

Color4 G3D::Map2D< Color4 , Color4 >::nearest ( float  x,
float  y,
WrapMode  wrap 
) const [inline, inherited]

Returns the nearest neighbor.

Pixel values are considered to be at the upper left corner, so image->nearest(x, y) == image(x, y)

Rect2D G3D::Map2D< Color4 , Color4 >::rect2DBounds (  )  const [inline, inherited]

Rectangle from (0, 0) to (w, h).

void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers (  )  [inline, inherited]

Automatically called immediately before the object is deleted.

This is not called from the destructor because it needs to be invoked before the subclass destructor.

void G3D::Map2D< Color4 , Color4 >::resize ( uint32  newW,
uint32  newH 
) [inline, inherited]

Resizes without clearing, leaving garbage.

void G3D::Image4::save ( const std::string &  filename,
GImage::Format  fmt = GImage::AUTODETECT 
)

Saves in any of the formats supported by G3D::GImage.

void G3D::Map2D< Color4 , Color4 >::set ( int  x,
int  y,
const Color4 v 
) [inline, inherited]

void G3D::Map2D< Color4 , Color4 >::set ( int  x,
int  y,
const Color4 v,
WrapMode  wrap 
) [inline, inherited]

void G3D::Map2D< Color4 , Color4 >::set ( const Vector2int16 p,
const Color4 v 
) [inline, inherited]

void G3D::Map2D< Color4 , Color4 >::setAll ( const Color4 v  )  [inline, inherited]

void G3D::Map2D< Color4 , Color4 >::setChanged ( bool  c  )  [inline, inherited]

Set/unset the changed flag.

void G3D::Map2D< Color4 , Color4 >::setWrapMode ( WrapMode  m  )  [inline, inherited]

Vector2int16 G3D::Map2D< Color4 , Color4 >::size (  )  const [inline, inherited]

Dimensions in pixels.

size_t G3D::Map2D< Color4 , Color4 >::sizeInMemory (  )  const [inline, inherited]

Number of bytes occupied by the image data and this structure.

const Color4 & G3D::Map2D< Color4 , Color4 >::slowGet ( int  x,
int  y,
WrapMode  wrap 
) [inline, protected, inherited]

Handles the exceptional cases from get.

uint32 G3D::Map2D< Color4 , Color4 >::width (  )  const [inline, inherited]

Pixel width.

WrapMode G3D::Map2D< Color4 , Color4 >::wrapMode (  )  const [inline, inherited]


Member Data Documentation

WrapMode G3D::Map2D< Color4 , Color4 >::_wrapMode [protected, inherited]

Array<Color4 > G3D::Map2D< Color4 , Color4 >::data [protected, inherited]

uint32 G3D::Map2D< Color4 , Color4 >::h [protected, inherited]

Height, in pixels.

AtomicInt32 G3D::Map2D< Color4 , Color4 >::m_changed [protected, inherited]

0 if no mutating method has been invoked since the last call to setChanged();

GMutex G3D::Map2D< Color4 , Color4 >::mutex [inherited]

Although Map2D is not threadsafe (except for the setChanged() method), you can use this mutex to create your own threadsafe access to a Map2D.

Not used by the default implementation.

The long name is to keep this from accidentally conflicting with a subclass's variable name.

Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.

Linked list of all weak pointers that reference this (some may be on the stack!).

Do not use or explicitly manipulate this value.

uint32 G3D::Map2D< Color4 , Color4 >::w [protected, inherited]

Width, in pixels.

Color4 G3D::Map2D< Color4 , Color4 >::ZERO [protected, inherited]


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:46 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo