Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Canvas draw image slow
Canvas draw image slow [message #1794693] Wed, 05 September 2018 02:25
zhangyuxiang Mising name is currently offline zhangyuxiang Mising nameFriend
Messages: 12
Registered: March 2011
Junior Member
Use canvas to display video frame images is slow.

Canvas code:
//style
int style = SWT.NO_BACKGROUND | SWT. NO_MERGE_PAINTS | SWT. NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED;

//paint listener
	@Override
	public void paintControl(PaintEvent event) {
		ImageData imageData = getImageData();
		if(imageData != null) {	                
			event.gc.setAdvanced(true);
			event.gc.setAntialias(SWT.OFF);
	         		
	        org.eclipse.swt.graphics.Image image = new org.eclipse.swt.graphics.Image(canvas.getDisplay(), imageData);
	        //canvas.setBackgroundImage(iamge);

               long start = System.currentTimeMillis();
        	event.gc.drawImage(image, 0, 0);
	        	        	        
	        System.out.println("Draw image: width=" + imageData.width + ",height=" + imageData.height + 
	        		",time=" + (System.currentTimeMillis() - start) + "ms" );
	        
                 image.dispose();
	        
	    }			
	}


Result log:
Draw image: width=1910,height=969,time=160ms
Draw image: width=1910,height=969,time=157ms
Draw image: width=1910,height=969,time=162ms
Draw image: width=1910,height=969,time=167ms

Draw image: width=852,height=501,time=38ms
Draw image: width=852,height=501,time=42ms
Draw image: width=852,height=501,time=43ms
Draw image: width=852,height=501,time=40ms


When image width=1901,height=963, canvas draw image is too slow to display video frames
Previous Topic:Canvas draw image slow
Next Topic:Canvas draw image slow
Goto Forum:
  


Current Time: Tue Nov 13 05:32:45 GMT 2018

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

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

Back to the top