mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 03:57:29 +00:00
Fix exportImageToMemory (#232)
* fix exportImageToMemory * update make_return_cast
This commit is contained in:
parent
e072ff119b
commit
a00552ea79
@ -122,6 +122,8 @@ def add_namespace_to_type(t: str) -> str:
|
|||||||
def make_return_cast(source_type: str, dest_type: str, inner: str) -> str:
|
def make_return_cast(source_type: str, dest_type: str, inner: str) -> str:
|
||||||
if source_type == dest_type:
|
if source_type == dest_type:
|
||||||
return inner
|
return inner
|
||||||
|
if "ExportImageToMemory" in inner:
|
||||||
|
return f"{inner}[0..@as(usize, @intCast(fileSize.*))]"
|
||||||
if source_type in ["[*c]const u8", "[*c]u8"]:
|
if source_type in ["[*c]const u8", "[*c]u8"]:
|
||||||
return f"std.mem.span({inner})"
|
return f"std.mem.span({inner})"
|
||||||
|
|
||||||
|
@ -3838,7 +3838,7 @@ pub fn exportImage(image: Image, fileName: [:0]const u8) bool {
|
|||||||
|
|
||||||
/// Export image to memory buffer
|
/// Export image to memory buffer
|
||||||
pub fn exportImageToMemory(image: Image, fileType: [:0]const u8, fileSize: *i32) [:0]u8 {
|
pub fn exportImageToMemory(image: Image, fileType: [:0]const u8, fileSize: *i32) [:0]u8 {
|
||||||
return std.mem.span(cdef.ExportImageToMemory(image, @as([*c]const u8, @ptrCast(fileType)), @as([*c]c_int, @ptrCast(fileSize))));
|
return cdef.ExportImageToMemory(image, @as([*c]const u8, @ptrCast(fileType)), @as([*c]c_int, @ptrCast(fileSize)))[0..@as(usize, @intCast(fileSize.*))];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Export image as code file defining an array of bytes, returns true on success
|
/// Export image as code file defining an array of bytes, returns true on success
|
||||||
|
Loading…
x
Reference in New Issue
Block a user