Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
93b2b829
S
stb
项目概览
itdan3344
/
stb
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
93b2b829
编写于
9月 14, 2015
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get rid of unused return value from write callback
上级
b4477803
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
6 deletion
+12
-6
stb_image_write.h
stb_image_write.h
+8
-5
tests/image_test.c
tests/image_test.c
+4
-1
未找到文件。
stb_image_write.h
浏览文件 @
93b2b829
/* stb_image_write - v1.00 - public domain - http://nothings.org/stb/stb_image_write.h
writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010
writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010
-2015
no warranty implied; use at your own risk
Before #including,
...
...
@@ -44,6 +44,9 @@ USAGE:
int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data);
int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data);
where the callback is:
void stbi_write_func(void *context, void *data, int size);
You can define STBI_WRITE_NO_STDIO to disable the file variant of these
functions, so the library will not use stdio.h at all. However, this will
also disable HDR writing, because it requires stdio for formatted output.
...
...
@@ -125,7 +128,7 @@ STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const
STBIWDEF
int
stbi_write_hdr
(
char
const
*
filename
,
int
w
,
int
h
,
int
comp
,
const
float
*
data
);
#endif
typedef
int
stbi_write_func
(
void
*
context
,
void
*
data
,
int
size
);
typedef
void
stbi_write_func
(
void
*
context
,
void
*
data
,
int
size
);
STBIWDEF
int
stbi_write_png_to_func
(
stbi_write_func
*
func
,
void
*
context
,
int
w
,
int
h
,
int
comp
,
const
void
*
data
,
int
stride_in_bytes
);
STBIWDEF
int
stbi_write_bmp_to_func
(
stbi_write_func
*
func
,
void
*
context
,
int
w
,
int
h
,
int
comp
,
const
void
*
data
);
...
...
@@ -192,15 +195,15 @@ static void stbi__start_write_callbacks(stbi__write_context *s, stbi_write_func
#ifndef STBI_WRITE_NO_STDIO
static
int
stbi__stdio_write
(
void
*
user
,
void
*
data
,
int
size
)
static
void
stbi__stdio_write
(
void
*
context
,
void
*
data
,
int
size
)
{
return
(
int
)
fwrite
(
data
,
1
,
size
,(
FILE
*
)
user
);
fwrite
(
data
,
1
,
size
,(
FILE
*
)
context
);
}
static
int
stbi__start_write_file
(
stbi__write_context
*
s
,
const
char
*
filename
)
{
FILE
*
f
=
fopen
(
filename
,
"wb"
);
stbi__start_write_callbacks
(
s
,
&
stbi__stdio_write
,
(
void
*
)
f
);
stbi__start_write_callbacks
(
s
,
stbi__stdio_write
,
(
void
*
)
f
);
return
f
!=
NULL
;
}
...
...
tests/image_test.c
浏览文件 @
93b2b829
...
...
@@ -53,7 +53,7 @@ void test_ycbcr(void)
float
hdr_data
[
200
][
200
][
3
];
void
dummy
(
void
*
context
,
void
*
data
,
int
len
)
void
dummy
_write
(
void
*
context
,
void
*
data
,
int
len
)
{
static
char
dummy
[
1024
];
if
(
len
>
1024
)
len
=
1024
;
...
...
@@ -97,6 +97,9 @@ int main(int argc, char **argv)
stbi_write_png
(
stb_sprintf
(
"output/%s.png"
,
fname
),
w
,
h
,
4
,
data
,
w
*
4
);
stbi_write_bmp
(
stb_sprintf
(
"output/%s.bmp"
,
fname
),
w
,
h
,
4
,
data
);
stbi_write_tga
(
stb_sprintf
(
"output/%s.tga"
,
fname
),
w
,
h
,
4
,
data
);
stbi_write_png_to_func
(
dummy_write
,
0
,
w
,
h
,
4
,
data
,
w
*
4
);
stbi_write_bmp_to_func
(
dummy_write
,
0
,
w
,
h
,
4
,
data
);
stbi_write_tga_to_func
(
dummy_write
,
0
,
w
,
h
,
4
,
data
);
free
(
data
);
}
else
printf
(
"FAILED 4
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录