Bug 286056 - [Graphics] Add multi-stop Pattern to SWT
Summary: [Graphics] Add multi-stop Pattern to SWT
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2009-08-08 20:14 EDT by Kirill Grouchnikov CLA
Modified: 2017-07-28 10:10 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kirill Grouchnikov CLA 2009-08-08 20:14:06 EDT
Build ID: I20090611-1540

Steps To Reproduce:
Currently, SWT's Pattern class can only be created with two stops (points). This has been the case with JDK's GradientPaint up until JDK 1.6 which has added LinearGradientPaint. This class comes in very handy for creating modern multi-stop gradient fills.

Looking at the Pattern implementation - specifically line 197:

			Gdip.LinearGradientBrush_SetInterpolationColors(handle, new int /*long*/ []{foreColor, midColor, backColor}, new float[]{0, 0.5f, 1}, 3);

it does seem that the internal SWT classes do support multi-stop patterns.

Here is a use case:

https://pushingpixels.dev.java.net/images/granite/albumloading.png

This shows a progress bar that uses four-stop painting of the stripes. I cannot use the two 2-stop patterns and paint it as separate lines, since the seam between the two lines will not be horizontal. As it stands now, i need to create two 2-stop patterns, and a polygon for each one of them.

Ideally, i would create a 4-stop pattern, set line attributes to paint a thick line and just paint one line.

More information:
Comment 1 Eric Williams CLA 2017-07-28 10:10:57 EDT
Patches are welcome. :)