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

Represents raw pixel data. 更多...

#include <ImageData.h>

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

类

union  Pixel
 Pixel public API. 更多...
 

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.
 
eve::Result< int > scalePcg (int newWidth, int newHeight, ImageScaleFilter filter)
 Resize this image with Pcg ScaleTexture's exact point or bilinear coordinate mapping.
 
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).
 
eve::Result< UvPaintReceipt > paintCircleUv (float u, float v, float radiusPixels, const Colorf &color, bool wrapU=false, bool wrapV=false)
 Paint a filled circular brush centered at normalized UV coordinates.
 
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 ()
 Releases Resource resources.
 
 Resource (const Resource &)=delete
 Resources own keep-alive pins, so they are not copyable.
 
Resource & operator= (const Resource &)=delete
 
std::string getUri () const
 Returns the uri.
 
EVENGINE_API_FOUNDATION std::vector< Resource * > getDependencies () const
 Borrowed views of the resources this instance keeps alive.
 
EVENGINE_API_FOUNDATION eve::Result< void > addDependency (Resource &dependency)
 Keeps dependency alive for as long as this instance lives.
 

静态 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)
 Constructs a Resource.
 
void setUri (std::string value)
 Set the resource URI (the cache key). Used by ResourceManager.
 
- Protected 属性 继承自 eve::Resource
std::string uri
 
std::vector< ResourcePin > dependencies
 Keep-alive pins; see getDependencies()/addDependency().
 

详细描述

Represents raw pixel data.

在文件 ImageData.h 第 38 行定义.

成员类型定义说明

◆ Colorf

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

在文件 ImageData.h 第 41 行定义.

◆ float16

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

在文件 ImageData.h 第 40 行定义.

◆ FormatHandler

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

在文件 ImageData.h 第 42 行定义.

◆ PixelGetFunction

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

在文件 ImageData.h 第 56 行定义.

◆ PixelSetFunction

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

在文件 ImageData.h 第 55 行定义.

构造及析构函数说明

◆ ImageData() [1/4]

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

在文件 ImageData.cpp 第 25 行定义.

◆ ImageData() [2/4]

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

在文件 ImageData.cpp 第 27 行定义.

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

◆ ImageData() [3/4]

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

在文件 ImageData.cpp 第 36 行定义.

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

◆ ImageData() [4/4]

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

在文件 ImageData.cpp 第 47 行定义.

引用了 c.

◆ ~ImageData()

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

在文件 ImageData.cpp 第 55 行定义.

成员函数说明

◆ 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.cpp 第 62 行定义.

被这些函数引用 eve::procgen::bakeGtsDetailSurface(), eve::procgen::bakeGtsGeologicalSurface(), eve::procgen::bakeGtsWeatherPbr(), eve::image::UvPaintSession::copyCurrentToResult() , 以及 scalePcg().

◆ canPaste()

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

在文件 ImageData.cpp 第 1207 行定义.

◆ clone()

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

在文件 ImageData.cpp 第 73 行定义.

◆ 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.cpp 第 179 行定义.

引用了 EV_PARAM_CHECK, getSize() , 以及 handler.

被这些函数引用 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

◆ getFormat()

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

在文件 ImageData.cpp 第 255 行定义.

被这些函数引用 eve::animation::Animation::newSpriteSheetFromSequence(), paste() , 以及 scalePcg().

◆ getHeight()

◆ getPixel() [1/2]

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

在文件 ImageData.cpp 第 546 行定义.

引用了 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.cpp 第 535 行定义.

引用了 c, inside, width, x , 以及 y.

被这些函数引用 eve::procgen::bakeGtsColorMapAlbedo(), eve::procgen::bakeGtsDetailSurface(), eve::procgen::bakeGtsGeologicalSurface(), eve::procgen::bakeGtsTerrainVertexColorsInto(), eve::procgen::bakeGtsWeatherPbr(), eve::animation::Animation::newSpriteSheetFromSequence(), eve::procgen::placePcgMaskMapTileInto() , 以及 scalePcg().

◆ getPixelGetFunction() [1/2]

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

在文件 ImageData.h 第 174 行定义.

被这些函数引用 eve::procgen::bakeGtsTerrainVertexColorsInto().

◆ getPixelGetFunction() [2/2]

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

在文件 ImageData.cpp 第 1238 行定义.

