Describes the size and shape of an image. More...
Public Member Functions | |
const char * | name () const |
user-visible name of format | |
void | name (const char *n) |
change the name of the format | |
int | width () const |
Width of image file in pixels. | |
void | width (int v) |
int | height () const |
Height of image file in pixels. | |
void | height (int v) |
double | pixel_aspect () const |
Ratio of pixel_width/pixel_height. | |
void | pixel_aspect (double v) |
Format () | |
Format (int w, int h, int x, int y, int r, int t, double pa=1) | |
Format (int w, int h, double pa=1) | |
void | add (const char *name) |
bool | is_none () const |
void | append (Hash &) const |
void | from_uv (float u, float v, float &X, float &Y) const |
void | to_uv (float X, float Y, float &u, float &v) const |
void | from_uv_centre (float u, float v, int &X, int &Y, bool ignore_pixel_aspect=false) const |
void | to_uv_centre (int X, int Y, float &u, float &v, bool ignore_pixel_aspect=false) const |
Public Member Functions inherited from DD::Image::Box | |
iterator | begin () const |
iterator | end () const |
Box (int x, int y, int r, int t) | |
Box (const Box &b) | |
int | x () const |
void | x (int v) |
int | y () const |
void | y (int v) |
int | r () const |
void | r (int v) |
int | t () const |
void | t (int v) |
int | w () const |
void | w (int v) |
int | h () const |
void | h (int v) |
float | center_x () const |
float | center_y () const |
void | set (int x, int y, int r, int t) |
void | set (const Box &b) |
bool | is_constant () const |
void | clear () |
void | move (int dx, int dy) |
void | pad (int dx, int dy, int dr, int dt) |
void | pad (int dx, int dy) |
void | pad (int d) |
int | clampx (int x) const |
int | clampy (int y) const |
void | merge (const Box &) |
void | merge (int x, int y) |
void | merge (int x, int y, int r, int t) |
void | expand (int amount) |
void | expand (int widthAmount, int heightAmount) |
void | scale (float scaleAmount) |
void | intersect (const Box &) |
void | intersect (int x, int y, int r, int t) |
bool | intersects (const Box &other) const |
bool | intersects (int x, int y, int r, int t) const |
bool | contains (const Box &other) const |
int | area () const |
Static Public Member Functions | |
static Format * | findExisting (int w, int h, double pixel_aspect=0) |
static Format * | index (int i) |
static unsigned | size () |
Static Public Attributes | |
static Format | None |
Additional Inherited Members | |
Public Types inherited from DD::Image::Box | |
typedef iterator | const_iterator |
Describes the size and shape of an image.
This is the structure returned by Iop::info().format
When an image is written the width and height of the format determine the size of the image file. Data outside this is clipped.
The x,y,r,t rectangle is the "aperture" which is where the image data actually is, the rest is padding or borders. In most formats the box is equal to 0,0,width,height, this is used by film formats such as Academy where a large gap at the left is soundtrack, or for letterboxed images imbedded in larger 4:3 image formats. The primary use of this box is to convert coordinates between formats so that the user's idea of the center and edges of the image is preserved. Some operators also use this to clip drawing or to set the center of projection.
The pixel_aspect is used to make the operators act "square" even if the data isn't. Filters use this to adjust their aspects, and transformations use this to make rotations work.
Though the info() of an Iop will often match either the aperture box or the outside of the format, there is no requirement of this. The data in an image may be larger or smaller than the Format and does not have to intersect it.
|
inline |
Default constructor puts garbage in all fields.
void Format::add | ( | const char * | name | ) |
Add this instance to a list of "named" formats. This list is searched by findExisting(). You should not delete this format after doing this. The name can be null in which case Nuke will generate a "640x480" style name for you.
References name().
Referenced by DD::Image::Reader::set_info().
|
static |
Finds the first format with the given size and pixel aspect.
If pixel_aspect is zero then the first match with any pixel_aspect is returned. This is for the common case of files where the size is known but not the pixel aspect, it allows the size to choose the pixel aspect.
References pixel_aspect().
Referenced by DD::Image::Reader::set_info().
|
static |
Return the i'th format known about. i must be between 0 and size().
|
static |
Return the number of formats known about.
|
inline |
True if this is None
Referenced by DD::Image::Black::Black(), and DD::Image::Reader::set_info().
void Format::append | ( | Hash & | hash | ) | const |
Add this format to the hash. Does not include the format name.
References height(), DD::Image::Box::r(), DD::Image::Box::t(), width(), DD::Image::Box::x(), and DD::Image::Box::y().
|
inline |
Transform a UV coordinate in the range 0-1 into the format's XY range
|
inline |
Back-transform an XY coordinate in the format's space into UV space.
|
inline |
Transform a screen centre based UV coordinate in the range 0-1 into the format's XY range
References fast_rint().
|
inline |
Back-transform an XY coordinate in the format's space into screen centre based UV space.
|
static |
The format fields of DD::Image::Iop are initialized to this value, which is a video (640x480) sized image. Most operators will change the initial value.
Referenced by DD::Image::Black::Black(), DD::Image::Iop::Iop(), and DD::Image::Reader::Reader().
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |