-
Notifications
You must be signed in to change notification settings - Fork 2
Closed as not planned
Closed as not planned
Copy link
Description
Summary
Implement JPEG output backend similar to the existing PNG backend, following single responsibility principle by extracting common raster graphics functionality.
Background
Currently we have a PNG backend that works well for animation streaming and static image output. We need to add JPEG support while maintaining clean architecture.
Requirements
-
JPEG Backend Implementation
- Create
fortplot_jpeg.f90
module similar tofortplot_png.f90
- Support JPEG compression with quality settings
- Maintain same API pattern as PNG backend (
create_jpeg_canvas
,get_jpeg_data
)
- Create
-
Extract Common Raster Functionality (Single Responsibility Principle)
- Current PNG backend has raster-specific code mixed with PNG-specific code
- Extract common raster operations into shared module
- Both PNG and JPEG backends should use shared raster base
-
Architecture Requirements
- Follow existing pattern in
fortplot_animation.f90
for backend-agnostic rendering - Support memory-based JPEG generation for animation streaming
- Maintain compatibility with existing PNG functionality
- Follow existing pattern in
Proposed Structure
src/fortplot_raster_base.f90 # Common raster operations
src/fortplot_png.f90 # PNG-specific encoding (refactored)
src/fortplot_jpeg.f90 # New JPEG encoding
Reference Implementation
Use STB image library as reference for JPEG encoding:
https://github.com/nothings/stb/blob/master/stb_image.h
STB provides a clean, single-header implementation that can guide our Fortran JPEG encoder.
Implementation Notes
- Use libjpeg or similar for JPEG compression
- Maintain same quality as PNG for scientific visualization
- Follow TDD approach with tests first
- Reference matplotlib JPEG backend for quality standards
Acceptance Criteria
- JPEG backend creates valid JPEG files
- Animation streaming works with JPEG frames
- Common raster functionality extracted to shared module
- All existing PNG functionality remains working
- Tests cover JPEG output quality and correctness
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels