Support Forum G3D Web Page |
Compact storage for luminance/alpha-only/red-only normalized 8-bit images.
More...
Inherits G3D::Map2D< Color1unorm8, Color1 >.
Public Types | |
typedef Color1 | ComputeType |
typedef Color1unorm8 | StorageType |
typedef Image1unorm8 | Type |
Public Member Functions | |
Color1 | average () const |
Returns the average value of all elements of the map. More... | |
Color1 | bicubic (float x, float y, WrapMode wrap) const |
Uses Catmull-Rom splines to interpolate between grid values. More... | |
Color1 | bicubic (float x, float y) const |
Color1 | bicubic (const Vector2 &p, WrapMode wrap) const |
Color1 | bicubic (const Vector2 &p) const |
Color1 | bilinear (float x, float y, WrapMode wrap) const |
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). More... | |
Color1 | bilinear (float x, float y) const |
Color1 | bilinear (const Vector2 &p) const |
Color1 | bilinear (const Vector2 &p, WrapMode wrap) const |
bool | changed () |
Returns true if this map has been written to since the last call to setChanged(false). More... | |
virtual void | crop (int newX, int newY, int newW, int newH) |
Crops this map so that it only contains pixels between (x, y) and (x + w - 1, y + h - 1) inclusive. More... | |
virtual void | crop (const Rect2D &rect) |
iRounds to the nearest x0 and y0. More... | |
const Color1unorm8 & | fastGet (int x, int y) const |
Unsafe access to the underlying data structure with no wrapping support; requires that (x, y) is in bounds. More... | |
void | fastSet (int x, int y, const Color1unorm8 &v) |
Unsafe access to the underlying data structure with no wrapping support; requires that (x, y) is in bounds. More... | |
virtual void | flipHorizontal () |
virtual void | flipVertical () |
const class ImageFormat * | format () const |
const Color1unorm8 & | get (int x, int y, WrapMode wrap) const |
Get the value at (x, y). More... | |
const Color1unorm8 & | get (int x, int y) const |
const Color1unorm8 & | get (const Vector2int16 &p) const |
const Color1unorm8 & | get (const Vector2int16 &p, WrapMode wrap) const |
Color1unorm8 & | get (int x, int y, WrapMode wrap) |
Color1unorm8 & | get (int x, int y) |
Color1unorm8 & | get (const Vector2int16 &p) |
Array< Color1unorm8 > & | getArray () |
Row-major array. More... | |
const Array< Color1unorm8 > & | getArray () const |
Color1unorm8 * | getCArray () |
Returns a pointer to the underlying row-major data. More... | |
const Color1unorm8 * | getCArray () const |
int32 | height () const |
Pixel height. More... | |
bool | inBounds (int x, int y) const |
is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode More... | |
bool | inBounds (const Vector2int16 &v) const |
is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode More... | |
void | load (const String &filename) |
Loads from any of the file formats supported by G3D::GImage. More... | |
void | maybeFlipVertical (bool flip) |
flips if flip is true More... | |
Color1 | nearest (float x, float y, WrapMode wrap) const |
Returns the nearest neighbor. More... | |
Color1 | nearest (float x, float y) const |
Color1 | nearest (const Vector2 &p) const |
Rect2D | rect2DBounds () const |
Rectangle from (0, 0) to (w, h) More... | |
void | resize (uint32 newW, uint32 newH, uint32 newD=1) |
Resizes without clearing, leaving garbage. More... | |
void | save (const String &filename) |
Saves in any of the formats supported by G3D::GImage. More... | |
void | set (const Vector2int16 &p, const Color1unorm8 &v) |
Sets the changed flag to true. More... | |
void | set (int x, int y, const Color1unorm8 &v, WrapMode wrap) |
Sets the changed flag to true. More... | |
void | set (int x, int y, const Color1unorm8 &v) |
void | set (const shared_ptr< Map2D< Color1unorm8, T > > &src) |
Copy values from src, which must have the same size. More... | |
void | setAll (const Color1unorm8 &v) |
void | setChanged (bool c) |
Set/unset the changed flag. More... | |
void | setWrapMode (WrapMode m) |
Vector2int16 | size () const |
Dimensions in pixels. More... | |
size_t | sizeInMemory () const |
Number of bytes occupied by the image data and this structure. More... | |
int32 | width () const |
Pixel width. More... | |
WrapMode | wrapMode () const |
Static Public Member Functions | |
static shared_ptr< Map2D< Color1unorm8, Color1 > > | create (int w=0, int h=0, WrapMode wrap=WrapMode::ERROR, int d=1) |
static shared_ptr< Image1unorm8 > | createEmpty (int width, int height, WrapMode wrap=WrapMode::ERROR) |
Creates an all-zero width x height image. More... | |
static shared_ptr< Image1unorm8 > | createEmpty (WrapMode wrap=WrapMode::ERROR) |
Creates a 0 x 0 image. More... | |
static shared_ptr< Image1unorm8 > | fromArray (const class Color1unorm8 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR) |
static shared_ptr< Image1unorm8 > | fromArray (const class Color3unorm8 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR) |
static shared_ptr< Image1unorm8 > | fromArray (const class Color4unorm8 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR) |
static shared_ptr< Image1unorm8 > | fromArray (const class Color1 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR) |
static shared_ptr< Image1unorm8 > | fromArray (const class Color3 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR) |
static shared_ptr< Image1unorm8 > | fromArray (const class Color4 *ptr, int width, int height, WrapMode wrap=WrapMode::ERROR) |
static shared_ptr< Image1unorm8 > | fromFile (const String &filename, WrapMode wrap=WrapMode::ERROR) |
static shared_ptr< Image1unorm8 > | fromImage1 (const shared_ptr< class Image1 > &im) |
static shared_ptr< Image1unorm8 > | fromImage3unorm8 (const shared_ptr< class Image3unorm8 > &im) |
static float | R (float x) |
Public Attributes | |
std::mutex | mutex |
Although Map2D is not threadsafe (except for the setChanged() method), you can use this mutex to create your own threadsafe access to a Map2D. More... | |
Protected Member Functions | |
Image1unorm8 (int w, int h, WrapMode wrap) | |
void | copyArray (const Color1 *src, int w, int h) |
void | copyArray (const Color3 *src, int w, int h) |
void | copyArray (const Color4 *src, int w, int h) |
void | copyArray (const Color1unorm8 *src, int w, int h) |
void | copyArray (const Color3unorm8 *src, int w, int h) |
void | copyArray (const Color4unorm8 *src, int w, int h) |
const Color1unorm8 & | slowGet (int x, int y, WrapMode wrap) |
Handles the exceptional cases from get. More... | |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
Protected Attributes | |
uint32 | d |
Depth, in pixels, defaults to 1. More... | |
Array< Color1unorm8 > | data |
uint32 | h |
Height, in pixels. More... | |
std::atomic_bool | m_changed |
false if no mutating method has been invoked since the last call to setChanged(); More... | |
WrapMode | m_wrapMode |
uint32 | w |
Width, in pixels. More... | |
Color1unorm8 | ZERO |
Compact storage for luminance/alpha-only/red-only normalized 8-bit images.
See also G3D::Image3, G3D::GImage
|
inherited |
|
inherited |
typedef Image1unorm8 G3D::Image1unorm8::Type |
|
protected |
|
inlineinherited |
Returns the average value of all elements of the map.
|
inlineinherited |
Uses Catmull-Rom splines to interpolate between grid values.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
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.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
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.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inlinestaticinherited |
|
static |
Creates an all-zero width x height image.
|
static |
Creates a 0 x 0 image.
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
inlinevirtualinherited |
Crops this map so that it only contains pixels between (x, y) and (x + w - 1, y + h - 1) inclusive.
|
inlinevirtualinherited |
iRounds to the nearest x0 and y0.
|
inlineinherited |
Unsafe access to the underlying data structure with no wrapping support; requires that (x, y) is in bounds.
|
inlineinherited |
Unsafe access to the underlying data structure with no wrapping support; requires that (x, y) is in bounds.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
const class ImageFormat* G3D::Image1unorm8::format | ( | ) | const |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlineinherited |
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.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Row-major array.
You should call setChanged(true) if you mutate the array.
|
inlineinherited |
|
inlineinherited |
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.
|
inlineinherited |
|
inlineinherited |
Pixel height.
|
inlineinherited |
is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode
|
inlineinherited |
is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode
void G3D::Image1unorm8::load | ( | const String & | filename | ) |
Loads from any of the file formats supported by G3D::GImage.
If there is an alpha channel on the input, it is stripped.
|
inlineinherited |
flips if flip is true
|
inlineinherited |
Returns the nearest neighbor.
Pixel values are considered to be at the upper left corner, so image->nearest(x, y) == image(x, y)
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inlineinherited |
Rectangle from (0, 0) to (w, h)
|
inlineinherited |
Resizes without clearing, leaving garbage.
void G3D::Image1unorm8::save | ( | const String & | filename | ) |
Saves in any of the formats supported by G3D::GImage.
|
inlineinherited |
Sets the changed flag to true.
|
inlineinherited |
Sets the changed flag to true.
|
inlineinherited |
|
inlineinherited |
Copy values from src, which must have the same size.
|
inlineinherited |
|
inlineinherited |
Set/unset the changed flag.
|
inlineinherited |
|
inlineinherited |
Dimensions in pixels.
|
inlineinherited |
Number of bytes occupied by the image data and this structure.
|
inlineprotectedinherited |
Handles the exceptional cases from get.
|
inlineinherited |
Pixel width.
|
inlineinherited |
|
protectedinherited |
Depth, in pixels, defaults to 1.
|
protectedinherited |
|
protectedinherited |
Height, in pixels.
|
protectedinherited |
false if no mutating method has been invoked since the last call to setChanged();
|
protectedinherited |
|
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.
|
protectedinherited |
Width, in pixels.
|
protectedinherited |