Skip to content

Add WebP image format infrastructure#15

Draft
Copilot wants to merge 7 commits intomasterfrom
copilot/add-webp-image-format
Draft

Add WebP image format infrastructure#15
Copilot wants to merge 7 commits intomasterfrom
copilot/add-webp-image-format

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 5, 2025

WebP format is currently only supported on GTK (via native GdkPixbuf). This adds cross-platform WebP recognition to SWT.

Changes

  • Added IMAGE_WEBP constant (value 9) to SWT.java
  • Created WebPFileFormat - Detects RIFF/WEBP signature and delegates to decoder
  • Created WebPDecoder - Parses VP8/VP8L/VP8X headers, extracts dimensions and metadata
  • Registered format in FileFormat factory
  • Added tests for format detection and invalid file rejection

Implementation Notes

VP8/VP8L codec decoding is not implemented (returns ERROR_NOT_IMPLEMENTED). Full decoder requires ~50k lines similar to libwebp. Current implementation provides:

  • Format recognition across all platforms
  • Structure ready for decoder implementation (in-tree or via service loader)
  • Clear error messaging

Example:

ImageLoader loader = new ImageLoader();
loader.load("image.webp"); // Throws SWTException with ERROR_NOT_IMPLEMENTED

Future decoder can be added via:

  1. Direct VP8/VP8L implementation (~15-30k lines)
  2. Integration with webp-imageio library
  3. Service loader pattern (similar to SVG)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • repo.eclipse.org
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.9-10/x64/bin/java --enable-native-access=ALL-UNNAMED -classpath /opt/hostedtoolcache/maven/3.9.11/x64/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/opt/hostedtoolcache/maven/3.9.11/x64/bin/m2.conf -Dmaven.home=/opt/hostedtoolcache/maven/3.9.11/x64 -Dlibrary.jansi.path=/opt/hostedtoolcache/maven/3.9.11/x64/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/eclipse.platform.swt/eclipse.platform.swt org.codehaus.plexus.classworlds.launcher.Launcher clean verify -DskipTests (dns block)
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.9-10/x64/bin/java --enable-native-access=ALL-UNNAMED -classpath /opt/hostedtoolcache/maven/3.9.11/x64/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/opt/hostedtoolcache/maven/3.9.11/x64/bin/m2.conf -Dmaven.home=/opt/hostedtoolcache/maven/3.9.11/x64 -Dlibrary.jansi.path=/opt/hostedtoolcache/maven/3.9.11/x64/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/eclipse.platform.swt/eclipse.platform.swt org.codehaus.plexus.classworlds.launcher.Launcher clean compile -DskipTests (dns block)
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.9-10/x64/bin/java --enable-native-access=ALL-UNNAMED -classpath /opt/hostedtoolcache/maven/3.9.11/x64/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/opt/hostedtoolcache/maven/3.9.11/x64/bin/m2.conf -Dmaven.home=/opt/hostedtoolcache/maven/3.9.11/x64 -Dlibrary.jansi.path=/opt/hostedtoolcache/maven/3.9.11/x64/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/eclipse.platform.swt/eclipse.platform.swt org.codehaus.plexus.classworlds.launcher.Launcher test -Dtest=Test_WebP_Format (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Implement WebP format

We have a request (eclipse-platform#2734) to implement WebP Format https://en.wikipedia.org/wiki/WebP in SWT

Currently it is only supported on GTK so it would be good to implement it directly in SWT as a new Image Format as we already have for PNGFileFormat and similar already.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits November 5, 2025 12:30
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
…Bytes efficiency

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add WebP image format support to SWT Add WebP image format infrastructure Nov 5, 2025
Copilot AI requested a review from laeubi November 5, 2025 12:58
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.

2 participants