Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » strange transform error(SWT Transform Pixel Shift Error)
strange transform error [message #635992] Thu, 28 October 2010 20:44 Go to next message
rhtcguru  is currently offline rhtcguru Friend
Messages: 2
Registered: October 2010
Junior Member
I've got this really annoying Transform artifact showing up in my graphical routines. I traced it down to a transform error. What happens is that drawing routines that are translated past horizontal pixel 255 get shifted by one pixel to the left. So, a line translated to 256 will draw at 255. 257 will draw at 256, etc. Same thing happens on verticle but at different value. I wrote a very simple code snippet to illustrate this problem. Two lines should be drawn with 1 pixel between them. However, the 2nd line translated to 257 wil draw at 256 which will be right next to the first line drawn at 255. Anyone know what the deal is with this?

import org.eclipse.swt.*;
public class MainClass {
public static void main(String[] args){
Display display = new Display();
Shell shell = new Shell(display);;
Canvas canvas = new Canvas(shell, SWT.NO_BACKGROUND);
GC gc = new GC(canvas);
Transform t1 = new Transform(gc.getDevice());
while( !shell.isDisposed()){

[Updated on: Thu, 28 October 2010 20:45]

Report message to a moderator

Re: strange transform error [message #636125 is a reply to message #635992] Fri, 29 October 2010 12:17 Go to previous message
Lakshmi ShanmugamFriend
Messages: 276
Registered: July 2009
Location: India
Senior Member

I ran your example snippet on my windows xp machine and it worked fine for me. The lines are drawn correctly at 255 and 257 with a gap between them. Which version of SWT/eclipse are you using. Also on which platform do you see this problem?

Lakshmi P Shanmugam
Previous Topic:Table & Tableviewer column pack
Next Topic:GroupLayout or FormLayout?
Goto Forum:

Current Time: Mon Aug 03 19:32:59 GMT 2020

Powered by FUDForum. Page generated in 0.01995 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top