载入中...
搜索中...
未找到
Image.cpp
浏览该文件的文档.
78const std::list<medialoader::FormatHandler*>& Image::getFormatHandlers() const { return formatHandlers; }
178 "ImageData", std::function<image::ImageData*()>([]() -> image::ImageData* { return nullptr; }), true);
195 img.addFunc("scalePcg", [vm, projectPixels](image::ImageData* self, int newWidth, int newHeight,
226 img.addFunc("setPixel", [](image::ImageData* self, int x, int y, float r, float g, float b, float a) {
230 img.addFunc("paintCircleUv", [](image::ImageData* self, float u, float v, float radius, float r, float g, float b,
233 auto painted = self->paintCircleUv(u, v, radius, image::ImageData::Colorf{r, g, b, a}, wrapU, wrapV);
239 "UvPaintSession", std::function<UvPaintSession*()>([]() -> UvPaintSession* { return nullptr; }), true);
247 paint.addFunc("paintCircle", [vm = paint.getHandle()](UvPaintSession* self, float u, float v, float radius, float r,
265 auto instance = eve::script::makeOwnedSquirrelInstance<ImageData>(vm, std::move(result).takeValue());
267 return eve::script::projectStatusResult(vm, Status::success(), std::move(instance).takeValue());
269 paint.addFunc("copyCurrentTo", [vm = paint.getHandle()](UvPaintSession* self, ImageData* destination) {
282 "UvPaintRegion", std::function<UvPaintRegion*()>([]() -> UvPaintRegion* { return nullptr; }), true);
293 region.addFunc("prepare", [vm = region.getHandle()](UvPaintRegion* self, int width, int height, float u, float v,
305 cls.addFunc("newEmptyImageData", [](Image* self, int width, int height, const std::string& format) -> ImageData* {
322 return Result<int>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, message, "image.scalePcg"));
324 if (newWidth <= 0 || newHeight <= 0) return invalid("Pcg texture scale requires positive destination dimensions");
327 if (getWidth() <= 0 || getHeight() <= 0) return invalid("Pcg texture scale requires a non-empty source image");
335 const float ratioX = filter == ImageScaleFilter::Bilinear ? float(getWidth() - 1) / float(newWidth)
337 const float ratioY = filter == ImageScaleFilter::Bilinear ? float(getHeight() - 1) / float(newHeight)
Stable, structured diagnostics shared by engine modules.
The single Squirrel projection for common Result, Status and Value.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
Resource * get(std::string key)
Get the cached resource for key; on a miss, load it through the registered IAssetReloader providers a...
Definition Resource.cpp:141
Resource is a game object that is managed by the ResourceManager. It can be loaded from a file or gen...
Definition Resource.h:52
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
static Value integer(std::int64_t value)
Compatibility factory for an Int64 value.
Definition Value.h:115
bool inside(int x, int y) const
Checks whether a position is inside this ImageData. Useful for checking bounds.
Definition ImageData.cpp:249
void getPixel(int x, int y, Colorf &c) const
Gets the pixel at location (x,y).
Definition ImageData.cpp:535
void setPixel(int x, int y, const Colorf &p)
Sets the pixel at location (x,y).
Definition ImageData.cpp:484
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,...
Definition ImageData.cpp:1074
ImageData * rotate(float radians, std::string filter="nearest", bool expand=true) const
Rotate pixels around the image center and return a new ImageData.
Definition ImageData.cpp:961
eve::Result< int > scalePcg(int newWidth, int newHeight, ImageScaleFilter filter)
Resize this image with Pcg ScaleTexture's exact point or bilinear coordinate mapping.
Definition Image.cpp:320
void adopt(eve::Resource &replacement) override
Replace this instance's pixels with replacement's (cache reload). The replacement is drained; its des...
Definition ImageData.cpp:62
This module is responsible for decoding files such as PNG, GIF, JPEG into raw pixel data,...
Definition Image.h:22
ImageData * newImageDataFromFile(std::string path)
Loads an image from a VFS path through the unified resource cache. Repeated loads of one path share a...
Definition Image.cpp:53
std::vector< script::Owned< ImageData > > newVolumeLayers(ImageData *src)
Creates a volume layers. @ownership Caller deletes unless documented otherwise.
Definition Image.cpp:152
std::vector< script::Owned< ImageData > > newCubeFaces(ImageData *src)
Creates a cube faces. @ownership Caller deletes unless documented otherwise.
Definition Image.cpp:91
const std::list< FormatHandler * > & getFormatHandlers() const
Returns the format handlers.
Definition Image.cpp:78
Internal decoder adapter; each call owns its output and borrows input synchronously.
Definition WebPHandler.h:8
@ ImageData
Definition AvatarInstance.h:26
ImageScaleFilter
Sampling modes used by Pcg-compatible in-place texture scaling.
Definition ImageData.h:26
@ Bilinear
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:524
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:540
@ InvalidArgument
Definition Decoder.h:10