mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
stbi: add LoadParams to load_from_memory() as well (#19268)
This commit is contained in:
parent
18e60e77de
commit
d04a3e52e3
1 changed files with 2 additions and 3 deletions
|
@ -135,14 +135,13 @@ pub fn load(path string, params LoadParams) !Image {
|
|||
}
|
||||
|
||||
// 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{
|
||||
ok: true
|
||||
data: 0
|
||||
}
|
||||
flag := C.STBI_rgb_alpha
|
||||
res.data = C.stbi_load_from_memory(buf, bufsize, &res.width, &res.height, &res.nr_channels,
|
||||
flag)
|
||||
params.desired_channels)
|
||||
if isnil(res.data) {
|
||||
return error('stbi_image failed to load from memory')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue