Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 226118 Details for
Bug 399109
GC: The background Pattern is not always transformed.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Snippet demonstrating the correct behavior.
SwtPatternCorrect.java (text/x-java), 1.81 KB, created by
Matthias Wienand
on 2013-01-25 11:51:54 EST
(
hide
)
Description:
Snippet demonstrating the correct behavior.
Filename:
MIME Type:
Creator:
Matthias Wienand
Created:
2013-01-25 11:51:54 EST
Size:
1.81 KB
patch
obsolete
>package org.eclipse.gef4.graphics.examples; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.PaintEvent; >import org.eclipse.swt.events.PaintListener; >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.graphics.Pattern; >import org.eclipse.swt.graphics.Transform; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >public class SwtPatternCorrect implements PaintListener { > public static void main(String[] args) { > new SwtPatternCorrect("SWT Pattern Test"); > } > > private Pattern pattern; > > public SwtPatternCorrect(String title) { > Display display = new Display(); > > final Shell shell = new Shell(display, SWT.SHELL_TRIM > | SWT.DOUBLE_BUFFERED); > shell.addPaintListener(this); > shell.setText(title); > shell.pack(); > shell.setBounds(0, 0, 400, 300); > shell.open(); > > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > > if (pattern != null) { > pattern.dispose(); > } > } > > public void paintControl(PaintEvent e) { > GC g = e.gc; > > if (pattern == null) { > Image image = new Image(e.display, 400, 300); > GC ig = new GC(image); > ig.setBackground(new org.eclipse.swt.graphics.Color(e.display, 64, > 64, 64)); > ig.fillRectangle(0, 0, 400, 300); > ig.setLineWidth(4); > for (int x = 0; x < 400; x += 25) { > ig.setForeground(new org.eclipse.swt.graphics.Color(e.display, > 64, (int) (255 * x / 400d), 64)); > ig.drawLine(x, 0, x, 300); > } > ig.dispose(); > pattern = new Pattern(e.display, image); > } > > g.setBackgroundPattern(pattern); > g.fillOval(0, 0, 100, 100); > > Transform transformSwt = new Transform(g.getDevice(), 1, 0, 0, 1, 100, > 100); > g.setTransform(transformSwt); > > g.setBackgroundPattern(null); > g.setBackgroundPattern(pattern); > > g.fillRectangle(0, 0, 100, 100); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 399109
: 226118 |
226119
|
226120
|
226121