Skip to content

docs(gd): refine GD module plan based on jcpan -t Chart investigation#562

Merged
fglock merged 1 commit intomasterfrom
docs/gd-plan-update
Apr 26, 2026
Merged

docs(gd): refine GD module plan based on jcpan -t Chart investigation#562
fglock merged 1 commit intomasterfrom
docs/gd-plan-update

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 26, 2026

Summary

Refines dev/modules/gd.md based on the jcpan -t Chart investigation. No code changes.

Key updates:

  • Phase split: Phase 1 is now truecolor-only MVP; new Phase 1.5 covers palette mode (IndexColorModel rebuild). Lets us unblock Chart / GD::Graph sooner without bogging Phase 1 down on Java's immutable palette model.
  • Risk-rated effort table added so each area has an explicit Low/Medium label and an hours/days estimate.
  • make devmake (per AGENTS.md, make dev was disabled).
  • Module loading convention documented: PerlOnJava's existing native-XS modules (DateTime, HTMLParser, Compress::Zlib, …) register Perl-visible symbols from Java initialize(); the upstream bootstrap GD line should just be dropped, not rewritten as XSLoader::load.
  • Headless flag must be set before any BufferedImage/Graphics2D is touched (AWT latches it on first use).
  • Bitmap fonts: commit to embedding GD's static byte arrays (~5-10 KB total) instead of approximating with java.awt.Font("Monospaced", …). The approximation is host-dependent and breaks GD::Graph axis alignment.
  • GIF write: noted as stock JDK since Java 6 (LZW patent expired) so nobody bikesheds it.
  • Verify targets: Phase 1 acceptance is ./jcpan -t GD (the upstream distribution's own t/); ./jcpan -t Chart becomes the Phase 1.5 / Phase 2 integration check.
  • Alternatives Considered section added, documenting why CLI wrapper, JNI/FFI to libgd, SVG-only, and stub-only were rejected, and why a jcpan -t missing-XS skip-list is worth doing as a complementary UX fix.

Test plan

  • Docs-only change; no code touched
  • git diff reviewed for accuracy

Generated with Devin

- Add risk-rated effort breakdown table
- Split Phase 1 into truecolor MVP + Phase 1.5 palette mode (palette
  is the trickiest piece; defer it so Chart can be unblocked sooner)
- Replace `make dev` with `make` (per AGENTS.md)
- Document module-loading convention: register Perl symbols in Java
  `initialize()` rather than rewriting `bootstrap GD` as XSLoader
- Note headless mode must be set before any AWT/BufferedImage use
- Commit to embedding GD's bitmap fonts as static byte arrays (not
  AWT Monospaced approximation) for pixel-correct GD::Graph/Chart
- Note GIF write is in stock JDK since Java 6 (no patent issue)
- Switch Phase 1 verify target from hand-rolled snippet to
  `jcpan -t GD`; `jcpan -t Chart` becomes the Phase 1.5/2 integration
  check
- Add "Alternatives Considered" section recording rejected options
  (CLI wrapper, JNI/FFI, SVG-only, stub-only, skip-list as
  complementary)

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit 2c7f379 into master Apr 26, 2026
2 checks passed
@fglock fglock deleted the docs/gd-plan-update branch April 26, 2026 14:57
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.

1 participant