init file
This commit is contained in:
commit
af73eb90f5
8
CMakeLists.txt
Normal file
8
CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(CM2D)
|
||||
|
||||
include(path_config.cmake)
|
||||
CM2DSetup(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_subdirectory(${CM2D_ROOT_SOURCE_PATH})
|
13
inc/hgl/2d/Bitmap.h
Normal file
13
inc/hgl/2d/Bitmap.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef HGL_2D_BITMAP_INCLUDE
|
||||
#define HGL_2D_BITMAP_INCLUDE
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
/**
|
||||
* 简单的2D象素处理
|
||||
*/
|
||||
template<typename T> class Bitmap2D
|
||||
{
|
||||
};//
|
||||
}//namespace hgl
|
||||
#endif//HGL_2D_BITMAP_INCLUDE
|
87
inc/hgl/2d/VSBase.h
Normal file
87
inc/hgl/2d/VSBase.h
Normal file
@ -0,0 +1,87 @@
|
||||
#ifndef HGL_VSBASE_INCLUDE
|
||||
#define HGL_VSBASE_INCLUDE
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace vs
|
||||
{
|
||||
/**
|
||||
* 为方便程序处理,内存中仅支持以下格式
|
||||
*/
|
||||
enum class DataFormat
|
||||
{
|
||||
U8,U16,U32,
|
||||
S8,S16,S32,
|
||||
F32,F64,
|
||||
};
|
||||
|
||||
struct VSDataSource
|
||||
{
|
||||
void *pixel_data=nullptr; ///<象素数据
|
||||
|
||||
public:
|
||||
|
||||
virtual ~VSDataSource()=0;
|
||||
};//class VSDataSource
|
||||
|
||||
struct VSDataSourceRef:public VSDataSource
|
||||
{
|
||||
public:
|
||||
|
||||
~VSDataSourceRef() override {}
|
||||
};//
|
||||
|
||||
class VSDataSourceCreate
|
||||
|
||||
/**
|
||||
* 虚拟屏幕数据源
|
||||
*/
|
||||
class VSData
|
||||
{
|
||||
protected:
|
||||
|
||||
uint width,height; ///<尺寸
|
||||
uint color_component; ///<颜色成份数量(1-4)
|
||||
DataFormat data_format[4]; ///<数据格式
|
||||
|
||||
uint pixel_bytes; ///<每象素字节数
|
||||
uint line_bytes; ///<每一行象素数据的字节数
|
||||
|
||||
public:
|
||||
|
||||
VSData()
|
||||
{
|
||||
pixel_data=nullptr;
|
||||
}
|
||||
|
||||
virtual ~VSData()=0;
|
||||
|
||||
void *GetPointer(){return pixel_data;}
|
||||
|
||||
void *GetPointer(uint row)
|
||||
{
|
||||
if(row>=height)return(nullptr);
|
||||
|
||||
return ((uint8 *)pixel_data)+row*line_bytes;
|
||||
}
|
||||
|
||||
void *GetPointer(uint col,uint row)
|
||||
{
|
||||
if(col>=width)return(nullptr);
|
||||
if(row>=height)return(nullptr);
|
||||
|
||||
return ((uint8 *)pixel_data)+row*line_bytes+col*pixel_bytes;
|
||||
}
|
||||
};//class VSData
|
||||
|
||||
/**
|
||||
* 虚拟屏幕基类
|
||||
*/
|
||||
class VSBase
|
||||
{
|
||||
};//class VSBase
|
||||
|
||||
|
||||
}//namespace vs
|
||||
}//namespace hgl
|
||||
#endif//HGL_VSBASE_INCLUDE
|
9
path_config.cmake
Normal file
9
path_config.cmake
Normal file
@ -0,0 +1,9 @@
|
||||
macro(CM2DSetup CM2D_ROOT_PATH)
|
||||
|
||||
message("CM2D_ROOT_PATH: " ${CM2D_ROOT_PATH})
|
||||
|
||||
set(CM2D_ROOT_INCLUDE_PATH ${CM2D_ROOT_PATH}/inc)
|
||||
set(CM2D_ROOT_SOURCE_PATH ${CM2D_ROOT_PATH}/src)
|
||||
|
||||
include_directories(${CM2D_ROOT_INCLUDE_PATH})
|
||||
endmacro()
|
10
src/CMakeLists.txt
Normal file
10
src/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
file(GLOB CM2D_HEADER ${CM2D_ROOT_INCLUDE_PATH}/hgl/2d/*.h)
|
||||
|
||||
file(GLOB CM2D_PIXEL_SOURCE PixelFormat/*.cpp)
|
||||
file(GLOB CM2D_BITMAP_SOURCE Bitmap/*.cpp)
|
||||
|
||||
SOURCE_GROUP("Header Files" FILES ${CM2D_HEADER})
|
||||
SOURCE_GROUP("PixelFormat" FILES ${CM2D_PIXEL_SOURCE})
|
||||
SOURCE_GROUP("Bitmap" FILES ${CM2D_BITMAP_SOURCE})
|
||||
|
||||
add_cm_library(CM2D "CM" ${CM2D_HEADER} ${CM2D_PIXEL_SOURCE} ${CM2D_BITMAP_SOURCE})
|
0
src/PixelFormat/rgb.cpp
Normal file
0
src/PixelFormat/rgb.cpp
Normal file
0
src/PixelFormat/rgba.cpp
Normal file
0
src/PixelFormat/rgba.cpp
Normal file
Loading…
x
Reference in New Issue
Block a user