Graphics v0.0.0
A simple abstraction layer for the modern graphics APIs.
载入中...
搜索中...
未找到
Image类 参考

图像. 更多...

#include <Image.h>

Public 成员函数

 Image ()=default
 默认构造函数.
 
 Image (const std::filesystem::path &path)
 构造函数, 从文件载入图像. 更多...
 
 Image (const void *data, size_t sizeBytes, const Vector2i &size, int channels)
 构造函数, 从内存载入图像. 更多...
 
void load (const std::filesystem::path &path)
 从文件载入图像. 更多...
 
void load (const void *data, size_t sizeBytes, const Vector2i &size, int channels)
 从内存载入图像. 更多...
 
void save (const std::filesystem::path &path) const
 导出图像到文件. 更多...
 
void set_pixel (const Vector4f &color, const Vector2i &pos)
 获取图像数据.
 
Vector4f get_pixel (const Vector2i &pos) const
 获取指定像素.
 
void flip_horizontally () noexcept
 水平(左右)翻转.
 
void flip_vertically () noexcept
 垂直(上下)翻转.
 
uint8_t * data () noexcept
 获取图像数据.
 
const uint8_t * data () const noexcept
 获取图像数据.
 
size_t size_bytes () const noexcept
 获取图像数据大小.
 
Vector2i size () const noexcept
 获取图像分辨率.
 
int channel_count () const noexcept
 获取通道数.
 

详细描述

图像.

构造及析构函数说明

◆ Image() [1/2]

Image::Image ( const std::filesystem::path &  path)

构造函数, 从文件载入图像.

参数
path图像文件地址.

◆ Image() [2/2]

Image::Image ( const void *  data,
size_t  sizeBytes,
const Vector2i &  size,
int  channels 
)

构造函数, 从内存载入图像.

参数
data图像内存地址.
sizeBytes图像数据大小, 单位: 字节.
size图像尺寸.
channels通道数.

成员函数说明

◆ load() [1/2]

void Image::load ( const std::filesystem::path &  path)

从文件载入图像.

参数
path图像文件地址.

◆ load() [2/2]

void Image::load ( const void *  data,
size_t  sizeBytes,
const Vector2i &  size,
int  channels 
)

从内存载入图像.

参数
data图像内存地址.
sizeBytes图像数据大小, 单位: 字节.
size图像尺寸.
channels通道数.

◆ save()

void Image::save ( const std::filesystem::path &  path) const

导出图像到文件.

参数
path图像文件地址.
注解
保存 jpg 格式文件时使用的质量为 90.

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