资源简介
src文件夹下存放SOIL.h头文件,X64文件夹下分别存放debug和release版本下的lib文件,自行提取
代码片段和文件信息
/*
Jonathan Dummer
2007-07-31-10.32
simple DXT compression / decompression code
public domain
*/
#include “image_DXT.h“
#include
#include
#include
#include
/* set this =1 if you want to use the covarince matrix method...
which is better than my method of using standard deviations
overall except on the infintesimal chance that the power
method fails for finding the largest eigenvector */
#define USE_COV_MAT 1
/********* Function Prototypes *********/
/*
Takes a 4x4 block of pixels and compresses it into 8 bytes
in DXT1 format (color only no alpha). Speed is valued
over prettyness at least for now.
*/
void compress_DDS_color_block(
int channels
const unsigned char *const uncompressed
unsigned char compressed[8] );
/*
Takes a 4x4 block of pixels and compresses the alpha
component it into 8 bytes for use in DXT5 DDS files.
Speed is valued over prettyness at least for now.
*/
void compress_DDS_alpha_block(
const unsigned char *const uncompressed
unsigned char compressed[8] );
/********* Actual Exposed Functions *********/
int
save_image_as_DDS
(
const char *filename
int width int height int channels
const unsigned char *const data
)
{
/* variables */
FILE *fout;
unsigned char *DDS_data;
DDS_header header;
int DDS_size;
/* error check */
if( (NULL == filename) ||
(width < 1) || (height < 1) ||
(channels < 1) || (channels > 4) ||
(data == NULL ) )
{
return 0;
}
/* Convert the image */
if( (channels & 1) == 1 )
{
/* no alpha just use DXT1 */
DDS_data = convert_image_to_DXT1( data width height channels &DDS_size );
} else
{
/* has alpha so use DXT5 */
DDS_data = convert_image_to_DXT5( data width height channels &DDS_size );
}
/* save it */
memset( &header 0 sizeof( DDS_header ) );
header.dwMagic = (‘D‘ << 0) | (‘D‘ << 8) | (‘S‘ << 16) | (‘ ‘ << 24);
header.dwSize = 124;
header.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_LINEARSIZE;
header.dwWidth = width;
header.dwHeight = height;
header.dwPitchOrLinearSize = DDS_size;
header.sPixelFormat.dwSize = 32;
header.sPixelFormat.dwFlags = DDPF_FOURCC;
if( (channels & 1) == 1 )
{
header.sPixelFormat.dwFourCC = (‘D‘ << 0) | (‘X‘ << 8) | (‘T‘ << 16) | (‘1‘ << 24);
} else
{
header.sPixelFormat.dwFourCC = (‘D‘ << 0) | (‘X‘ << 8) | (‘T‘ << 16) | (‘5‘ << 24);
}
header.sCaps.dwCaps1 = DDSCAPS_TEXTURE;
/* write it out */
fout = fopen( filename “wb“);
fwrite( &header sizeof( DDS_header ) 1 fout );
fwrite( DDS_data 1 DDS_size fout );
fclose( fout );
/* done */
free( DDS_data );
return 1;
}
unsigned char* convert_image_to_DXT1(
const unsigned char *const uncompressed
int width int height int channels
int *out_size )
{
unsigned char *compressed;
int i j x y;
unsigned char ublock[16*3];
unsigned cha
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-12-17 00:10 SOIL\src\
文件 17181 2017-02-21 12:47 SOIL\src\image_DXT.c
文件 3212 2017-02-21 12:47 SOIL\src\image_DXT.h
文件 10511 2017-02-21 12:47 SOIL\src\image_helper.c
文件 2287 2017-02-21 12:47 SOIL\src\image_helper.h
目录 0 2017-12-17 00:10 SOIL\src\original\
文件 118175 2017-02-21 12:47 SOIL\src\original\stb_image-1.09.c
文件 126186 2017-02-21 12:47 SOIL\src\original\stb_image-1.16.c
文件 58744 2017-02-21 12:47 SOIL\src\SOIL.c
文件 15545 2017-02-21 12:47 SOIL\src\SOIL.h
文件 117420 2017-02-21 12:47 SOIL\src\stb_image_aug.c
文件 16945 2017-02-21 12:47 SOIL\src\stb_image_aug.h
文件 797 2017-02-21 12:47 SOIL\src\stbi_DDS_aug.h
文件 15447 2017-02-21 12:47 SOIL\src\stbi_DDS_aug_c.h
文件 11270 2017-02-21 12:47 SOIL\src\test_SOIL.cpp
目录 0 2017-12-17 00:10 SOIL\Win32\
目录 0 2017-12-17 00:10 SOIL\Win32\Debug\
目录 0 2017-12-17 00:10 SOIL\Win32\Debug\ALL_BUILD\
文件 556 2017-02-21 12:47 SOIL\Win32\Debug\ALL_BUILD\ALL_BUILD.log
目录 0 2017-12-17 00:10 SOIL\Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\
文件 175 2017-02-21 12:47 SOIL\Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\ALL_BUILD.lastbuildstate
文件 992 2017-02-21 12:47 SOIL\Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\custombuild.command.1.tlog
文件 4390 2017-02-21 12:47 SOIL\Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\custombuild.read.1.tlog
文件 278 2017-02-21 12:47 SOIL\Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\custombuild.write.1.tlog
目录 0 2017-12-17 00:10 SOIL\Win32\Debug\ZERO_CHECK\
文件 492 2017-02-21 12:47 SOIL\Win32\Debug\ZERO_CHECK\ZERO_CHECK.log
目录 0 2017-12-17 00:10 SOIL\Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\
文件 1136 2017-02-21 12:47 SOIL\Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\custombuild.command.1.tlog
文件 4604 2017-02-21 12:47 SOIL\Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\custombuild.read.1.tlog
文件 356 2017-02-21 12:47 SOIL\Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\custombuild.write.1.tlog
文件 175 2017-02-21 12:47 SOIL\Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate
............此处省略81个文件信息
- 上一篇:铭瑄580 8G 镁光颗粒
- 下一篇:自定义端口扫描工具
相关资源
- H310.B360.H370.Z390.USB WIN7 64位第三方驱动
- 标准pike 6480华硕SAS阵列卡驱动 官方版
- AFDX协议/ARINC664中文版第七部分
- winrar-x64-420sc注册方法
- librdkafka win7 64位 vs2015编译Release版本
- NDK-R12B windows-x86_64百度云盘
- 使用SPCE061A的ACM12864J液晶显示模块应用
- 东芝64排螺旋CT操作手册(中文)
- Notepad++最新版tidy2插件仅64位可用
- notepad++文本比较插件32位和64位
- Jsonviewer2 for Notepad++ 64 bit
- Surface pro 7 SD卡固定硬盘X64驱动带数字
- VS2012OpenGL配置所需要的全部libdllh文件
- ILASM32位 + 64位
- MTP USB驱动win7 32+64位可用版
- CLOVER4647整合NVME驱动,DG镜像
- WIN7-x64主题还原文件_请在PE下替换
- 64bit.server2008或win10下安装git服务器
- H.264视频编码基本知识
- 基于STM32F103C8单片机的晶联讯电子JL
- elite4 2.x驱动(解决加密狗驱动丢失问
- 富士通dpk8300E+驱动for win7 64位驱动
- u014556429_10418431.zip
-
MPla
yer64bit - windows 64位系统下安装Code Warrior6.3方法
- 钰硕ar8151网卡驱动 win7 64位 win7/10/xp
- An investigation into the effect of maize prod
- n.Software.IPWorks!.2016.V16.0.6446
- Microsoft Visio 2013 Professional 64位简体中
- 佳能canon lbp3000激光打印机驱动 for w
评论
共有 条评论