Code Monkey home page Code Monkey logo

apng's Introduction

APNG

An Animated PNG reading library

The goal of this library is to provide a very simple API for reading and using frames from an APNG file.

Build Status

Building the library

This library can be built by running: make && make install

Testing your build

This library's tests depend on crunch being installed and in your PATH. Provided this is met, the tests can be built by running make test. To run the tests (and build them if they aren't), run make check.

The API

The main type in the library is apng_t, which allows loading and interogating an APNG file. There are several ways to present the APNG data to apng_t - using any of the built in stream_t types, or your own.

The three available built-in stream_t types are:

  • fileStream_t, which takes the file to open and the mode to open it with using open()'s constants
  • memoryStream_t, which takes a buffer and the length of that buffer
  • zlibStream_t, which takes some other stream_t that represents a ZLib stream, and whether the stream should be used in inflate or deflate mode

Using fileStream_t as an example, here's a typical way to open an APNG file and have the library read it in: apng_t pngFile(fileStream_t("myAPNG.png", O_RDONLY)); At this point, the frame data will be available by calling pngFile.frames(), with other properties such as the width and the height of the display area available by calling pngFile.width() and pngFile.height().

To free all resources consumed by this operation, simply let apng_t go out of scope, or if you used new to allocate your instance, just call delete on the instance, though you should have used std::unique_ptr<>. DO NOTE: all frame data returned by frames() will be invalidated and you must stop using the pointers, after allowing apng_t to go out of scope.

apng's People

Contributors

dragonmux avatar dx-mon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.