-
Notifications
You must be signed in to change notification settings - Fork 192
Migrate all SWT-OldSchoolEffect examples to GraphicsExample #3189
Copy link
Copy link
Open
Description
Problem Statement
Migrate all remaining effects from SWT-OldSchoolEffect to the SWT GraphicsExample framework. Starfield and Ripple are already migrated (PR #3157, #3165). Each effect must become a *Tab.java class extending AnimatedGraphicsTab, registered in GraphicsExample.java, with localized strings in examples_graphics.properties.
Migration Pattern (from PR #3157 and #3165)
Each effect migration follows these steps:
- Create
<Effect>Tab.javaextendingAnimatedGraphicsTabinexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ - Override:
getCategory()→ "Misc",getText(),getDescription(),getInitialAnimationTime(),next(),paint() - If the effect uses images: copy image to the graphics package dir and use
example.loadImage(device, "name.ext") - If the effect allocates Images/GC/etc: dispose them properly in
dispose() - Add localized strings to
src/examples_graphics.properties - Register the tab in
GraphicsExample.javacreateTabs()method - Ensure the build compiles without errors
Build Verification
Before submitting a PR, the following command must succeed without errors or warnings:
mvn clean verify -Dnative=gtk.linux.x86_64 -DskipTestsPR Review Checklist (from feedback on #3157 and #3165)
Each migrated effect MUST satisfy:
- No Color disposal — Colors do not need to be disposed in modern SWT. Use
new Color(r, g, b)freely without.dispose(). - Use simple Color constructor — Use
new Color(r, g, b)notnew Color(display, r, g, b). Examples have been cleaned to use the simpler constructor. - Dispose Images —
Imageobjects MUST be disposed (indispose()override or before recreation). - Dispose GC —
GCobjects MUST be disposed after use. - No compiler errors or warnings — Build must succeed without warnings/errors.
- Use
$NON-NLS-1$markers — All string literals used for resource keys need NLS markers. - Proper copyright header — EPL-2.0 header with original author credit.
- Category = "Misc" — All old-school effects go in the Misc category.
- Localized strings — All user-visible text via
examples_graphics.properties. - Inner classes for helpers — If the effect needs helper types (e.g., Star, Particle), use static inner classes rather than separate files where possible.
Migration Progress
Phase 1: Pure Algorithmic Effects (no images needed)
- Starfield —
starfield/→ StarfieldTab (PR Migrate Starfield example to Graphics Example #3157) - Blob —
blob/Blob.java→ BlobTab - Burning Sea —
burningsea/BurningSea.java→ BurningSeaTab - Copper Bars —
copper/Coppers.java→ CopperBarsTab - Explosion —
explosion/Explosion.java+Particle.java→ ExplosionTab - Fire —
fire/Fire.java→ FireTab - Mandelbrot —
mandelbrot/Mandelbrot.java→ MandelbrotTab - Moiré —
moire/Moire.java→ MoireTab - Plasma —
plasma/Plasma.java→ PlasmaTab - Raster Bars —
rasterbars/RasterBars.java→ RasterBarsTab - Shade Bobs —
shadebobs/ShadeBobs.java→ ShadeBobsTab - Twister —
twister/Twister.java→ TwisterTab - Wave —
wave/WaveEffect.java→ WaveTab - Dancing (no light) —
Dancing/nolight/*.java→ DancingTab
Phase 2: Image-Based Effects (single image)
- Ripple —
ripple/→ RippleTab (PR Migrate Ripple effect to Graphics Example #3165) - Bump Mapping —
bump/Bump.java+bump.png→ BumpMappingTab - Flat Text —
flattext/FlatText.java+TEXFLAT2.png→ FlatTextTab - Lake —
lake/LakeEffect.java+ash.jpg→ LakeTab - Lens —
Lens/Lens.java+tuxblackbg.png→ LensTab - Block Effect —
rayfilter/BlockEffect.java+flower.jpg→ BlockEffectTab - Twirl Effect —
rayfilter/TwirlEffect.java+flower.jpg→ TwirlEffectTab - Sine Wave —
sinewave/SineWave.java+SinEffect.java+tuxblackbg.png→ SineWaveTab - Sky —
sky2/Sky2.java+DEMO2.png→ SkyTab - Unlimited Balls —
unlimitedballs/UnlimitedBalls.java+ball.gif→ UnlimitedBallsTab - Warp —
warp/Warp.java+texture.png→ WarpTab - Wobble —
wobble/WobbleEffect.java+bu.jpg→ WobbleTab - Wormhole —
wormhole/Wormhole.java+texture.png→ WormholeTab - Dancing (with light) —
Dancing/light/*.java→ DancingLightTab
Phase 3: Complex Effects (multiple images or helper classes)
- RotoZoom —
rotozoom/RotoZoom.java+tux256256.png+tile.png→ RotoZoomTab - Tunnel —
tunnel/Tunnel1.java+ tunnel textures → TunnelTab - Voxel —
voxel/Voxel.java+ 3 images → VoxelTab - Sine Scroll —
SineScroll/SineScroll.java+Star.java+font_classic_16x16.gif→ SineScrollTab - Simple Scroll —
scrolls/SimpleScroll.java+ helpers → SimpleScrollTab - Advanced Scroll —
scrolls/AdvancedScroll.java+ helpers → AdvancedScrollTab - Star Wars Scroll —
scrolls/StarwarsScroll.java+ helpers → StarWarsScrollTab
Excluded
SpecialImage/SpecialImageLoader.java— Utility class, not an effect- Helper classes (
Star.java,ImageMath.java,TransformFilter.java,PerspectiveFilter.java,SinEffect.java,Particle.java) — Will become inner classes
Notes
- Each effect should be its own commit/PR for easy review
- The Scrolls group (Simple, Advanced, StarWars) share helper classes (
TransformFilter,PerspectiveFilter,ImageMath) — these should be shared inner classes or a single utility, migrated together - Dancing has two variants (light/no-light) that share
PlanIso/PointIso— consider merging or migrating together - Total: 31 effects to migrate
- Background: these examples are useful for testing the SKIA Canvas work and highlight different aspects of the Canvas
- Original author @lcaron has given permission (see Migrate to SWT GraphicsExamples standard lcaron/SWT-OldSchoolEffect#3)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels