imagedecoder.odin (2377B)
1 // This file is part of Blend2D project <https://blend2d.com> 2 // 3 // See blend2d.h or LICENSE.md for license and copyright information 4 // SPDX-License-Identifier: Zlib 5 package blend2d 6 7 import "core:c" 8 9 when ODIN_OS == .Windows { 10 foreign import lib "blend2d.lib" 11 } else when ODIN_OS == .Darwin { 12 foreign import lib "libblend2d.a" 13 } else when ODIN_OS == .Linux { 14 foreign import lib "libblend2d.a" 15 } 16 17 18 //! Image decoder [C API] 19 ImageDecoderCore :: struct { 20 _d: ObjectDetail, 21 } 22 23 //! \cond INTERNAL 24 //! Image decoder [C API Virtual Function Table]. 25 ImageDecoderVirt :: struct { 26 base: ObjectVirtBase, 27 restart: proc "c" (impl: ^ImageDecoderImpl) -> Result, 28 read_info: proc "c" (impl: ^ImageDecoderImpl, info_out: ^ImageInfo, data: ^u8, size: c.size_t) -> Result, 29 read_frame: proc "c" (impl: ^ImageDecoderImpl, image_out: ^ImageCore, data: ^u8, size: c.size_t) -> Result, 30 } 31 32 //! Image decoder [C API Impl]. 33 ImageDecoderImpl :: struct { 34 //! \name Members 35 //! \{ 36 37 //! Virtual function table. 38 virt: ^ImageDecoderVirt, 39 40 //! Image codec that created this decoder. 41 codec: ImageCodecCore, 42 43 //! Last faulty result (if failed). 44 last_result: Result, 45 46 //! Handle in case that this decoder wraps a third-party library. 47 handle: rawptr, 48 49 //! Current frame index. 50 frame_index: u64, 51 52 //! Position in source buffer. 53 buffer_index: c.size_t, 54 } 55 56 @(default_calling_convention="c", link_prefix="bl_") 57 foreign lib { 58 //! \endcond 59 image_decoder_init :: proc(self: ^ImageDecoderCore) -> Result --- 60 image_decoder_init_move :: proc(self: ^ImageDecoderCore, other: ^ImageDecoderCore) -> Result --- 61 image_decoder_init_weak :: proc(self: ^ImageDecoderCore, other: ^ImageDecoderCore) -> Result --- 62 image_decoder_destroy :: proc(self: ^ImageDecoderCore) -> Result --- 63 image_decoder_reset :: proc(self: ^ImageDecoderCore) -> Result --- 64 image_decoder_assign_move :: proc(self: ^ImageDecoderCore, other: ^ImageDecoderCore) -> Result --- 65 image_decoder_assign_weak :: proc(self: ^ImageDecoderCore, other: ^ImageDecoderCore) -> Result --- 66 image_decoder_restart :: proc(self: ^ImageDecoderCore) -> Result --- 67 image_decoder_read_info :: proc(self: ^ImageDecoderCore, info_out: ^ImageInfo, data: ^u8, size: c.size_t) -> Result --- 68 image_decoder_read_frame :: proc(self: ^ImageDecoderCore, image_out: ^ImageCore, data: ^u8, size: c.size_t) -> Result --- 69 } 70