How to draw image/graphic form memory buffer?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
wuuyi123
Prole
Posts: 1
Joined: Mon Dec 03, 2018 11:45 am

How to draw image/graphic form memory buffer?

Post by wuuyi123 »

Hi everyone,
I'm into CEF (Chromium Embedded Framework) and using offscreen rendering.
I remember SDL2 has function draw image from memory buffer, but I couldn't find that in Love2D.
Please help me!

For example:

Code: Select all

img = LoadImage('abc.png')
buffer = img:toBitmap()

love.drawImage(buffer, img.width, img.height) --
...

Code: Select all

const void *buffer = ...;
DrawImage(buffer, width, height);
User avatar
radgeRayden
Prole
Posts: 29
Joined: Sun Jul 27, 2014 6:49 pm
Location: Brasil
Contact:

Re: How to draw image/graphic form memory buffer?

Post by radgeRayden »

Hey, perhaps a bit late but I just did something of the sort yesterday. What you need to do is get your data into an ImageData object and then make an image out of that. However, if I understand correctly you can do offscreen rendering using Canvases (render to texture). Look up these items in the wiki and you should have a clearer image of what you need.
Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests