CBlueUI  
C++ 跨平台跨框架的数据可视化工具
载入中...
搜索中...
未找到
BUI::GImage类 参考

class GImage 更多...

类 BUI::GImage 继承关系图:

Public 成员函数

 GImage ()
virtual ~GImage ()
virtual bool LoadBufferImage (unsigned char *buffer, UINT buf_size)
void GetPixel (int x, int y, uint32_t &r, uint32_t &g, uint32_t &b, uint32_t &a) const
 获得像素点颜色
void SetPixel (int x, int y, uint32_t r, uint32_t g, uint32_t b, uint32_t a)
 设置像素点颜色
void Filter (GImage *image_src, std::function< void(int x, int y, GImage *dst, GImage *src1)> call_back)
void FilterDouble (GImage *image_src1, GImage *image_src2, std::function< void(int x, int y, GImage *dst, GImage *src1, GImage *src2)> call_back)
UBYTEBuffer () const
 像素数据内存指针,可以直接访问。访问时需要注意像素格式
SIZE ImageSize (BOOL is_pixel_format=FALSE) const
 位图尺寸
int WidthPixel () const
int HeightPixel () const
void AttachOtherMemImage (unsigned char *pixel, int w, int h, int stride, PixelFormatType fmt)
void AllocImage (int w, int h, PixelFormatType fmt, BOOL is_clear)
 根据大小重新分配内存
PixelFormatType GetPixelFormat () const
 位图的像素格式
void TransformMatrix (Transform2d *mtx, RECT *rc, double angle, double scale_x, double scale_y)
 获取图片输出到指定矩形区域内时的变换矩阵
UBYTERowPtr (int x, int y)
 获得像素点内存指针
void GetClientRectInFrames (RECT *rect, BOOL is_hroz, int current, int frame_counts) const
 获得多帧图片的某一帧,在图像中的坐标
void GetImageDrawInfoInFrames (ImageDrawInfo *info, BOOL is_hroz, int current, int frame_counts) const
 获得多帧图片的某一帧,绘制信息
void GetImageDrawInfo (ImageDrawInfo *info) const
 获得整张位图的绘制信息
void GetImageDrawInfoInArea (ImageDrawInfo *info, int x, int y, int w, int h) const
 获得位图某一区域的绘制信息
int Stride () const
 图片一水平行,所占的字节数。当Stride() < 0 时,表示第一行,存储在内存中的高地址。
int StrideAbs () const
 图片一水平行,所占的字节数的绝对值
UINT PixelBitCounts () const
 单个像素点占的比特数
void Gamma (float gamma, UINT channel, double(*f)(double)=NULL)
void HistogramEqualize (GImage *source, int color_chanel, uint8_t *p, int len)
 图像均衡化
void Destory ()
 销毁并释放内存
void CopyForm (GImage *source)
void CopyForm (const unsigned char *data, int w, int h, int bpp)
void MakeShaddow (int dx, int dy, int blur_size, const GColor &color)
 根据透明度。生成阴影格式。必须是具有alpha通道图像
void CloneFrom (const GImage *other)
 克隆
void ToGray (GrayConv conv_type=GrayDesaturation, float k1=0, float k2=0, float k3=0)
 GrayConv组合值
void GetImageChanelIndex (int &ir, int &ig, int &ib, int &ia)
 获得图像颜色通道索引
void SaveAsImageFile (LPCTSTR file_png_path, LPCTSTR fmt)
void RemoveBackColor (uint8_t r, uint8_t g, uint8_t b)
 清除指定背景颜色
unsigned int GetTexID ()

静态 Public 成员函数

static BOOL SaveAsJPG (LPCTSTR file_png_path, const unsigned char *data, int w, int h, PixelFormatType fmt, int stride)

Public 属性

unsigned int m_tex_id

Protected 属性

BOOL m_is_attach_other
int m_width
int m_height
UINT m_bpp
int m_stride
unsigned char * m_pixels
PixelFormatType m_pixel_format
int m_rgb_order [4]

