package core:image/png
⌘K
Ctrl+K
or
/
Overview
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
Made available under Odin's BSD-2 license. List of contributors: Jeroen van Rijn: Initial implementation. Ginger Bill: Cosmetic changes. These are a few useful utility functions to work with PNG images.
package png implements a PNG image reader
The PNG specification is at https://www.w3.org/TR/PNG/.
Index
Constants (4)
Variables (4)
Procedures (31)
- append_chunk
- chrm
- chunk_type_to_name
- copy_chunk
- core_time
- defilter
- defilter_16
- defilter_8
- defilter_less_than_8
- destroy
- exif
- filter_paeth
- gamma
- hist
- iccp
- iccp_destroy
- load_from_bytes
- load_from_context
- load_from_file
- phys
- phys_to_dpi
- plte
- read_chunk
- read_header
- sbit
- splt
- splt_destroy
- srgb
- text
- text_destroy
- time
Procedure Groups (1)
Types
CIE_1931 ¶
CIE_1931 :: struct #packed { x: f32, y: f32, }
CIE_1931_Raw ¶
CIE_1931_Raw :: struct #packed { x: u32be, y: u32be, }
Filter_Params ¶
Filter_Params :: struct #packed { src: []u8, dest: []u8, width: int, height: int, depth: int, channels: int, rescale: bool, }
PLTE_Entry ¶
PLTE_Entry :: [3]u8
Row_Filter ¶
Row_Filter :: enum u8 { None = 0, Sub = 1, Up = 2, Average = 3, Paeth = 4, }
Signature ¶
Signature :: enum u64be { // 0x89504e470d0a1a0a PNG = 9894494448401390090, }
Text ¶
Text :: struct { keyword: string, keyword_localized: string, language: string, text: string, }
cHRM_Raw ¶
cHRM_Raw :: struct #packed { w: CIE_1931_Raw, r: CIE_1931_Raw, g: CIE_1931_Raw, b: CIE_1931_Raw, }
pHYs_Unit ¶
pHYs_Unit :: enum u8 { Unknown = 0, Meter = 1, }
sPLT ¶
sPLT :: struct #packed { name: string, depth: u8, entries: union { [][4]u8, [][4]u16, }, used: u16, }
sRGB ¶
sRGB :: struct #packed { intent: sRGB_Rendering_Intent, }
sRGB_Rendering_Intent ¶
sRGB_Rendering_Intent :: enum u8 { Perceptual = 0, Relative_colorimetric = 1, Saturation = 2, Absolute_colorimetric = 3, }
tIME ¶
tIME :: struct #packed { year: u16be, month: u8, day: u8, hour: u8, minute: u8, second: u8, }
Other chunks
Constants
INCHES_PER_METER ¶
INCHES_PER_METER :: 1000.0 / 25.4
MAX_CHUNK_SIZE ¶
MAX_CHUNK_SIZE :: min(#config(PNG_MAX_CHUNK_SIZE, 16_777_216), 268_435_456)
For chunks other than IDAT with a variable size like zTXT
and eXIf
,
limit their size to 16 MiB each by default. Max of 256 MiB each.
MAX_IDAT_SIZE ¶
MAX_IDAT_SIZE :: min(#config(PNG_MAX_IDAT_SIZE, _MAX_IDAT_DEFAULT), _MAX_IDAT)
depth_scale_table ¶
depth_scale_table: []u8 : []u8{0, 0xff, 0x55, 0, 0x11, 0, 0, 0, 0x01}
Variables
ADAM7_X_ORIG ¶
ADAM7_X_ORIG: []int = …
ADAM7_X_SPACING ¶
ADAM7_X_SPACING: []int = …
ADAM7_Y_ORIG ¶
ADAM7_Y_ORIG: []int = …
ADAM7_Y_SPACING ¶
ADAM7_Y_SPACING: []int = …
Procedures
append_chunk ¶
append_chunk :: proc(list: ^[dynamic]image.PNG_Chunk, src: image.PNG_Chunk, allocator := context.allocator) -> (err: image.Error) {…}
chunk_type_to_name ¶
chunk_type_to_name :: proc(type: ^image.PNG_Chunk_Type) -> string {…}
copy_chunk ¶
copy_chunk :: proc(src: image.PNG_Chunk, allocator := context.allocator) -> (dest: image.PNG_Chunk, err: image.Error) {…}
defilter_16 ¶
defilter_16 :: proc(params: ^Filter_Params) -> bool {…}
defilter_8 ¶
defilter_8 :: proc(params: ^Filter_Params) -> (ok: bool) {…}
defilter_less_than_8 ¶
defilter_less_than_8 :: proc(params: ^Filter_Params) -> bool {…}
filter_paeth ¶
filter_paeth :: proc(left, up, up_left: u8) -> u8 {…}
iccp_destroy ¶
iccp_destroy :: proc(i: iCCP) {…}
load_from_context ¶
load_from_context :: proc(ctx: ^$T, options: image.Options = Options{}, allocator := context.allocator) -> (img: ^image.Image, err: image.Error) {…}
load_from_file ¶
load_from_file :: proc(filename: string, options: image.Options = Options{}, allocator := context.allocator) -> (img: ^image.Image, err: image.Error) {…}
phys_to_dpi ¶
phys_to_dpi :: proc(p: pHYs) -> (x_dpi, y_dpi: f32) {…}
splt_destroy ¶
splt_destroy :: proc(s: sPLT) {…}
text_destroy ¶
text_destroy :: proc(text: Text) {…}
Procedure Groups
load ¶
load :: proc{ load_from_file, load_from_bytes, load_from_context, }
Source Files
Generation Information
Generated with odin version dev-2023-06 (vendor "odin") Windows_amd64 @ 2023-06-02 21:08:32.595188700 +0000 UTC