CoreComponents 3.0.0
A Modern C++ Toolkit
|
2-dimensional color matrix More...
#include <cc/Image>
Public Member Functions | |
Image ()=default | |
Create a null image. | |
Image (int width, int height) | |
Create an image of width x height pixels. | |
Image (int width, int height, const Bytes &data) | |
Create an image for user allocated image data. | |
Image (Size size) | |
Convenience method to create an image of size.ceil() pixels. | |
Image (const String &path, const Bytes &data=Bytes{}) | |
Load image from path. | |
Image (const char *path) | |
Convenience method to load an image from path. | |
int | width () const |
Width of the image in pixels. | |
int | height () const |
Height of the image in pixels. | |
Size | size () const |
Get the size of the image. | |
int | pitch () const |
Number of bytes per image row. | |
Bytes & | data () |
Directly access image data. | |
const Bytes & | data () const |
Directly access image data. | |
Color & | pixel (long i) |
Get a reference to the i-th pixel. | |
const Color & | pixel (long i) const |
Get a constant reference to the i-th pixel. | |
long | count () const |
Number of pixels. | |
void | clear (Color c) |
Clear the entire image with color c. | |
void | premultiply () |
Convert the entire image from normal alpha to pre-multiplied alpha. | |
void | normalize () |
Convert the entire image from pre-multiplied alpha to normal alpha. | |
Image | copy () const |
Create a deep copy of this image. | |
void | copyToXy (Out< Image > target, int x, int y) const |
Copy this image to target at (x, y) | |
void | applyOver (Color paper) |
Add background paper to each transparent pixel. | |
bool | checkOpaque () const |
Check if all pixels of this image are opaque. | |
void | tone (Color color) |
Replace the red, green and blue of all non-transparent pixels by red, green and blue of color. | |
void | shadowBlur (int radius, Color shadowColor) |
Replace this image by a low-pass monochrome version of itself. | |
Image | scale (int scaledWidth, int scaledHeight) const |
Scaled image to new size (scaledWidth, scaledHeight) | |
void | save (const String &path, const String &mediaType="") |
Save image to path using given mediaType. | |
cairo_surface_t * | cairoSurface () |
Public Member Functions inherited from Surface | |
Surface ()=default | |
Create a null surface. | |
void | nextPage (bool clear=true) |
Open next page. | |
cairo_surface_t * | cairoSurface () |
Get a pointer to the underlying Cairo surface. | |
void | polish () |
Prepare surface before start painting. | |
Public Member Functions inherited from Object | |
Object ()=default | |
Create a null object. | |
operator bool () const | |
Check if this is a non-null object. | |
bool | isNull () const |
Check if this is a null object. | |
template<class T > | |
bool | is () const |
Check if this object is of type T. | |
template<class T > | |
T | as () const |
Cast this object to type T. | |
bool | isWeak () const |
Check if the underlying object reference is weak. | |
bool | operator== (const Object &other) const |
Equality operator. | |
std::strong_ordering | operator<=> (const Object &other) const |
Ordering operator. | |
long | useCount () const |
Reference count. | |
Additional Inherited Members | |
Protected Member Functions inherited from Surface | |
Surface (State *newState) | |
State & | me () |
const State & | me () const |
Protected Member Functions inherited from Object | |
template<class T > | |
T | weak () const |
template<class T > | |
void | initOnce () |
Create the object state when called the first time. | |
template<class T > | |
void | initOncePerThread () |
Create a distinct object state for each thread when called the first time in that thread. | |
Object (State *newState) | |
Initialize object with newState. | |
Object (State *state, Alias) | |
Object (State *state, Weak) | |
Object & | operator= (std::nullptr_t) |
Static Protected Member Functions inherited from Object | |
template<class T > | |
static T | alias (const State *state) |
Create an alias object for the given state. | |
template<class T > | |
static T | weak (const State *state) |
Protected Attributes inherited from Object | |
Handle< State > | me |
Internal object state | |
2-dimensional color matrix
|
default |
Create a null image.
Image | ( | int | width, |
int | height ) |
Create an image of width x height pixels.
Load image from path.
path | File system or resource path |
data | Optionally pass already loaded image data |
Image | ( | const char * | path | ) |
Convenience method to load an image from path.
int width | ( | ) | const |
Width of the image in pixels.
int height | ( | ) | const |
Height of the image in pixels.
Size size | ( | ) | const |
Get the size of the image.
int pitch | ( | ) | const |
Number of bytes per image row.
Bytes & data | ( | ) |
Directly access image data.
const Bytes & data | ( | ) | const |
Directly access image data.
Color & pixel | ( | long | i | ) |
Get a reference to the i-th pixel.
const Color & pixel | ( | long | i | ) | const |
Get a constant reference to the i-th pixel.
long count | ( | ) | const |
Number of pixels.
void clear | ( | Color | c | ) |
Clear the entire image with color c.
void premultiply | ( | ) |
Convert the entire image from normal alpha to pre-multiplied alpha.
void normalize | ( | ) |
Convert the entire image from pre-multiplied alpha to normal alpha.
Image copy | ( | ) | const |
Create a deep copy of this image.
void applyOver | ( | Color | paper | ) |
Add background paper to each transparent pixel.
bool checkOpaque | ( | ) | const |
Check if all pixels of this image are opaque.
void tone | ( | Color | color | ) |
Replace the red, green and blue of all non-transparent pixels by red, green and blue of color.
void shadowBlur | ( | int | radius, |
Color | shadowColor ) |
Replace this image by a low-pass monochrome version of itself.
radius | Blur radius |
shadowColor | Replacement color |
Image scale | ( | int | scaledWidth, |
int | scaledHeight ) const |
Scaled image to new size (scaledWidth, scaledHeight)