Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/decode.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum spng_decode_flags

SPNG_DECODE_TRNS = 1, /* Apply transparency */
SPNG_DECODE_GAMMA = 2, /* Apply gamma correction */
SPNG_DECODE_FLIP_Y = 16, /* Flip the image vertically */
SPNG_DECODE_PROGRESSIVE = 256 /* Initialize for progressive reads */
};
```
Expand Down
5 changes: 5 additions & 0 deletions spng/spng.c
Original file line number Diff line number Diff line change
Expand Up @@ -3216,6 +3216,11 @@ int spng_decode_image(spng_ctx *ctx, void *out, size_t len, int fmt, int flags)
{
size_t ioffset = ri->row_num * ctx->out_width;

if(flags & SPNG_DECODE_FLIP_Y)
{
ioffset = len - ctx->out_width - ioffset;
}

ret = spng_decode_row(ctx, (unsigned char*)out + ioffset, ctx->out_width);
}while(!ret);

Expand Down
1 change: 1 addition & 0 deletions spng/spng.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ enum spng_decode_flags

SPNG_DECODE_TRNS = 1, /* Apply transparency */
SPNG_DECODE_GAMMA = 2, /* Apply gamma correction */
SPNG_DECODE_FLIP_Y = 16, /* Flip the image vertically */
SPNG_DECODE_PROGRESSIVE = 256 /* Initialize for progressive reads */
};

Expand Down