◆ getPixelSetFunction() [1/2]

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

在文件 ImageData.h 第 173 行定义.

◆ getPixelSetFunction() [2/2]

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

在文件 ImageData.cpp 第 1217 行定义.

◆ getPixelSize()

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

在文件 ImageData.cpp 第 1184 行定义.

被这些函数引用 eve::procgen::bakeGtsTerrainVertexColorsInto() , 以及 paste().

◆ getSize()

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

在文件 ImageData.cpp 第 243 行定义.

被这些函数引用 eve::procgen::bakeGtsTerrainVertexColorsInto(), encode() , 以及 ImageData().

◆ getWidth()

◆ 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.cpp 第 249 行定义.

引用了 x , 以及 y.

◆ isSRGB()

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

在文件 ImageData.cpp 第 247 行定义.

◆ paintCircleUv()

eve::Result< UvPaintReceipt > eve::image::ImageData::paintCircleUv ( float  u,
float  v,
float  radiusPixels,
const Colorf &  color,
bool  wrapU = false,
bool  wrapV = false 
)

Paint a filled circular brush centered at normalized UV coordinates.

参数
uHorizontal normalized texture coordinate; wrapping is optional.
vVertical normalized texture coordinate, converted to top-left image Y as (1-v).
radiusPixelsNon-negative brush radius in pixels; zero paints one pixel.
colorReplacement color.
wrapUWhether the brush wraps across the left/right seam.
wrapVWhether the brush wraps across the top/bottom seam.
返回
Paint receipt or a structured failure; mutation occurs only after validation. @thread Affine to this mutable ImageData; callers provide synchronization. @reentrancy Does not invoke callbacks.

在文件 ImageData.cpp 第 499 行定义.

引用了 color, cx, cy, eve::Diagnostic::error(), eve::Result< T >::failure(), h, inside, ox, oy, eve::PreconditionViolation, eve::image::prepareUvPaintRegionResult(), eve::Result< T >::success(), u, v, value, w, x , 以及 y.

◆ 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.cpp 第 1074 行定义.

引用了 c, d, dx, dy, EV_PARAM_CHECK, getData(), getFormat(), getHeight(), getPixelSize(), getWidth(), s, sx, sy, eve::image::Row::u8 , 以及 x.

被这些函数引用 eve::avatar::buildVrmAtlas(), eve::graphics::Font::Font() , 以及 eve::animation::Animation::newSpriteSheetFromSequence().

◆ 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.cpp 第 961 行定义.

引用了 c, color, dx, dy, filter, getData(), height, s, setPixel(), sx, sy , 以及 width.

◆ scalePcg()

Result< int > eve::image::ImageData::scalePcg ( int  newWidth,
int  newHeight,
ImageScaleFilter  filter 
)

Resize this image with Pcg ScaleTexture's exact point or bilinear coordinate mapping.

参数
newWidthPositive destination width.
newHeightPositive destination height.
filterPoint uses floor(sourceSize/destinationSize * coordinate). Bilinear uses (sourceSize-1)/destinationSize and therefore intentionally does not sample the final source edge.
返回
Number of destination pixels written, or InvalidArgument with this image unchanged. @thread Affine to this mutable ImageData; callers provide synchronization. @reentrancy Does not invoke callbacks or retain source storage.

在文件 ImageScale.cpp 第 10 行定义.

引用了 adopt(), eve::image::Bilinear, bottom, count, eve::Diagnostic::error(), eve::Result< T >::failure(), filter, first, getFormat(), getHeight(), getPixel(), getWidth(), eve::InvalidArgument, message, eve::image::Point, second, setPixel(), sourceX, eve::Result< T >::success(), top, x , 以及 y.

◆ 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.cpp 第 484 行定义.

引用了 c, inside, width, x , 以及 y.

被这些函数引用 eve::procgen::bakeGtsDetailSurface(), eve::procgen::bakeGtsGeologicalSurface(), eve::procgen::bakeGtsWeatherPbr(), eve::procgen::bakeTerrainCurveTexture(), eve::graphics::VirtualTextureBlend::buildResidentSet(), eve::graphics::Graphics::configureFoliageWind(), rotate() , 以及 scalePcg().

◆ validPixelFormat()

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

在文件 ImageData.cpp 第 1186 行定义.

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


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