Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Video support using SWT(To display a video clip in Eclipse view)
Video support using SWT [message #531455] Wed, 05 May 2010 04:32 Go to next message
vrush Mising nameFriend
Messages: 51
Registered: July 2009
Location: Pune
Member
Hi,

I have a view in eclipse where in I wish to show a clipping by handling pixel information. View initializes properly but fails to update in spite of setting new image to canvas.
I tried refreshing the view by hiding and showing the view where it updates the images properly but looses the smoothness.
Please provide any pointers.

Thanks in advance,
Vrushali.
Re: Video support using SWT [message #531752 is a reply to message #531455] Thu, 06 May 2010 03:39 Go to previous messageGo to next message
Praveen  is currently offline Praveen Friend
Messages: 86
Registered: July 2009
Member
Can you provide us the snippet for recreating this problem ? That should
be helpful in determining the problem further.
Re: Video support using SWT [message #531767 is a reply to message #531752] Thu, 06 May 2010 06:15 Go to previous messageGo to next message
vrush Mising nameFriend
Messages: 51
Registered: July 2009
Location: Pune
Member
I'm suppose to display a video clipping so to mock I have restricted the scope to viewing 4 different images in view one by one after a particular interval.

Added paint and control listeners.

paintListener calls method paint.

for(int i=0;i<4;i++){
System.out.println("filename\t" + path + arr[i]);
loadImage(path + arr[i]);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}

loadImage(String filename){
if (sourceImage != null && !sourceImage.isDisposed()) {
sourceImage.dispose();
sourceImage = null;
}
sourceImage = new Image(getDisplay(), filename);
}

private void paint(GC gc) {
Rectangle clientRect = getClientArea(); /* Canvas' painting area */
if (sourceImage != null) {
Rectangle imageRect =
SWT2Dutil.inverseTransformRect(transform, clientRect);
int gap = 2; /* find a better start point to render */
imageRect.x -= gap; imageRect.y -= gap;
imageRect.width += 2 * gap; imageRect.height += 2 * gap;

Rectangle imageBound = sourceImage.getBounds();
imageRect = imageRect.intersection(imageBound);
Rectangle destRect = SWT2Dutil.transformRect(transform, imageRect);

if (screenImage != null)
screenImage.dispose();
screenImage =
new Image(getDisplay(), clientRect.width, clientRect.height);
GC newGC = new GC(screenImage);
newGC.setClipping(clientRect);
newGC.drawImage(
sourceImage,
imageRect.x,
imageRect.y,
imageRect.width,
imageRect.height,
destRect.x,
destRect.y,
destRect.width,
destRect.height);
newGC.dispose();

gc.drawImage(screenImage, 0, 0);
System.out.println("updated");
} else {
gc.setClipping(clientRect);
gc.fillRectangle(clientRect);
initScrollBars();
}
}


If I debug, value of images changes correctly but fail to update view with those images. It directly shows last image out of those 4 images.

Please help with some pointers. Stuck badly.

Thanks a lot in advance,
Vrushali.
Re: Video support using SWT [message #532158 is a reply to message #531767] Fri, 07 May 2010 11:15 Go to previous message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
May be this snippet for showing animated gif will help you

http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.ecli pse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.jav a

(Its very unusual to have same question in a forum from different users Tomas has also the same questions,are you guys working on the same thing?)


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Previous Topic:Fasted way to display images?
Next Topic:SWT Table
Goto Forum:
  


Current Time: Fri Apr 26 16:47:23 GMT 2024

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

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

Back to the top