Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Image


      if ( bufferImage != null && ! bufferImage.isDisposed()){
       
        bufferImage.dispose();
      }
     
      bufferImage = new Image( canvas.getDisplay(), bounds );

      GC image = new GC( bufferImage );

      int  max_x = 0;
      int  max_y = 0;
View Full Code Here


  protected Graphic
  loadGraphic(
    UISWTInstance  swt,
    String      name )
  {
    Image  image = swt.loadImage( "com/aelitis/azureus/ui/images/" + name );

    Graphic graphic = swt.createGraphic(image );
   
    icon_list.add( graphic );
   
View Full Code Here

          size = toolTipLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
          if (size.x > 600) {
            size = toolTipLabel.computeSize(600, SWT.DEFAULT, true);
          }
        } else if (oToolTip instanceof Image) {
          Image image = (Image) oToolTip;
          toolTipLabel = new Label(toolTipShell, SWT.CENTER);
          toolTipLabel.setForeground(d.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
          toolTipLabel.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
          toolTipShell.setData("TableCellSWT", cell);
          toolTipLabel.setImage(image);
View Full Code Here

    for (Iterator iter = mapIDs.keySet().iterator(); iter.hasNext();) {
      String key = (String) iter.next();
      String value = (String) mapIDs.get(key);

     
      Image img = imageLoader.getImage(value);
      imagesToRelease.add(value);

      CLabel lbl = new CLabel(window, SWT.NONE);
      lbl.setImage(img);
      lbl.setText(MessageText.getString("health.explain." + key));
View Full Code Here

   *
   * @since 4.0.0.5
   */
  public static Image loadImage(final long contentNetworkID,
      final ContentNetworkImageLoadedListener cnImageLoadedListener) {
    Image image = mapImages.get(new Long(contentNetworkID));
    if (image != null && cnImageLoadedListener != null) {
      cnImageLoadedListener.contentNetworkImageLoaded(contentNetworkID, image, true);
      return image;
    }

    ContentNetwork cn = ContentNetworkManagerFactory.getSingleton().getContentNetwork(
        contentNetworkID);
    if (cn == null) {
      return image;
    }
    String imgURL = ContentNetworkUtils.getUrl(cn, ContentNetwork.SERVICE_GET_ICON);
    if (imgURL != null) {
      final File cache = new File(SystemProperties.getUserPath(), "cache"
          + File.separator + imgURL.hashCode() + ".ico");
      boolean loadImage = true;
      if (cache.exists()) {
        try {
          FileInputStream fis = new FileInputStream(cache);

          try {
            byte[] imageBytes = FileUtil.readInputStreamAsByteArray(fis);
            InputStream is = new ByteArrayInputStream(imageBytes);
            image = new Image(Display.getCurrent(), is);
            try {
              is.close();
            } catch (IOException e) {
            }
            mapImages.put(new Long(contentNetworkID), image);
            if (cnImageLoadedListener != null) {
              cnImageLoadedListener.contentNetworkImageLoaded(contentNetworkID,
                  image, true);
            }
          } finally {
            fis.close();
          }
          loadImage = false;
        } catch (Throwable e) {
          Debug.printStackTrace(e);
        }

      }
      if (loadImage) {
        ImageBytesDownloader.loadImage(imgURL,
            new ImageBytesDownloader.ImageDownloaderListener() {
              public void imageDownloaded(final byte[] imageBytes) {
                Utils.execSWTThread(new AERunnable() {
                  public void runSupport() {
                    FileUtil.writeBytesAsFile(cache.getAbsolutePath(),
                        imageBytes);
                    InputStream is = new ByteArrayInputStream(imageBytes);
                    Image image = new Image(Display.getCurrent(), is);
                    try {
                      is.close();
                    } catch (IOException e) {
                    }
                    mapImages.put(new Long(contentNetworkID), image);
View Full Code Here

 
  public void cellPaint(GC gc, TableCellSWT cell) {
    Rectangle bounds = cell.getBounds();
   
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image viewImage = imageLoader.getImage("ic_view");
    if(imageWidth == -1 || imageHeight == -1) {
      imageWidth = viewImage.getBounds().width;
      imageHeight = viewImage.getBounds().height;
    }
   
    bounds.width -= (imageWidth + 5);
   
    GCStringPrinter.printString(gc, cell.getSortValue().toString(), bounds,true,false,SWT.LEFT);
View Full Code Here

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void cellPaint(GC gc, final TableCellSWT cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();

    Image imgIcon = null;
    String iconID = entry.getIconID();
    if (iconID != null) {
      ImageLoader imageLoader = ImageLoader.getInstance();
      if (iconID.startsWith("http")) {
        imgIcon = imageLoader.getUrlImage(iconID,
            new ImageDownloaderListener() {
              public void imageDownloaded(Image image,
                  boolean returnedImmediately) {
                if (returnedImmediately) {
                  return;
                }
                cell.invalidate();
              }
            });
        if (imgIcon == null) {
          return;
        }
      } else {
        imgIcon = imageLoader.getImage(iconID);
      }

      if (ImageLoader.isRealImage(imgIcon)) {
        Rectangle cellBounds = cell.getBounds();
        Rectangle imgBounds = imgIcon.getBounds();
        gc.drawImage(imgIcon, cellBounds.x
            + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y
            + ((cellBounds.height - imgBounds.height) / 2));
      }
      imageLoader.releaseImage(iconID);
View Full Code Here

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void cellPaint(GC gc, TableCellSWT cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();

    Rectangle cellBounds = cell.getBounds();
    Image img = entry.getReadOn() <= 0 ? imgNew : imgOld;

    if (img != null && !img.isDisposed()) {
      Rectangle imgBounds = img.getBounds();
      gc.drawImage(img, cellBounds.x
          + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y
          + ((cellBounds.height - imgBounds.height) / 2));
    }
  }
View Full Code Here

    String thumbnailUrl = PlatformTorrentUtils.getContentThumbnailUrl(torrent);

    //System.out.println("thumburl= " + thumbnailUrl);
    if (thumbnailUrl != null && imageLoaderThumb.imageExists(thumbnailUrl)) {
      //System.out.println("return thumburl");
      Image image = imageLoaderThumb.getImage(thumbnailUrl);
      l.contentImageLoaded(image, true);
      return new Image[] { image };
    }

    String hash = null;
    try {
      hash = torrent.getHashWrapper().toBase32String();
    } catch (TOTorrentException e) {
    }
    if (hash == null) {
      l.contentImageLoaded(null, true);
      return null;
    }

    final String id = "Thumbnail." + hash;

    Image image = imageLoaderThumb.imageAdded(id) ? imageLoaderThumb.getImage(id) : null;
    //System.out.println("image = " + image);
    if (image != null && !image.isDisposed()) {
      l.contentImageLoaded(image, true);
      return new Image[] { image };
    }

    final byte[] imageBytes = PlatformTorrentUtils.getContentThumbnail(torrent);
    //System.out.println("imageBytes = " + imageBytes);
    if (imageBytes != null) {
      image = (Image) Utils.execSWTThreadWithObject("thumbcreator",
          new AERunnableObject() {
            public Object runSupport() {

              ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
              Image image = new Image(Display.getDefault(), bis);

              return image;
            }
          }, 500);
    }
/**
    if ((image == null || image.isDisposed()) && thumbnailUrl != null) {
      //System.out.println("get image from " + thumbnailUrl);
      image = imageLoader.getUrlImage(thumbnailUrl,
          new ImageDownloaderListener() {
            public void imageDownloaded(Image image, boolean returnedImmediately) {
              l.contentImageLoaded(image, returnedImmediately);
              //System.out.println("got image from thumburl");
            }
          });
      //System.out.println("returning " + image + " (url loading)");
      return image == null ? null : new Image[] { image };
    }
**/
    if (image == null || image.isDisposed()) {
      //System.out.println("build image from files");
      DownloadManager dm = DataSourceUtils.getDM(datasource);
      /*
       * Try to get an image from the OS
       */
 
View Full Code Here

      Rectangle lastClipping = gc.getClipping();
      try {
        gc.setClipping(cellBounds);

        for (int i = 0; i < imgThumbnail.length; i++) {
          Image image = imgThumbnail[i];
          Rectangle srcBounds = image.getBounds();
          if (i == 0) {
            int w = dstWidth;
            int h = dstHeight;
            if (imgThumbnail.length > 1) {
              w = w * 9 / 10;
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.