From c0990c52ebbc2a19b661a3d6fd64891d05e59305 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Fri, 15 Sep 2023 18:18:14 +0800 Subject: [PATCH] removed tga.h/tga.cpp --- inc/hgl/util/imgfmt/tga.h | 53 --------------------------------------- src/CMakeLists.txt | 6 ----- src/imgfmt/tga.cpp | 45 --------------------------------- 3 files changed, 104 deletions(-) delete mode 100644 inc/hgl/util/imgfmt/tga.h delete mode 100644 src/imgfmt/tga.cpp diff --git a/inc/hgl/util/imgfmt/tga.h b/inc/hgl/util/imgfmt/tga.h deleted file mode 100644 index 426a832..0000000 --- a/inc/hgl/util/imgfmt/tga.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef HGL_UTIL_IMAGE_FILE_TGA_INCLUDE -#define HGL_UTIL_IMAGE_FILE_TGA_INCLUDE - -#include -namespace hgl -{ - namespace util - { - constexpr const uint TGA_IMAGE_TYPE_COLOR_MAP =1; - constexpr const uint TGA_IMAGE_TYPE_TRUE_COLOR =2; - constexpr const uint TGA_IMAGE_TYPE_GRAYSCALE =3; - - constexpr const uint TGA_DIRECTION_LOWER_LEFT =0; - constexpr const uint TGA_DIRECTION_UPPER_LEFT =1; - -#pragma pack(push,1) - struct TGAHeader - { - uint8 id; - uint8 color_map_type; - uint8 image_type; // 1 colormap image ,2 true-color,3 grayscale - - uint16 color_map_first; - uint16 color_map_length; - uint8 color_map_size; - - uint16 x_origin; - uint16 y_origin; - - uint16 width; - uint16 height; - uint8 bit; - uint8 image_desc; - }; - - union TGAImageDesc - { - uint8 image_desc; - struct - { - uint alpha_depth:4; - uint reserved:1; - uint direction:1; //0 lower-left,1 upper left - }; - }; -#pragma pack(pop) - - constexpr size_t TGAHeaderSize=sizeof(TGAHeader); - - bool FillTGAHeader(TGAHeader *header,const uint16 width,const uint16 height,const uint8 channels); - }//namespace util -}//namespace hgl -#endif//HGL_UTIL_IMAGE_FILE_TGA_INCLUDE diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index faaabcb..9789728 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,15 +103,9 @@ SET(DATABLOCK_SOURCE ${CMUTIL_ROOT_INCLUDE_PATH}/hgl/util/datablock/DataBlock source_group("Data Block" FILES ${DATABLOCK_SOURCE}) -SET(IMG_FILE_FILES ${CMUTIL_ROOT_INCLUDE_PATH}/hgl/util/imgfmt/tga.h - imgfmt/tga.cpp) - -source_group("Image Format" FILES ${IMG_FILE_FILES}) - add_cm_library(CMUtil "CM" ${CMD_SOURCE} # ${TIME_SOURCE} # ${DATABLOCK_SOURCE} - ${IMG_FILE_FILES} ${XML_PARSE_SOURCE} ${JSON_TOOL_SOURCE} diff --git a/src/imgfmt/tga.cpp b/src/imgfmt/tga.cpp deleted file mode 100644 index 9834ef7..0000000 --- a/src/imgfmt/tga.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include - -namespace hgl -{ - namespace util - { - bool FillTGAHeader(TGAHeader *header,const uint16 width,const uint16 height,const uint8 channels) - { - if(!header)return(false); - if(!width||!height)return(false); - - if(channels!=1 - &&channels!=3 - &&channels!=4)return(false); - - memset(header,0,sizeof(TGAHeader)); - - header->width=width; - header->height=height; - - TGAImageDesc desc; - - desc.image_desc=0; - - if(channels==1) - { - header->image_type=3; - header->bit=8; - } - else - { - header->image_type=2; - header->bit=channels*8; - - if(channels==4) - desc.alpha_depth=8; - } - - desc.direction=TGA_DIRECTION_UPPER_LEFT; - - header->image_desc=desc.image_desc; - return(true); - } - }//namespace util -}//namespace hgl \ No newline at end of file