kirill-grouchnikov / radiance

Building modern, elegant and fast Swing applications
BSD 3-Clause "New" or "Revised" License
807 stars 89 forks source link

[Theming] Revisit how specular fill painter is configured #429

Closed kirill-grouchnikov closed 2 years ago

kirill-grouchnikov commented 2 years ago

This is a followup to https://github.com/kirill-grouchnikov/radiance/issues/393 and https://github.com/kirill-grouchnikov/radiance/issues/427

StandardFillPainter is the base class for all Radiance fill painters that wish to paint an emulated specular shine along the top part of the buttons and other components. Instead of encoding this functionality into that base class, extract it into a wrapper SpecularRectangularFillPainter that can accept any fill painter to then draw the specular shine on top of what that base fill painter does.

So instead of

this.fillPainter = new MatteFillPainter();

it becomes

this.fillPainter = new SpecularRectangularFillPainter(new MattePainter(), 1.0f);

Where the second parameter controls the alpha of the shine.