mirror of https://github.com/status-im/nimPNG.git
update readme.md
This commit is contained in:
parent
2d37be99e3
commit
2053f45f7c
12
readme.md
12
readme.md
|
@ -123,24 +123,24 @@ Animation frames can be accessible via `png.frames`. If it is not an APNG, `png.
|
|||
### Encoding
|
||||
|
||||
```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
|
||||
|
||||
```Nim
|
||||
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),
|
||||
the default image will be part of the animation. If ctl is nil, default image will not be part of animation.
|
||||
* 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.
|
||||
|
||||
```Nim
|
||||
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
|
||||
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()
|
||||
```
|
||||
|
||||
* 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 also see an example in tester/test.nim -> generateAPNG
|
||||
|
|
Loading…
Reference in New Issue