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 #1794696] Wed, 05 September 2018 04:09
zhangyuxiang Mising name is currently offline zhangyuxiang Mising nameFriend
Messages: 12
Registered: March 2011
Junior Member
Use canvas to display video frames is too slow to display every frame in time.

Canvas code:
//canvas style
NO_BACKGROUND,NO_MERGE_PAINTS, NO_REDRAW_RESIZE,DOUBLE_BUFFERED

//painlistener
@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);

	        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();
	    }			
	}


Draw every frame time log:
Draw image: width=1910,height=969,time=203ms
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


See the log, draw image is too slow, how to improve draw image performance´╝č
Previous Topic:Canvas draw image slow
Next Topic:How to Force stop SWT Browser when it runs infinite java script.
Goto Forum:
  


Current Time: Sat Sep 22 11:36:14 GMT 2018

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

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

Back to the top