Exemplo n.º 1
0
  private static void setBrightness() {
    if (image.isDisposed()) {
      return;
    }

    ImageData imageData = image.getImageData();

    for (int x = 0; x < imageData.width; x++) {
      for (int y = 0; y < imageData.height; y++) {
        RGB rgb = imageData.palette.getRGB(imageData.getPixel(x, y));
        float[] hsb = rgb.getHSB();

        hsb[2] = hsb[2] + 0.1f;
        if (hsb[2] > 1.0f) {
          hsb[2] = 1.0f;
        }

        //				hsb[1] = hsb[1] - 0.1f;
        //				if (hsb[1] < 0.0f) {
        //					hsb[1] = 0.0f;
        //				}
        RGB newRGB = new RGB(hsb[0], hsb[1], hsb[2]);

        int pixel = imageData.palette.getPixel(newRGB);
        imageData.setPixel(x, y, pixel);
      }
    }

    image.dispose();
    image = new Image(Display.getDefault(), imageData);

    imageFigure.setImage(image);
  }
Exemplo n.º 2
0
 /**
  * Returns a figure corresponding to this image
  *
  * @param image a image
  * @return a figure corresponding to this image
  */
 public IFigure getFigure(Image image) {
   IMapMode mm =
       MapModeUtil.getMapMode(
           ((IGraphicalEditPart) getDecoratorTarget().getAdapter(IGraphicalEditPart.class))
               .getFigure());
   ImageFigure fig = new ImageFigure();
   fig.setImage(image);
   fig.setSize(mm.DPtoLP(image.getBounds().width), mm.DPtoLP(image.getBounds().height));
   return fig;
 }
  public DashboardFigure() {
    imgReg = Activator.getDefault().getImageRegistry();
    add(
        logoFigure =
            new ImageFigure() {

              @Override
              protected void paintFigure(Graphics graphics) {
                if (getImage() != null) {
                  graphics.drawImage(
                      getImage(), new Rectangle(getImage().getBounds()), getBounds());
                }
              }
            });
    Image logoImage = imgReg.get(Activator.IMG_MDA_ID);
    if (logoImage != null) {
      logoFigure.setImage(logoImage);
    }
    initFigure.setSize(20, 20);
    initFigure.setBackgroundColor(DASHBOARD_FG);
    add(initFigure);
    add(methodoFigure = createMethodologyFigure("Methodology"));
    add(processFigure = createProcessFigure("Process"));
    endFigure.setSize(20, 20);
    endFigure.setBackgroundColor(DASHBOARD_FG);
    add(endFigure);
    add(init2methoFlow = createFlowFigure(true));
    add(metho2processFlow = createFlowFigure(true));
    add(process2endFlow = createFlowFigure(true));
    add(statusFigure = new Figure());
    statusFigure.setFont(JFaceResources.getBannerFont());
    ToolbarLayout statusLayout = new ToolbarLayout();
    statusLayout.setStretchMinorAxis(false);
    statusFigure.setLayoutManager(statusLayout);
    statusFigure.add(new Label());
    statusFigure.add(new Label());
    setLayoutManager(new DashboardLayout());
    setBorder(new MarginBorder(10));
    setBackgroundColor(DASHBOARD_BG);
    setForegroundColor(DASHBOARD_FG);
  }
Exemplo n.º 4
0
 public void setImage(Image img) {
   radioBt.setImage(img);
 }