Package java.awt.image

Examples of java.awt.image.ImageProducer


     * Loads the image from the inputstream
     */
    protected void loadImage() {
        int[] tmpMap = null;
        try {
            ImageProducer ip = Jimi.getImageProducer(inputStream,
                                    Jimi.SYNCHRONOUS | Jimi.IN_MEMORY);
            FopImageConsumer consumer = new FopImageConsumer(ip);
            ip.startProduction(consumer);

            while (!consumer.isImageReady()) {
                Thread.sleep(500);
            }
            this.height = consumer.getHeight();
View Full Code Here


    protected boolean loadBitmap() {
        int[] tmpMap = null;
        try {
            URLConnection con = new DummyConnection(inputStream);

            ImageProducer ip = (ImageProducer) con.getContent();
            if (ip == null) {
                return false;
            }
            FopImageConsumer consumer = new FopImageConsumer(ip);
            ip.startProduction(consumer);

            //Load the image into memory
            while (!consumer.isImageReady()) {
                Thread.sleep(500);
            }
View Full Code Here

        int x = (width - iwidth) / 2;
        int y = (height - iheight) / 2;
        if (highlighted) {
          if (highlightedIcon == null) {
            ImageFilter filter = new HighlightedFilter();
            ImageProducer producer = new FilteredImageSource(icon.getSource(), filter);
            highlightedIcon = createImage(producer);
          }
          g.drawImage(highlightedIcon, x, y, this);
        } else
          g.drawImage(icon, x, y, this);
      }
      int[] lineBreaks = new int[3];
      int[] offx = new int[lineBreaks.length];
      int lbi = 0;
      Font font = new Font("SansSerif", Font.PLAIN, 11);
      g.setFont(font);
      FontMetrics fm = g.getFontMetrics();
      int em = fm.charWidth('m');
      int emlen = width / em;
      char[] nameChars = name.toCharArray();
      int chi = 0;
      while (chi < nameChars.length && lbi < lineBreaks.length) {
        int len = emlen;
        if (chi + len > nameChars.length)
          len = nameChars.length - chi;
        int chw = fm.charsWidth(nameChars, chi, len);
        if (chw > width) {
          while (len > 1) {
            len--;
            chw = fm.charsWidth(nameChars, chi, len);
            if (chw <= width)
              break;
          }
        } else {
          while (chi + len < nameChars.length) {
            len++;
            int chw1 = fm.charsWidth(nameChars, chi, len);
            if (chw1 > width) {
              len--;
              break;
            }
            chw = chw1;
          }
        }
        chi += len;
        offx[lbi] = (width - chw) / 2;
        lineBreaks[lbi++] = chi;
      }
      chi = 0;
      if (highlighted) {
        // g.setColor(new Color(0x4070C0));
        g2d.setPaint(new Color(0, 0.2f, 0.8f, 0.75f));
        Rectangle rect = new Rectangle(0, getHeight() - lineBreaks.length * fm.getHeight(), width, lbi
            * fm.getHeight());
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
        g2d.fill(rect);
        g.setColor(Color.white);
      }
      for (int line = 0; line < lbi; line++) {
        int chi1 = lineBreaks[line];
        int ty = getHeight() - fm.getDescent() - (lineBreaks.length - 1 - line) * fm.getHeight();
        g.drawString(name.substring(chi, chi1), offx[line], ty);
        chi = chi1;
      }
      if (group != null) {
        g.dispose();
        AlphaFilter filter = new AlphaFilter();
        filter.setLevel(0.5f);
        ImageProducer producer = new FilteredImageSource(group.getSource(), filter);
        Image filtered = createImage(producer);
        baseG.drawImage(filtered, 0, 0, null);
      }
    }
View Full Code Here

                } else {
                   return rgb;
                }
            }
        };
        ImageProducer ip = new FilteredImageSource(bi.getSource(), filter);
        Image img = Toolkit.getDefaultToolkit().createImage(ip);
        ColorModel colorModel = ColorModel.getRGBdefault();
        WritableRaster raster = colorModel.createCompatibleWritableRaster(img.getWidth(null), img.getHeight(null));
        String[] names = bi.getPropertyNames();
        Hashtable<String, Object> properties = new Hashtable<>(1 + (names != null ? names.length : 0));
View Full Code Here

TOP

Related Classes of java.awt.image.ImageProducer

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.