Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Updating images in view in background(How to update images in view in background)
Updating images in view in background [message #533475] Fri, 14 May 2010 07:46 Go to next message
vrush Mising nameFriend
Messages: 51
Registered: July 2009
Location: Pune
Member
Hi,

I'm looking forward to provide a video support within eclipse. Till now managed to have a view with continueosly updating images with endless stream.
Everything works well till this point. But when I change focus to some other view or click anywhere within the eclipse, it hangs. It cannot even come back to video view. There are no listeners in the code. I'm simply changing background images in the loop.

Stuck since long. Please provide any pointers. Badly stuck

Thanks in advance,
Vrushali.
Re: Updating images in view in background [message #533476 is a reply to message #533475] Fri, 14 May 2010 07:51 Go to previous message
vrush Mising nameFriend
Messages: 51
Registered: July 2009
Location: Pune
Member
Attaching code for previous thread

public class SampleView_1 extends ViewPart {

public Canvas imageCanvas;
private Action change_image;
private Image sourceImage;
@Override
public void createPartControl(Composite parent) {
imageCanvas=new Canvas(parent, SWT.BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
imageCanvas.setBackgroundImage(new Image(parent.getDisplay(), "C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Blue hills.jpg"));
makeActions();
contributeToActionBars();
}


private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
fillLocalToolBar(bars.getToolBarManager());
}


private void fillLocalToolBar(IToolBarManager manager) {
manager.add(change_image);
}

private void makeActions() {
change_image = new Action() {
public void run() {
ChangeImage();
}
};
change_image.setText("Change Image");
change_image.setToolTipText("Change Image");
change_image.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().
getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));

}

private void ChangeImage() {
/*String path = "C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/";
String arr[] = new String[]{"/Blue hills.jpg","/Sunset.jpg","/Water lilies.jpg","/Winter.jpg"};

for(int i=0;i<4;i++){
imageCanvas.setBackgroundImage(new Image(imageCanvas.getDisplay(), path + arr[i]));
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}*/
/* IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IViewPart viewPart = window.getActivePage().findView(
"lcdview.views.SampleView_1");
Shell shell = viewPart.getSite().getShell();
*/
PaletteData palette[] = new PaletteData[5];
palette[0] = new PaletteData(0, 0, 0);//new PaletteData(0xff, 0xff00, 0xff0000);
palette[1] = new PaletteData(0, 0, 1);//new PaletteData(0xff00, 0xff0000, 0xff);
palette[2] = new PaletteData(0, 1, 0);//new PaletteData(0xff0000, 0xff, 0xff00);
palette[3] = new PaletteData(1, 0, 0);//new PaletteData(0xff, 0xff00, 0xff0000);
palette[4] = new PaletteData(0, 0, 1);//new PaletteData(0xff00, 0xff0000, 0xff);

int i=0;
while(true){
ImageData hueData = new ImageData(1024, 720, 24, palette[i]);
float hue = 0;
for (int x = 0; x < hueData.width; x++) {
for (int y = 0; y < hueData.height; y++) {
int pixel = palette[i].getPixel(new RGB(hue, 1f, 1f));
hueData.setPixel(x, y, pixel);
}
hue += 360f / hueData.width;
}
Image hueImage = new Image(imageCanvas.getDisplay(), hueData);
sourceImage = hueImage;
imageCanvas.setBackgroundImage(sourceImage);
imageCanvas.update();
// shell.setBackgroundImage(sourceImage);
// shell.update();
if(i%4 == 0)
i = 0;
i++;
}
}

@Override
public void setFocus() {

}

}


Am i missing anything there?

Thanks,
Vrushali.
Previous Topic:eclipse debugger: current instruction pointer problem.
Next Topic:Eclipse Running Under Android
Goto Forum:
  


Current Time: Sat Nov 22 10:42:31 GMT 2014

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

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