详细描述

class GImage

构造及析构函数说明

◆ GImage()

BUI::GImage::GImage ( )

◆ ~GImage()

virtual BUI::GImage::~GImage ( )
virtual

成员函数说明

◆ AllocImage()

void BUI::GImage::AllocImage ( int w,
int h,
PixelFormatType fmt,
BOOL is_clear )

根据大小重新分配内存

参数
w:宽度
h:高度
fmt:分配内存的像素格式。用于计算单个像素大小
is_clear若clear=TRUE,则用0清除内存。

◆ AttachOtherMemImage()

void BUI::GImage::AttachOtherMemImage ( unsigned char * pixel,
int w,
int h,
int stride,
PixelFormatType fmt )

◆ Buffer()

UBYTE * BUI::GImage::Buffer ( ) const

像素数据内存指针,可以直接访问。访问时需要注意像素格式

返回
UBYTE* 无符号字节指针

◆ CloneFrom()

void BUI::GImage::CloneFrom ( const GImage * other)

克隆

◆ CopyForm() [1/2]

void BUI::GImage::CopyForm ( const unsigned char * data,
int w,
int h,
int bpp )

◆ CopyForm() [2/2]

void BUI::GImage::CopyForm ( GImage * source)

◆ Destory()

void BUI::GImage::Destory ( )

销毁并释放内存

◆ Filter()

void BUI::GImage::Filter ( GImage * image_src,
std::function< void(int x, int y, GImage *dst, GImage *src1)> call_back )

◆ FilterDouble()

void BUI::GImage::FilterDouble ( GImage * image_src1,
GImage * image_src2,
std::function< void(int x, int y, GImage *dst, GImage *src1, GImage *src2)> call_back )

◆ Gamma()

void BUI::GImage::Gamma ( float gamma,
UINT channel,
double(* )(double) = NULL )

◆ GetClientRectInFrames()

void BUI::GImage::GetClientRectInFrames ( RECT * rect,
BOOL is_hroz,
int current,
int frame_counts ) const

获得多帧图片的某一帧,在图像中的坐标

参数
rect:输出矩形区域
is_hroz若isHroz=TRUE,表示位图帧与帧之间,水平排列。若isHroz=FALSE,表示垂直排列
current当前帧序号。从0开始
frame_counts位图内帧的总数

◆ GetImageChanelIndex()

void BUI::GImage::GetImageChanelIndex ( int & ir,
int & ig,
int & ib,
int & ia )

获得图像颜色通道索引

◆ GetImageDrawInfo()

void BUI::GImage::GetImageDrawInfo ( ImageDrawInfo * info) const

获得整张位图的绘制信息

◆ GetImageDrawInfoInArea()

void BUI::GImage::GetImageDrawInfoInArea ( ImageDrawInfo * info,
int x,
int y,
int w,
int h ) const

获得位图某一区域的绘制信息

◆ GetImageDrawInfoInFrames()

void BUI::GImage::GetImageDrawInfoInFrames ( ImageDrawInfo * info,
BOOL is_hroz,
int current,
int frame_counts ) const

获得多帧图片的某一帧,绘制信息

参数
rc:输出矩形区域
is_hroz若isHroz=TRUE,表示位图帧与帧之间,水平排列。若isHroz=FALSE,表示垂直排列
current当前帧序号。从0开始
frame_counts位图内帧的总数

◆ GetPixel()

void BUI::GImage::GetPixel ( int x,
int y,
uint32_t & r,
uint32_t & g,
uint32_t & b,
uint32_t & a ) const

获得像素点颜色

参数
(x,y):像素坐标
(r,g,b,a)输出各个通道颜色

◆ GetPixelFormat()

PixelFormatType BUI::GImage::GetPixelFormat ( ) const

位图的像素格式

◆ GetTexID()

unsigned int BUI::GImage::GetTexID ( )

◆ HeightPixel()

int BUI::GImage::HeightPixel ( ) const

