-
Notifications
You must be signed in to change notification settings - Fork 89
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
Provide a convenient way to convert to Surface's pixel format #61
Comments
👍 |
Yes, I've had that in plans. Not yet figured out a consistent way to handle both integer pixelformat and SDL_PixelFormat structure everywhere (renderer, texture, surface). Regarding the color, MapRGB should likely be a method of a SDL_PixelFormat wrapper. I'll try to handle this next year :) |
Is this a correct workaround?
|
Or better this:
|
You don't have to allocate a new pixel format as Surface already contains one. Probably something like this:
|
Thanks! I did not realize i can access |
Suppose I want to fill a rectangle with some color.
FillRect
member function expects a color in surface's format. There is conversion function,SDL_MapRGB
, but it expectsSDL_PixelFormat*
.Surface::GetFormat
, however, returns onlySDL_PixelFormat::format
, not the whole structure.What is the preferred way to convert RGB values to surface's color that
FillRect
expects?Shall a method be provided to convert RGB to color value:
Or even a
FillRect
overload taking RGB values?The text was updated successfully, but these errors were encountered: