mirror of
https://github.com/vlang/v.git
synced 2025-08-04 02:07:28 -04:00
stbi: add LoadParams to load_from_memory() as well (#19268)
This commit is contained in:
parent
18e60e77de
commit
d04a3e52e3
@ -135,14 +135,13 @@ pub fn load(path string, params LoadParams) !Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load_from_memory load an image from a memory buffer
|
// load_from_memory load an image from a memory buffer
|
||||||
pub fn load_from_memory(buf &u8, bufsize int) !Image {
|
pub fn load_from_memory(buf &u8, bufsize int, params LoadParams) !Image {
|
||||||
mut res := Image{
|
mut res := Image{
|
||||||
ok: true
|
ok: true
|
||||||
data: 0
|
data: 0
|
||||||
}
|
}
|
||||||
flag := C.STBI_rgb_alpha
|
|
||||||
res.data = C.stbi_load_from_memory(buf, bufsize, &res.width, &res.height, &res.nr_channels,
|
res.data = C.stbi_load_from_memory(buf, bufsize, &res.width, &res.height, &res.nr_channels,
|
||||||
flag)
|
params.desired_channels)
|
||||||
if isnil(res.data) {
|
if isnil(res.data) {
|
||||||
return error('stbi_image failed to load from memory')
|
return error('stbi_image failed to load from memory')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user