-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[rtext] BMFont loading, support RGB and RGBA image formats #4730
Conversation
@GithubPrankster I'm seeing multiple points of improvement on this PR. In case of GRAYSCALE only, it can be converted to GRAYSCALE+ALPHA but in case of an image with already provided Alpha, it can use the full RGB color. Also, the changes do not follow raylib coding conventions: parenthesis on conditions, brackets alignment, operations symbols spacing, not enum types... |
So it should just be a copy of the image? |
// Convert image to GRAYSCALE + ALPHA, using the mask as the alpha channel | ||
|
||
Image imFont = { | ||
.data = RL_CALLOC(imFonts[i].width * imFonts[i].height, 2), |
Check failure
Code scanning / CodeQL
Uncontrolled allocation size High
user input (string read by fread)
@GithubPrankster I'm afraid I'm not merging this change, the approach of picking up R channel in any case (using stride) is not the desired behaviour. |
With this PR, if the BMFont file points to images that aren't grayscale, they will now load and be converted. This allows the images to be, for example, .qoi ones which are solely RGBA.
I'm curious if failing the format check should throw a log warning, let me know and I'll add that.EDIT: Subsequently added a log warning.