dl
dl_image.h 文件参考

图像对象 更多...

#include <string>
#include "base/dl_vector2.h"
#include "dl_type.h"
#include "base/dl_range_any.h"
#include "memory/dl_buffer.h"

浏览该文件的源代码.

命名空间

namespace  dl
 
namespace  dl::Img
 图像操作
 

类型定义

using dl::Image = Vector2<uint32_t, unsigned>
 

枚举

enum class  dl::Img::ExtendMode { dl::Img::ZERO , dl::Img::COPY }
 

函数

bool dl::Img::IsSupportFormat (std::string_view str, bool read)
 是否支持的格式
 
Imagedl::Img::Create (const Size &size, const Color &col)
 创建图像
 
Imagedl::Img::Create (std::string_view path_name)
 创建图像
 
Imagedl::Img::CreateSvg (std::string_view path_name, const Size &size)
 创建图像 从svg
 
Imagedl::Img::CreateWebp (std::string_view path_name)
 创建图像 从webp
 
Imagedl::Img::CreateWebp (BufferView buf)
 
bool dl::Img::Save (const Image *img, std::string_view path_name)
 保存到图像
 
bool dl::Img::SaveKtx (std::span< Image * > vec_img, std::string_view path_name)
 保存到图像(ktx格式)
 
bool dl::Img::SaveKtx (Image *img, std::string_view path_name)
 
void dl::Img::CalcLeastRect (const Image *img, RectU &rect)
 计算返回最小包围盒(去除边缘的全透明像素)
 
bool dl::Img::IsHaveTranslucent (const Image *img, const RectU &rect)
 返回是否包含非透明颜色
 
void dl::Img::AddRect (Image *img_tar, const Image *img_src, const RectU &rect, const PointU &tar_xy)
 添加另一个图像的部分到自己的位置上
 
void dl::Img::SetAlphaZero (Image *img)
 设置透明色颜色为0,针对于某些颜色透明,但是其他通道非0
 
void dl::Img::SetAlphaZero (Image *img, uint8_t a, uint32_t col_new=0)
 设置透明色颜色为0,针对于某些颜色透明,但是其他通道非0
 
Imagedl::Img::Resize (const Image *img, const Size &size)
 缩放图像
 
Imagedl::Img::Resize (const Image *img, Float scale)
 
Imagedl::Img::Extend (const Image *img, unsigned i, ExtendMode mode=ExtendMode::ZERO)
 拓展图像边缘像素
 
void dl::Img::BuildBorder (Image *img, unsigned i)
 填充边缘像素按最近的像素
 
void dl::Img::CvtEffect2Normal (Image *img)
 特效图片转普通图片
 

变量

constexpr std::string_view dl::Img::REGEX_FORMAT = ".(jpg|jpeg|png|tag|bmp|gif|hdr|pic)$"
 

详细描述

图像对象

版本
1.1
作者
lveyou
日期
21-08-09
注解
基本的图像对象,使用stb_image库加载
基于4字节的n32颜色,内部通道为ABGR,接口使用Color.h规定的RGBA
注意转为char访问时,需要考虑字节序
svg格式解析基于lunasvg

在文件 dl_image.h 中定义.