Add image.destroy

This commit is contained in:
gingerBill
2022-05-14 15:11:23 +01:00
parent 3aa0a733f3
commit c516fb947f
6 changed files with 29 additions and 16 deletions
+13
View File
@@ -43,3 +43,16 @@ load_from_file :: proc(filename: string, options := Options{}, allocator := cont
return nil, .Unable_To_Read_File
}
}
destroy :: proc(img: ^Image, allocator := context.allocator) -> bool {
if img == nil {
return true
}
context.allocator = allocator
destroyer := _internal_destroyers[img.which]
if destroyer != nil {
destroyer(img)
}
free(img)
return true
}