|
1 |
| -module Pluto::Format::Binding |
2 |
| - @[Link(ldflags: "-lspng")] |
3 |
| - lib LibSPNG |
4 |
| - fun ctx_free = spng_ctx_free(ctx : Void*) |
5 |
| - fun ctx_new = spng_ctx_new(flags : CtxFlags) : Void* |
6 |
| - fun decode_image = spng_decode_image(ctx : Void*, out : Void*, len : LibC::SizeT, fmt : Format, flags : DecodeFlags) : LibC::Int |
7 |
| - fun decoded_image_size = spng_decoded_image_size(ctx : Void*, fmt : Format, len : LibC::SizeT*) : LibC::Int |
8 |
| - fun encode_chunks = spng_encode_chunks(ctx : Void*) : LibC::Int |
9 |
| - fun encode_image = spng_encode_image(ctx : Void*, img : Void*, len : LibC::SizeT, fmt : Format, flags : EncodeFlags) : LibC::Int |
10 |
| - fun get_ihdr = spng_get_ihdr(ctx : Void*, ihdr : IHDR*) : LibC::Int |
11 |
| - fun get_png_buffer = spng_get_png_buffer(ctx : Void*, len : LibC::SizeT*, error : LibC::Int*) : UInt8* |
12 |
| - fun set_ihdr = spng_set_ihdr(ctx : Void*, ihdr : IHDR*) : LibC::Int |
13 |
| - fun set_option = spng_set_option(ctx : Void*, option : Option, value : LibC::Int) : LibC::Int |
14 |
| - fun set_png_buffer = spng_set_png_buffer(ctx : Void*, buf : Void*, size : LibC::SizeT) : LibC::Int |
| 1 | +@[Link(ldflags: "-lspng")] |
| 2 | +lib Pluto::Format::Binding::LibSPNG |
| 3 | + fun ctx_free = spng_ctx_free(ctx : Void*) |
| 4 | + fun ctx_new = spng_ctx_new(flags : CtxFlags) : Void* |
| 5 | + fun decode_image = spng_decode_image(ctx : Void*, out : Void*, len : LibC::SizeT, fmt : Format, flags : DecodeFlags) : LibC::Int |
| 6 | + fun decoded_image_size = spng_decoded_image_size(ctx : Void*, fmt : Format, len : LibC::SizeT*) : LibC::Int |
| 7 | + fun encode_chunks = spng_encode_chunks(ctx : Void*) : LibC::Int |
| 8 | + fun encode_image = spng_encode_image(ctx : Void*, img : Void*, len : LibC::SizeT, fmt : Format, flags : EncodeFlags) : LibC::Int |
| 9 | + fun get_ihdr = spng_get_ihdr(ctx : Void*, ihdr : IHDR*) : LibC::Int |
| 10 | + fun get_png_buffer = spng_get_png_buffer(ctx : Void*, len : LibC::SizeT*, error : LibC::Int*) : UInt8* |
| 11 | + fun set_ihdr = spng_set_ihdr(ctx : Void*, ihdr : IHDR*) : LibC::Int |
| 12 | + fun set_option = spng_set_option(ctx : Void*, option : Option, value : LibC::Int) : LibC::Int |
| 13 | + fun set_png_buffer = spng_set_png_buffer(ctx : Void*, buf : Void*, size : LibC::SizeT) : LibC::Int |
15 | 14 |
|
16 |
| - enum ColorType : UInt8 |
17 |
| - Grayscale = 0 |
18 |
| - TrueColor = 2 |
19 |
| - Indexed = 3 |
20 |
| - GrayscaleAlpha = 4 |
21 |
| - TrueColorAlpha = 6 |
22 |
| - end |
| 15 | + enum ColorType : UInt8 |
| 16 | + Grayscale = 0 |
| 17 | + TrueColor = 2 |
| 18 | + Indexed = 3 |
| 19 | + GrayscaleAlpha = 4 |
| 20 | + TrueColorAlpha = 6 |
| 21 | + end |
23 | 22 |
|
24 |
| - enum CtxFlags |
25 |
| - None = 0 |
26 |
| - IgnoreAdler32 = 1 |
27 |
| - Encoder = 2 |
28 |
| - end |
| 23 | + enum CtxFlags |
| 24 | + None = 0 |
| 25 | + IgnoreAdler32 = 1 |
| 26 | + Encoder = 2 |
| 27 | + end |
29 | 28 |
|
30 |
| - enum DecodeFlags |
31 |
| - None = 0 |
32 |
| - TRNS = 1 |
33 |
| - Gamma = 2 |
34 |
| - Progressive = 256 |
35 |
| - end |
| 29 | + enum DecodeFlags |
| 30 | + None = 0 |
| 31 | + TRNS = 1 |
| 32 | + Gamma = 2 |
| 33 | + Progressive = 256 |
| 34 | + end |
36 | 35 |
|
37 |
| - enum EncodeFlags |
38 |
| - Progressive = 1 |
39 |
| - Finalize = 2 |
40 |
| - end |
| 36 | + enum EncodeFlags |
| 37 | + Progressive = 1 |
| 38 | + Finalize = 2 |
| 39 | + end |
41 | 40 |
|
42 |
| - enum Format |
43 |
| - RGBA8 = 1 |
44 |
| - RGBA16 = 2 |
45 |
| - RGB8 = 4 |
46 |
| - GA8 = 16 |
47 |
| - GA16 = 32 |
48 |
| - G8 = 64 |
49 |
| - PNG = 256 |
50 |
| - Raw = 512 |
51 |
| - end |
| 41 | + enum Format |
| 42 | + RGBA8 = 1 |
| 43 | + RGBA16 = 2 |
| 44 | + RGB8 = 4 |
| 45 | + GA8 = 16 |
| 46 | + GA16 = 32 |
| 47 | + G8 = 64 |
| 48 | + PNG = 256 |
| 49 | + Raw = 512 |
| 50 | + end |
52 | 51 |
|
53 |
| - enum Option |
54 |
| - KeepUnknownChunks = 1 |
55 |
| - ImgCompressionLevel = 2 |
56 |
| - ImgWindowBits = 3 |
57 |
| - ImgMemLevel = 4 |
58 |
| - ImgCompressionStrategy = 5 |
59 |
| - TextCompressionLevel = 6 |
60 |
| - TextWindowBits = 7 |
61 |
| - TextMemLevel = 8 |
62 |
| - TextCompressionStrategy = 9 |
63 |
| - FilterChoice = 10 |
64 |
| - ChunkCountLimit = 11 |
65 |
| - EncodeToBuffer = 12 |
66 |
| - end |
| 52 | + enum Option |
| 53 | + KeepUnknownChunks = 1 |
| 54 | + ImgCompressionLevel = 2 |
| 55 | + ImgWindowBits = 3 |
| 56 | + ImgMemLevel = 4 |
| 57 | + ImgCompressionStrategy = 5 |
| 58 | + TextCompressionLevel = 6 |
| 59 | + TextWindowBits = 7 |
| 60 | + TextMemLevel = 8 |
| 61 | + TextCompressionStrategy = 9 |
| 62 | + FilterChoice = 10 |
| 63 | + ChunkCountLimit = 11 |
| 64 | + EncodeToBuffer = 12 |
| 65 | + end |
67 | 66 |
|
68 |
| - struct IHDR |
69 |
| - width : UInt32 |
70 |
| - height : UInt32 |
71 |
| - bit_depth : UInt8 |
72 |
| - color_type : ColorType |
73 |
| - compression_method : UInt8 |
74 |
| - filter_method : UInt8 |
75 |
| - interlace_method : UInt8 |
76 |
| - end |
| 67 | + struct IHDR |
| 68 | + width : UInt32 |
| 69 | + height : UInt32 |
| 70 | + bit_depth : UInt8 |
| 71 | + color_type : ColorType |
| 72 | + compression_method : UInt8 |
| 73 | + filter_method : UInt8 |
| 74 | + interlace_method : UInt8 |
77 | 75 | end
|
78 | 76 | end
|
0 commit comments