TexConv/Image2D.h

57 lines
934 B
C
Raw Permalink Normal View History

2021-12-03 18:51:03 +08:00
#pragma once
#include<hgl/type/DataType.h>
using namespace hgl;
enum class PixelDataType
{
2021-12-06 10:47:34 +08:00
Unknow=0,
2021-12-03 18:51:03 +08:00
U8,
U16,
U32,
F32,
F64
};
2021-12-06 10:47:34 +08:00
const uint GetStride(const enum class PixelDataType);
2021-12-03 18:51:03 +08:00
class Image2D
{
uint width;
uint height;
uint channels;
PixelDataType type;
void *data;
public:
const uint GetWidth()const{return width;}
const uint GetHeight()const{return height;}
2021-12-06 10:47:34 +08:00
const uint GetPixelsTotal()const{return width*height;}
2021-12-03 18:51:03 +08:00
const uint GetChannels()const{return channels;}
2021-12-06 10:47:34 +08:00
2021-12-03 18:51:03 +08:00
const PixelDataType GetType()const{return type;}
void *GetData()const{return data;}
public:
Image2D()
{
width=height=channels=0;
}
2021-12-06 10:47:34 +08:00
Image2D(const uint w,const uint h,const uint c,const PixelDataType &pdt,void *ptr);
2021-12-03 18:51:03 +08:00
~Image2D()
{
delete[] data;
}
Image2D *CreateHalfImage();
2021-12-06 10:47:34 +08:00
void TypeConvert(const PixelDataType &);
2021-12-03 18:51:03 +08:00
};//class Image2D