◆ HistogramEqualize()

void BUI::GImage::HistogramEqualize ( GImage * source,
int color_chanel,
uint8_t * p,
int len )

图像均衡化

参数
color_chanel颜色通道:-1表示rgb三个通道, 0,1,2 分别代表R,G,B。
p
len

◆ ImageSize()

SIZE BUI::GImage::ImageSize ( BOOL is_pixel_format = FALSE) const

位图尺寸

参数
is_pixel_format若为FALSE,则用实际尺寸乘以系统缩放,也就是在屏幕中显示的大小 若为TRUE,则返回实际像素大小

◆ LoadBufferImage()

virtual bool BUI::GImage::LoadBufferImage ( unsigned char * buffer,
UINT buf_size )
virtual

BUI::GImageGIF 重载.

◆ MakeShaddow()

void BUI::GImage::MakeShaddow ( int dx,
int dy,
int blur_size,
const GColor & color )

根据透明度。生成阴影格式。必须是具有alpha通道图像

◆ PixelBitCounts()

UINT BUI::GImage::PixelBitCounts ( ) const

单个像素点占的比特数

◆ RemoveBackColor()

void BUI::GImage::RemoveBackColor ( uint8_t r,
uint8_t g,
uint8_t b )

清除指定背景颜色

参数
(r,g,b):三原色分量

◆ RowPtr()

UBYTE * BUI::GImage::RowPtr ( int x,
int y )

获得像素点内存指针

参数
(x,y)像素点坐标
返回
UBYTE*: 内存指针

◆ SaveAsImageFile()

void BUI::GImage::SaveAsImageFile ( LPCTSTR file_png_path,
LPCTSTR fmt )

◆ SaveAsJPG()

BOOL BUI::GImage::SaveAsJPG ( LPCTSTR file_png_path,
const unsigned char * data,
int w,
int h,
PixelFormatType fmt,
int stride )
static

◆ SetPixel()

void BUI::GImage::SetPixel ( int x,
int y,
uint32_t r,
uint32_t g,
uint32_t b,
uint32_t a )

设置像素点颜色

参数
(x,y):像素坐标
(r,g,b,a)各个通道颜色

◆ Stride()

int BUI::GImage::Stride ( ) const

图片一水平行,所占的字节数。当Stride() < 0 时,表示第一行,存储在内存中的高地址。

◆ StrideAbs()

int BUI::GImage::StrideAbs ( ) const

图片一水平行,所占的字节数的绝对值

◆ ToGray()

void BUI::GImage::ToGray ( GrayConv conv_type = GrayDesaturation,
float k1 = 0,
float k2 = 0,
float k3 = 0 )

GrayConv组合值

◆ TransformMatrix()

void BUI::GImage::TransformMatrix ( Transform2d * mtx,
RECT * rc,
double angle,
double scale_x,
double scale_y )

获取图片输出到指定矩形区域内时的变换矩阵

参数
mtx:输出变换矩阵
rc目标区域
angle:旋转弧度(0-2pi)
scale_x水平方向缩放
scale_y垂直方向缩放

◆ WidthPixel()

int BUI::GImage::WidthPixel ( ) const

类成员变量说明

◆ m_bpp

UINT BUI::GImage::m_bpp
protected

◆ m_height

int BUI::GImage::m_height
protected

◆ m_is_attach_other

BOOL BUI::GImage::m_is_attach_other
protected

◆ m_pixel_format

PixelFormatType BUI::GImage::m_pixel_format
protected

◆ m_pixels

unsigned char* BUI::GImage::m_pixels
protected

◆ m_rgb_order

int BUI::GImage::m_rgb_order[4]
protected

◆ m_stride

int BUI::GImage::m_stride
protected

◆ m_tex_id

unsigned int BUI::GImage::m_tex_id

◆ m_width

int BUI::GImage::m_width
protected
鄂公网安备42018502007752 鄂ICP备2024082886
Copyright © 2026 · CBlueStudio 版权所有