update readme.md

This commit is contained in:
andri lim 2017-11-24 18:05:36 +07:00
parent 2d37be99e3
commit 2053f45f7c
1 changed files with 6 additions and 6 deletions

View File

@ -123,24 +123,24 @@ Animation frames can be accessible via `png.frames`. If it is not an APNG, `png.
### Encoding ### Encoding
```Nim ```Nim
var png = prepareAPNG24() var png = prepareAPNG24(numPlays)
``` ```
* First step is to call prepareAPNG, prepareAPNG24, or prepareAPNG32. You also can specify how many times the animation * First step is to call `prepareAPNG`, `prepareAPNG24`, or `prepareAPNG32`. You also can specify how many times the animation
will be played will be played
```Nim ```Nim
png.addDefaultImage(framePixels, w, h, ctl) png.addDefaultImage(framePixels, w, h, ctl)
``` ```
* Second step is also mandatory, you should call addDefaultImage. ctl is optional, if you provide a ctl(Frame Control), * Second step is also mandatory, you should call `addDefaultImage`. `ctl` is optional, if you provide a `ctl`(Frame Control),
the default image will be part of the animation. If ctl is nil, default image will not be part of animation. the default image will be part of the animation. If `ctl` is nil, default image will not be part of animation.
```Nim ```Nim
png.addFrame(frames[i].data, ctl) png.addFrame(frames[i].data, ctl)
``` ```
* Third step is calling addFrame one or more times. Here ctl is mandatory. * Third step is calling `addFrame` one or more times. Here `ctl` is mandatory.
```Nim ```Nim
png.saveAPNG("rainbow.png") png.saveAPNG("rainbow.png")
@ -148,7 +148,7 @@ the default image will be part of the animation. If ctl is nil, default image wi
var str = png.encodeAPNG() var str = png.encodeAPNG()
``` ```
* Final step is to call saveAPNG if you want save it to file or call encodeAPNG if you want to get the result in a string container * Final step is to call `saveAPNG` if you want save it to file or call `encodeAPNG` if you want to get the result in a string container
You can read the details of frame control from [spec](https://wiki.mozilla.org/APNG_Specification). You can read the details of frame control from [spec](https://wiki.mozilla.org/APNG_Specification).
You can also see an example in tester/test.nim -> generateAPNG You can also see an example in tester/test.nim -> generateAPNG