Blender
V5.3
intern
ktx_bridge
intern
ktx_bridge/intern/encoder.h
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2026 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include "
common.h
"
8
9
#include <ktx.h>
10
11
/* Encodes a tightly packed RGB(A)8 pixel buffer (`channels` is 3 or 4, rows bottom-to-top,
12
* matching Blender's `Image.pixels` convention) as a Basis Universal KTX2 file.
13
* `quality` is in [0, 100]. `is_data` selects a UNORM VkFormat instead of sRGB, for data
14
* textures (normal maps, roughness, etc.) that must not be gamma-encoded. `use_uastc` selects
15
* UASTC (higher quality, larger output) instead of ETC1S (smaller, lower quality, faster).
16
* `compress` in [0, 22] applies additional Zstandard supercompression on top of UASTC, as a
17
* raw Zstd level (0 disables it, 1 = fastest/lowest ratio, 22 = slowest/highest ratio); ignored
18
* when `use_uastc` is false, since ETC1S cannot be Zstd-compressed.
19
* Returns a `ktx_error_code_e` (0 = success). */
20
API
(
int
)
21
encodeToFile
(
const
char
*filename,
22
const
unsigned
char
*pixels,
23
unsigned
int
width,
24
unsigned
int
height,
25
unsigned
int
channels,
26
int
quality,
27
int
is_data,
28
int
use_uastc,
29
int
compress);
API
#define API(returnType)
Definition
draco_bridge/intern/common.h:23
common.h
encodeToFile
int encodeToFile(const char *filename, const unsigned char *pixels, unsigned int width, unsigned int height, unsigned int channels, int quality, int is_data, int use_uastc, int compress)
Definition
ktx_bridge/intern/encoder.cpp:13
Generated on
for Blender by
doxygen
1.18.0