Community
Participate
Working Groups
ScaledGraphics throws an exception when setting background patterns. This causes problems for overview panes and zooming on diagrams.
There is no way to scale a pattern, so the solution will not be in scaled graph, which does emulated scaling. Thumbnail figure could take an option to use native vs. emulated scaling. Do you care to provide a patch?
That would leave the Scalable Panes still busted, right?
Correct. So the best usage scenario would be to set emulated/native scaling on the GraphicalViewer using a viewer property. Then, the scalablerooteditpart and overview figure would both pick up that value somehow.
My boss finally okayed me to work on a patch for this, but not until after our product release in mid april.
This bug seems to have gone nowhere. Currently I work around it by detecting whether I've got a ScalableEditPart and turning off the linear gradient fill. What would it take to create a patch? Give me some idea and I will code it up.
Mark, see comment 3. The approach is not to change ScaledGraphics, but avoid its usage altogether.
Question for Mark Gobeil: I noticed that in 267728 you added setBackgroundPattern() to ScaledGraphics in GEF. I assume that that resolves this defect? Also, please check 184651, I beleive that 267728 resolves that one too.
Setting background pattern on ScaledGraphics seems to have been resolved by the fixes applied under bug #267728. Resolving this as WORKSFORME.
This doesn't work actually in zoom states. The coordinates in the Pattern is not zoomed as other methods in ScaledGraphics. This will cause problem in zoom states.
OK, I have a workaround. You can use the below method to create your pattern: public static Pattern createScaledPattern(Graphics graphics, Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { double scale = graphics.getAbsoluteScale(); return new Pattern(device, (int) (x1 * scale), (int) (y1 * scale), (int) (x2 * scale), (int) (y2 * scale), color1, alpha1, color2, alpha2); } public static Pattern createScaledPattern(Graphics graphics, Device device, float x1, float y1, float x2, float y2, Color color1, Color color2) { double scale = graphics.getAbsoluteScale(); return new Pattern(device, (int) (x1 * scale), (int) (y1 * scale), (int) (x2 * scale), (int) (y2 * scale), color1, color2); }