C语言图形库怎么贴图png,libspng: libspng 是一个 C 语言的开发库,用来读写 PNG 格式图片,特点是安全而且易用...

community.svg

badge.svg?label=financial+contributors

pipeline.svg

libspng.svg

badge.svg

coverage.svg

libspng.svg

libspng

libspng (simple png) is a C library for reading and writing Portable Network Graphics (PNG)

format files with a focus on security and ease of use.

libspng is an alternative to libpng, the projects are separate and the APIs are

not compatible.

Motivation

The goal is to provide a fast PNG library with a simpler API than libpng,

it outperforms the reference implementation in common use cases.

Performance

b701f2e7032174ca46b741fcfb4be567.png

Features

Feature

spng

libpng

stb_image

lodepng

Decode from stream

Gamma correction

No known security bugs[1]

Progressive image read

Parses all standard chunks

Doesn't require zlib[2]

Encoding

Planned

Animated PNG

Planned

✅[3]

[1] The project is fuzz tested on OSS-Fuzz and vulnerabilities are fixed before they become public.

[2] Building with miniz is supported.

[3] With a 3rd party patch

Getting spng

Download the latest release and include spng.c/spng.h in your project,

you can also build with CMake or Meson, refer to the documentation for details.

Usage

#include

/* Create a context */

spng_ctx *ctx = spng_ctx_new(0);

/* Set an input buffer */

spng_set_png_buffer(ctx, buf, buf_size);

/* Determine output image size */

spng_decoded_image_size(ctx, SPNG_FMT_RGBA8, &out_size);

/* Decode to 8-bit RGBA */

spng_decode_image(ctx, out, out_size, SPNG_FMT_RGBA8, 0);

/* Free context memory */

spng_ctx_free(ctx);

License

Code is licensed under the BSD 2-clause "Simplified" License.

The project contains optimizations and test images from libpng, these are licensed under the

PNG Reference Library License version 2.

Security & Testing

Code is written according to the rules of the

CERT C Coding Standard.

All integer arithmetic is checked for overflow and all error conditions are handled gracefully.

The library is continuously fuzzed by OSS-Fuzz,

code is also scanned with Clang Static Analyzer, Coverity Scan and PVS-Studio.

The test suite consists of over 1000 test cases,

175 test images are decoded with all possible

output format and flag combinations and compared against libpng for correctness.

Versioning

Releases follow the semantic versioning scheme with additional guarantees:

Releases from 0.4.0 to 0.8.x are stable

If 1.0.0 will introduce breaking changes then 0.8.x will be maintained as a separate stable branch

Currently 1.0.0 is planned to be compatible.

Documentation

Online documentation is available at libspng.org/docs.

Known Issues

Decoding to SPNG_FMT_G8, SPNG_FMT_GA8 and SPNG_FMT_GA16 output formats is not supported

for all PNG color type and bit depth combinations, see documentation for details.

Gamma correction is not implemented for SPNG_FMT_PNG, SPNG_FMT_G8, SPNG_FMT_GA8

and SPNG_FMT_GA16 output formats.

Non-critical errors may cause an image to not load (#132).

Supporting spng

You can sponsor development through OpenCollective, funds will be used for maintenance and further development according to the roadmap.

OpenCollective backers

Individuals

backers.svg?width=890

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

avatar.svg

avatar.svg

b1ecf72424d4e2955ce61d67b380a30c.png

9092c2d933be47e9294dbdff6bb5e700.png

295f9ab171b5f8122b03f8d4fc7160d1.png

444cc667a86286876dff6bbfb1dc7907.png

307184d6bc29098ab11ae5bb1163a3a9.png

2d6adc3ccd7250773a2ebe6e88f25425.png

c5f9f687fdebad35122a2c28cf4447ab.png

fab6a2f6d9b580ceba8b2b7b175e628f.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值