载入中...
搜索中...
未找到

Represents raw pixel data. 更多...

#include <ImageData.h>

类 eve::image::ImageData 继承关系图:
eve::Resource eve::Object

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.
 
ImageDatarotate (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::FileDataencode (FormatHandler::EncodedFormat format, const char *filename, bool writefile) const
 Encodes raw pixel data into a given format.
 
ImageDataclone () 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
 
ObjectgetUpdate () const
 
void ref ()
 
void unref ()
 
- Protected 属性 继承自 eve::Resource
std::string uri
 
std::vector< eve::ref< Resource > > dependencies
 
- Protected 属性 继承自 eve::Object
Objectupdate
 
unsigned ref_count = 0
 

详细描述

Represents raw pixel data.

在文件 ImageData.h25 行定义.

成员类型定义说明

◆ Colorf

using eve::image::ImageData::Colorf = medialoader::Colorf

在文件 ImageData.h29 行定义.

◆ float16

using eve::image::ImageData::float16 = medialoader::float16

在文件 ImageData.h28 行定义.

◆ FormatHandler

using eve::image::ImageData::FormatHandler = medialoader::FormatHandler

在文件 ImageData.h30 行定义.

◆ PixelGetFunction

typedef void(* eve::image::ImageData::PixelGetFunction) (const Pixel *p, Colorf &c)

在文件 ImageData.h43 行定义.

◆ PixelSetFunction

typedef void(* eve::image::ImageData::PixelSetFunction) (const Colorf &c, Pixel *p)

在文件 ImageData.h42 行定义.

构造及析构函数说明

◆ ImageData() [1/4]

eve::image::ImageData::ImageData ( Data data)

在文件 ImageData.cpp24 行定义.

引用了 data.

◆ ImageData() [2/4]

eve::image::ImageData::ImageData ( int  width,
int  height,
std::string  format = "RGBA8" 
)

在文件 ImageData.cpp26 行定义.

引用了 getSize(), height, validPixelFormat() , 以及 width.

◆ ImageData() [3/4]

eve::image::ImageData::ImageData ( int  width,
int  height,
std::string  format,
void *  data,
bool  own 
)

在文件 ImageData.cpp35 行定义.

引用了 data, height, validPixelFormat() , 以及 width.

◆ ImageData() [4/4]

eve::image::ImageData::ImageData ( const ImageData c)

在文件 ImageData.cpp46 行定义.

引用了 c.

◆ ~ImageData()

eve::image::ImageData::~ImageData ( )
virtual

在文件 ImageData.cpp54 行定义.

成员函数说明

◆ adopt()

void eve::image::ImageData::adopt ( eve::Resource replacement)
overridevirtual

Replace this instance's pixels with replacement's (cache reload). The replacement is drained; its destructor releases the old pixels.

实现了 eve::Resource.

在文件 ImageData.cpp61 行定义.

◆ canPaste()

bool eve::image::ImageData::canPaste ( std::string  src,
std::string  dst 
)
static

在文件 ImageData.cpp1156 行定义.

◆ clone()

eve::image::ImageData * eve::image::ImageData::clone ( ) const

在文件 ImageData.cpp72 行定义.

◆ 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.

参数
fThe file to save the encoded image data to.
formatThe format of the encoded data.

在文件 ImageData.cpp170 行定义.

引用了 data, EV_PARAM_CHECK, getSize(), height , 以及 width.

被这些函数引用 eve::ui::EditorHost::capture().

◆ getConstant() [1/2]

static bool eve::image::ImageData::getConstant ( const char *  in,
FormatHandler::EncodedFormat &  out 
)
static

◆ getConstant() [2/2]

static bool eve::image::ImageData::getConstant ( FormatHandler::EncodedFormat  in,
const char *&  out 
)
static

◆ getConstants()

static std::vector< std::string > eve::image::ImageData::getConstants ( FormatHandler::EncodedFormat  )
static

◆ getData()

void * eve::image::ImageData::getData ( ) const

在文件 ImageData.cpp236 行定义.

引用了 data.

被这些函数引用 eve::procgen::Procgen::generateTexture(), eve::procgen::paintHeightToImage(), paste() , 以及 rotate().

◆ getFormat()

std::string eve::image::ImageData::getFormat ( ) const

在文件 ImageData.cpp246 行定义.

被这些函数引用 paste().

◆ getHeight()

int eve::image::ImageData::getHeight ( ) const

◆ getPixel() [1/2]

Colorf eve::image::ImageData::getPixel ( int  x,
int  y 
) const

在文件 ImageData.cpp497 行定义.

引用了 c, x , 以及 y.

◆ getPixel() [2/2]

void eve::image::ImageData::getPixel ( int  x,
int  y,
Colorf c 
) const

Gets the pixel at location (x,y).

参数
xThe location along the x-axis.
yThe location along the y-axis.
返回
The color for the given location.

在文件 ImageData.cpp486 行定义.

引用了 c, data, p, width, x , 以及 y.

◆ getPixelGetFunction() [1/2]

PixelGetFunction eve::image::ImageData::getPixelGetFunction ( ) const
inline

在文件 ImageData.h133 行定义.

◆ getPixelGetFunction() [2/2]

ImageData::PixelGetFunction eve::image::ImageData::getPixelGetFunction ( std::string  format)
static

在文件 ImageData.cpp1187 行定义.

◆ getPixelSetFunction() [1/2]

PixelSetFunction eve::image::ImageData::getPixelSetFunction ( ) const
inline

在文件 ImageData.h132 行定义.

◆ getPixelSetFunction() [2/2]

ImageData::PixelSetFunction eve::image::ImageData::getPixelSetFunction ( std::string  format)
static

在文件 ImageData.cpp1166 行定义.

◆ getPixelSize()

size_t eve::image::ImageData::getPixelSize ( ) const

在文件 ImageData.cpp1133 行定义.

被这些函数引用 paste().

◆ getSize()

size_t eve::image::ImageData::getSize ( ) const

在文件 ImageData.cpp234 行定义.

被这些函数引用 encode() , 以及 ImageData().

◆ getWidth()

int eve::image::ImageData::getWidth ( ) const

◆ inside()

bool eve::image::ImageData::inside ( int  x,
int  y 
) const

Checks whether a position is inside this ImageData. Useful for checking bounds.

参数
xThe position along the x-axis.
yThe position along the y-axis.

在文件 ImageData.cpp240 行定义.

引用了 x , 以及 y.

◆ isSRGB()

bool eve::image::ImageData::isSRGB ( ) const

在文件 ImageData.cpp238 行定义.

◆ 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.

参数
dxThe destination x-coordinate.
dyThe destination y-coordinate.
sxThe source x-coordinate.
syThe source y-coordinate.
swThe source width.
shThe source height.

在文件 ImageData.cpp1023 行定义.

引用了 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).

参数
radiansRotation angle in radians.
filter"nearest" (pixel art / sharp), "linear" (bilinear), or "rotsprite" (Xenowhirl: Scale2x×3 → offset search → NN downscale).
expandIf 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.cpp910 行定义.

引用了 c, color, data, filter, getData(), height, s, setPixel() , 以及 width.

◆ setPixel()

void eve::image::ImageData::setPixel ( int  x,
int  y,
const Colorf p 
)

Sets the pixel at location (x,y).

参数
xThe location along the x-axis.
yThe location along the y-axis.
pThe color to use for the given location.

在文件 ImageData.cpp475 行定义.

引用了 c, data, p, width, x , 以及 y.

被这些函数引用 rotate().

◆ validPixelFormat()

bool eve::image::ImageData::validPixelFormat ( std::string  format)
static

在文件 ImageData.cpp1135 行定义.

被这些函数引用 ImageData() , 以及 ImageData().


该类的文档由以下文件生成: