Skip to content

Add is_flipped_vertically flag to image loading#2922

Open
Argmaster wants to merge 2 commits intoPixelGuys:masterfrom
Argmaster:add-is_flipped_vertically
Open

Add is_flipped_vertically flag to image loading#2922
Argmaster wants to merge 2 commits intoPixelGuys:masterfrom
Argmaster:add-is_flipped_vertically

Conversation

@Argmaster
Copy link
Copy Markdown
Collaborator

So, I usually say that flags are bad, but they are not that bad, to duplicate whole function body :)))

@Argmaster Argmaster marked this pull request as ready for review April 17, 2026 19:58
@Wunka Wunka moved this to Easy to Review in PRs to review Apr 19, 2026
Comment thread src/graphics.zig
return result;
}
pub fn readUnflippedFromFile(allocator: NeverFailingAllocator, path: []const u8) !Image {
pub fn readFromFile(allocator: NeverFailingAllocator, path: []const u8, options: struct { is_flipped_vertically: bool = false }) !Image {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn readFromFile(allocator: NeverFailingAllocator, path: []const u8, options: struct { is_flipped_vertically: bool = false }) !Image {
pub fn readFromFile(allocator: NeverFailingAllocator, path: []const u8, options: struct { isFlippedVertically: bool = true }) !Image {

Also previous default was true, since OpenGL wants them flipped.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default was true, but logically it is not what you expect.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add alias readFromFileOpenGl or something that by default flips the image.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an enum would be better?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const Orientation = enum {
	asIs,
	openGl,	
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@IntegratedQuantum IntegratedQuantum moved this from Easy to Review to In review in PRs to review Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants