add saving and loading qoi
This commit is contained in:
parent
dbaf482385
commit
ca6c21ebb8
|
@ -137,7 +137,7 @@ json.doc = {
|
|||
};
|
||||
|
||||
Resources.scripts = ["jsoc", "jsc", "jso", "js"];
|
||||
Resources.images = ["png", "gif", "jpg", "jpeg"];
|
||||
Resources.images = ["qoi", "png", "gif", "jpg", "jpeg"];
|
||||
Resources.sounds = ["wav", "flac", "mp3", "qoa"];
|
||||
Resources.is_image = function (path) {
|
||||
var ext = path.ext();
|
||||
|
|
|
@ -314,6 +314,13 @@ void texture_save(texture *tex, const char *file)
|
|||
stbi_write_tga(file, tex->width, tex->height, 4, tex->data);
|
||||
else if (!strcmp(ext, ".jpg") || !strcmp(ext, ".jpeg"))
|
||||
stbi_write_jpg(file, tex->width, tex->height, 4, tex->data, 5);
|
||||
else if (!strcmp(ext, ".qoi"))
|
||||
qoi_write(file, tex->data, &(qoi_desc) {
|
||||
.width = tex->width,
|
||||
.height = tex->height,
|
||||
.channels = 4,
|
||||
.colorspace = QOI_SRGB
|
||||
});
|
||||
}
|
||||
|
||||
// copy texture src to dest
|
||||
|
|
Loading…
Reference in a new issue