Skip to content

Add flipY option to StbImageLoader public API#2758

Merged
riccardobl merged 4 commits intomasterfrom
copilot/add-flipy-option-to-stbimageloader
May 10, 2026
Merged

Add flipY option to StbImageLoader public API#2758
riccardobl merged 4 commits intomasterfrom
copilot/add-flipy-option-to-stbimageloader

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

StbImageLoader lacked the public load(InputStream, boolean flipY) and load(byte[], boolean flipY) methods that AWTLoader exposed, blocking full deprecation of AWTLoader.

Changes

StbImageLoader (jme3-plugins)

  • Added public Image load(InputStream in, boolean flipY) and public Image load(byte[] data, boolean flipY) — core implementation delegates to STB's native flip support already used internally
  • Refactored load(AssetInfo) to delegate to load(InputStream, boolean) to eliminate duplication
// Now usable directly without going through the asset system
Image img = new StbImageLoader().load(inputStream, true /* flipY */);

TestBitmapFontLayout (jme3-examples)

  • Replaced deprecated AWTLoader with StbImageLoader, converting BufferedImage to PNG bytes via ImageIO.write() before passing to the loader

Copilot AI linked an issue May 9, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 9, 2026 22:59
Copilot AI changed the title [WIP] Add a flipY option to StbImageLoader.load method Add flipY option to StbImageLoader public API May 9, 2026
Copilot AI requested a review from riccardobl May 9, 2026 23:00
@riccardobl riccardobl marked this pull request as ready for review May 9, 2026 23:01

AWTLoader loader = new AWTLoader();
Image output = loader.load(scaled, false);
StbImageLoader loader = new StbImageLoader();
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.

Revert this, just keep using AWTLoader since this class is already using AWT everywhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in 09d0764. MipMapGenerator.java is back to using AWTLoader.


BufferedImage current = original;
AWTLoader loader = new AWTLoader();
StbImageLoader loader = new StbImageLoader();
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.

Revert this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in 09d0764.

converted = loader.load(new ByteArrayInputStream(baos.toByteArray()), false);
} catch (IOException e) {
throw new RuntimeException("Failed to convert image for mipmap level " + level, e);
}
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.

Revert this, keep using AWTLoader, since this class is already using awt everywhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in 09d0764.

Copilot AI requested a review from riccardobl May 9, 2026 23:06
@yaRnMcDonuts yaRnMcDonuts added this to the v3.10.0 milestone May 10, 2026
@riccardobl riccardobl merged commit a9e8462 into master May 10, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add a flipY option to StbImageLoader.load()

3 participants