image/jpeg: implement jpeg decoding for baseline and extended sequential jpegs

This commit is contained in:
Hisham Aburaqibah
2025-09-08 17:12:58 +02:00
committed by Jeroen van Rijn
parent d704c45c24
commit a6f18c3367
5 changed files with 1089 additions and 8 deletions
+18
View File
@@ -0,0 +1,18 @@
package jpeg
import "core:os"
load :: proc{load_from_file, load_from_bytes, load_from_context}
load_from_file :: proc(filename: string, options := Options{}, allocator := context.allocator) -> (img: ^Image, err: Error) {
context.allocator = allocator
data, ok := os.read_entire_file(filename)
defer delete(data)
if ok {
return load_from_bytes(data, options)
} else {
return nil, .Unable_To_Read_File
}
}