Represents raw pixel data. 更多...
#include <ImageData.h>
类 | |
| union | Pixel |
Public 类型 | |
| using | float16 = medialoader::float16 |
| using | Colorf = medialoader::Colorf |
| using | FormatHandler = medialoader::FormatHandler |
| typedef void(* | PixelSetFunction) (const Colorf &c, Pixel *p) |
| typedef void(* | PixelGetFunction) (const Pixel *p, Colorf &c) |
Public 成员函数 | |
| ImageData (Data *data) | |
| ImageData (int width, int height, std::string format="RGBA8") | |
| ImageData (int width, int height, std::string format, void *data, bool own) | |
| ImageData (const ImageData &c) | |
| virtual | ~ImageData () |
| void | paste (ImageData *src, int dx, int dy, int sx, int sy, int sw, int sh) |
| Paste part of one ImageData onto another. The subregion defined by the top-left corner (sx, sy) and the size (sw,sh) will be pasted to (dx,dy) in this ImageData. | |
| ImageData * | rotate (float radians, std::string filter="nearest", bool expand=true) const |
| Rotate pixels around the image center and return a new ImageData. | |
| bool | inside (int x, int y) const |
| Checks whether a position is inside this ImageData. Useful for checking bounds. | |
| void | setPixel (int x, int y, const Colorf &p) |
| Sets the pixel at location (x,y). | |
| void | getPixel (int x, int y, Colorf &c) const |
| Gets the pixel at location (x,y). | |
| Colorf | getPixel (int x, int y) const |
| filesystem::FileData * | encode (FormatHandler::EncodedFormat format, const char *filename, bool writefile) const |
| Encodes raw pixel data into a given format. | |
| ImageData * | clone () const |
| void * | getData () const |
| size_t | getSize () const |
| bool | isSRGB () const |
| void | adopt (eve::Resource &replacement) override |
Replace this instance's pixels with replacement's (cache reload). The replacement is drained; its destructor releases the old pixels. | |
| int | getWidth () const |
| int | getHeight () const |
| std::string | getFormat () const |
| size_t | getPixelSize () const |
| PixelSetFunction | getPixelSetFunction () const |
| PixelGetFunction | getPixelGetFunction () const |
Public 成员函数 继承自 eve::Resource | |
| virtual | ~Resource () |
| std::string | getUri () const |
| std::vector< eve::ref< Resource > > | getDependencies () const |
| virtual void | addDependency (eve::ref< Resource > resource) |
Public 成员函数 继承自 eve::Object | |
| Object () | |
| void | setUpdate (Object *update) |
| Update the current object with a replacement. You don't need to care about the reference to the old object since it will be automatically updated in the ref smart pointer. | |
静态 Public 成员函数 | |
| static bool | validPixelFormat (std::string format) |
| static bool | canPaste (std::string src, std::string dst) |
| static PixelSetFunction | getPixelSetFunction (std::string format) |
| static PixelGetFunction | getPixelGetFunction (std::string format) |
| static bool | getConstant (const char *in, FormatHandler::EncodedFormat &out) |
| static bool | getConstant (FormatHandler::EncodedFormat in, const char *&out) |
| static std::vector< std::string > | getConstants (FormatHandler::EncodedFormat) |
额外继承的成员函数 | |
Protected 成员函数 继承自 eve::Resource | |
| Resource (std::string uri) | |
| void | setUri (std::string value) |
| Set the resource URI (the cache key). Used by ResourceManager. | |
Protected 成员函数 继承自 eve::Object | |
| virtual | ~Object () |
| bool | isDirty () const |
| Object * | getUpdate () const |
| void | ref () |
| void | unref () |
Protected 属性 继承自 eve::Resource | |
| std::string | uri |
| std::vector< eve::ref< Resource > > | dependencies |
Protected 属性 继承自 eve::Object | |
| Object * | update |
| unsigned | ref_count = 0 |
详细描述
Represents raw pixel data.
在文件 ImageData.h 第 25 行定义.
成员类型定义说明
◆ Colorf
| using eve::image::ImageData::Colorf = medialoader::Colorf |
在文件 ImageData.h 第 29 行定义.
◆ float16
| using eve::image::ImageData::float16 = medialoader::float16 |
在文件 ImageData.h 第 28 行定义.
◆ FormatHandler
| using eve::image::ImageData::FormatHandler = medialoader::FormatHandler |
在文件 ImageData.h 第 30 行定义.
◆ PixelGetFunction
在文件 ImageData.h 第 43 行定义.
◆ PixelSetFunction
在文件 ImageData.h 第 42 行定义.
构造及析构函数说明
◆ ImageData() [1/4]
| eve::image::ImageData::ImageData | ( | Data * | data | ) |
在文件 ImageData.cpp 第 24 行定义.
引用了 data.
◆ ImageData() [2/4]
| eve::image::ImageData::ImageData | ( | int | width, |
| int | height, | ||
| std::string | format = "RGBA8" |
||
| ) |
在文件 ImageData.cpp 第 26 行定义.
引用了 getSize(), height, validPixelFormat() , 以及 width.
◆ ImageData() [3/4]
| eve::image::ImageData::ImageData | ( | int | width, |
| int | height, | ||
| std::string | format, | ||
| void * | data, | ||
| bool | own | ||
| ) |
在文件 ImageData.cpp 第 35 行定义.
引用了 data, height, validPixelFormat() , 以及 width.
◆ ImageData() [4/4]
| eve::image::ImageData::ImageData | ( | const ImageData & | c | ) |
在文件 ImageData.cpp 第 46 行定义.
引用了 c.
◆ ~ImageData()
|
virtual |
在文件 ImageData.cpp 第 54 行定义.
成员函数说明
◆ adopt()
|
overridevirtual |
Replace this instance's pixels with replacement's (cache reload). The replacement is drained; its destructor releases the old pixels.
实现了 eve::Resource.
在文件 ImageData.cpp 第 61 行定义.
◆ canPaste()
|
static |
在文件 ImageData.cpp 第 1156 行定义.
◆ clone()
| eve::image::ImageData * eve::image::ImageData::clone | ( | ) | const |
在文件 ImageData.cpp 第 72 行定义.
◆ encode()
| eve::filesystem::FileData * eve::image::ImageData::encode | ( | FormatHandler::EncodedFormat | format, |
| const char * | filename, | ||
| bool | writefile | ||
| ) | const |
Encodes raw pixel data into a given format.
- 参数
-
f The file to save the encoded image data to. format The format of the encoded data.
在文件 ImageData.cpp 第 170 行定义.
引用了 data, EV_PARAM_CHECK, getSize(), height , 以及 width.
被这些函数引用 eve::ui::EditorHost::capture().
◆ getConstant() [1/2]
|
static |
◆ getConstant() [2/2]
|
static |
◆ getConstants()
|
static |
◆ getData()
| void * eve::image::ImageData::getData | ( | ) | const |
在文件 ImageData.cpp 第 236 行定义.
引用了 data.
被这些函数引用 eve::procgen::Procgen::generateTexture(), eve::procgen::paintHeightToImage(), paste() , 以及 rotate().
◆ getFormat()
| std::string eve::image::ImageData::getFormat | ( | ) | const |
在文件 ImageData.cpp 第 246 行定义.
被这些函数引用 paste().
◆ getHeight()
| int eve::image::ImageData::getHeight | ( | ) | const |
在文件 ImageData.cpp 第 244 行定义.
引用了 height.
被这些函数引用 eve::procgen::Procgen::generateTexture(), eve::image::Image::newCubeFaces(), eve::image::Image::newVolumeLayers() , 以及 paste().
◆ getPixel() [1/2]
| Colorf eve::image::ImageData::getPixel | ( | int | x, |
| int | y | ||
| ) | const |
在文件 ImageData.cpp 第 497 行定义.
◆ getPixel() [2/2]
| void eve::image::ImageData::getPixel | ( | int | x, |
| int | y, | ||
| Colorf & | c | ||
| ) | const |
◆ getPixelGetFunction() [1/2]
|
inline |
在文件 ImageData.h 第 133 行定义.
◆ getPixelGetFunction() [2/2]
|
static |
在文件 ImageData.cpp 第 1187 行定义.
◆ getPixelSetFunction() [1/2]
|
inline |
在文件 ImageData.h 第 132 行定义.
◆ getPixelSetFunction() [2/2]
|
static |
在文件 ImageData.cpp 第 1166 行定义.
◆ getPixelSize()
| size_t eve::image::ImageData::getPixelSize | ( | ) | const |
在文件 ImageData.cpp 第 1133 行定义.
被这些函数引用 paste().
◆ getSize()
| size_t eve::image::ImageData::getSize | ( | ) | const |
在文件 ImageData.cpp 第 234 行定义.
被这些函数引用 encode() , 以及 ImageData().
◆ getWidth()
| int eve::image::ImageData::getWidth | ( | ) | const |
在文件 ImageData.cpp 第 242 行定义.
引用了 width.
被这些函数引用 eve::procgen::Procgen::generateTexture(), eve::image::Image::newCubeFaces(), eve::image::Image::newVolumeLayers() , 以及 paste().
◆ inside()
| bool eve::image::ImageData::inside | ( | int | x, |
| int | y | ||
| ) | const |
Checks whether a position is inside this ImageData. Useful for checking bounds.
- 参数
-
x The position along the x-axis. y The position along the y-axis.
在文件 ImageData.cpp 第 240 行定义.
◆ isSRGB()
| bool eve::image::ImageData::isSRGB | ( | ) | const |
在文件 ImageData.cpp 第 238 行定义.
◆ paste()
| void eve::image::ImageData::paste | ( | ImageData * | src, |
| int | dx, | ||
| int | dy, | ||
| int | sx, | ||
| int | sy, | ||
| int | sw, | ||
| int | sh | ||
| ) |
Paste part of one ImageData onto another. The subregion defined by the top-left corner (sx, sy) and the size (sw,sh) will be pasted to (dx,dy) in this ImageData.
- 参数
-
dx The destination x-coordinate. dy The destination y-coordinate. sx The source x-coordinate. sy The source y-coordinate. sw The source width. sh The source height.
在文件 ImageData.cpp 第 1023 行定义.
引用了 c, d, EV_PARAM_CHECK, getData(), getFormat(), getHeight(), getPixelSize(), getWidth(), s, eve::image::Row::u8 , 以及 x.
被这些函数引用 eve::graphics::Font::Font().
◆ rotate()
| ImageData * eve::image::ImageData::rotate | ( | float | radians, |
| std::string | filter = "nearest", |
||
| bool | expand = true |
||
| ) | const |
Rotate pixels around the image center and return a new ImageData.
Uses inverse mapping (iterate destination → sample source) so every output pixel is filled — the standard approach for image rotation.
Angle convention matches Math::rotate2*: positive radians appear clockwise with the engine's Y-down screen coordinates (same as LÖVE draw rotation).
- 参数
-
radians Rotation angle in radians. filter "nearest" (pixel art / sharp), "linear" (bilinear), or "rotsprite" (Xenowhirl: Scale2x×3 → offset search → NN downscale). expand If true, grow the canvas to fit the full rotated AABB; if false, keep the source size (edges may be clipped).
- 返回
- Caller-owned ImageData in the same pixel format; out-of-source samples remain transparent black. RotSprite never invents colors (picks existing palette entries via Scale2x / nearest).
在文件 ImageData.cpp 第 910 行定义.
引用了 c, color, data, filter, getData(), height, s, setPixel() , 以及 width.
◆ setPixel()
| void eve::image::ImageData::setPixel | ( | int | x, |
| int | y, | ||
| const Colorf & | p | ||
| ) |
◆ validPixelFormat()
|
static |
在文件 ImageData.cpp 第 1135 行定义.
被这些函数引用 ImageData() , 以及 ImageData().
该类的文档由以下文件生成:
- src/modules/image/ImageData.h
- src/modules/image/ImageData.cpp
Public 成员函数 继承自