-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I create a PixelFormat to pass to Surface.from() ? #63
Comments
You can use The alternative would be to decode the image into a flat byte buffer and respect one of the pixel format or create a specific one so SDL can know where each pixel is in the buffer and how to interpret the bytes as pixel colors (too much hassle). |
Thanks for the quick response @ysbaddaden I'm trying to work with the raw pixel data from the Blend2D rendering as creating an image and then loading it is too slow. I want it fast enough to run at 60+ fps. Is there a different way to do this with SDL or should I try a library more suited to this? |
Oh, then you need to know the byte format for a Blend2D::Image buffer (preferably) or a mean to translate to a known format (RGBA32). Most of the pixels related C functions don't have a binding, but you may write some. I noticed Toying with this, you should eventually be able to render from blend2d to sdl. |
That worked great - thanks! I forked this library and made a few updates to get it working. I can make a PR later - maybe after the holidays. |
I'm trying to render an image that I created with Blend2d.cr. I passed in the bytes of the image in the first argument, the width, and height next. But I don't know how to create a PixelFormat instance to pass in as the fourth argument.
The text was updated successfully, but these errors were encountered: