Skip to content

Instantly share code, notes, and snippets.

@randy408
randy408 / meson.build
Created September 29, 2021 13:41
override
if get_option('use_zlibng') == true
cmake = import('cmake')
zng_sp = cmake.subproject('zlib-ng')
zng_dep = zng_sp.dependency('zlib')
meson.override_dependency('zlib', zng_dep)
endif
/* Sets *fmt to a `SPNG_FMT_*` enum with the same color type and bit depth
as the PNG with an alpha channel if the PNG has a tRNS chunk,
if the color type is indexed the format will be `SPNG_FMT_RGBA8`
useful for emulating the behavior of png_set_tRNS_to_alpha().
note that SPNG_DECODE_TRNS is required to apply transparency
which can be set unconditionally without triggering an error */
int spng_set_trns_fmt(spng_ctx *ctx, int *fmt)
{
if(ctx == NULL || fmt == NULL) return 1;
@randy408
randy408 / spng_crc_fix.c
Created March 4, 2020 18:17
Fixes PNG chunk CRC's, takes a filepath as argument and rewrites the file with valid chunk CRC's.
/* This does not depend on libspng
gcc -o spng_crc_fix -lz spng_crc_fix.c */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <limits.h>
#include <string.h>
@randy408
randy408 / keybase.txt
Created November 30, 2017 21:25
keybase
### Keybase proof
I hereby claim:
* I am randy408 on github.
* I am randy408 (https://keybase.io/randy408) on keybase.
* I have a public key ASA1LwRy2IJKqGIBzVrjyOHg3HhESqzRBwefbpL97JpsVwo
To claim this, I am signing this object: