Package java.awt

Examples of java.awt.Graphics2D.dispose()


       * applying the AffineTransform that we calculated above during
       * rendering so the pixels from the old position to the new
       * transposed positions are mapped correctly.
       */
      g2d.drawImage(result, tx, null);
      g2d.dispose();

      /*
       * Before re-assigning the new result to be returned to our rotated
       * image, explicitly notify the VM that you are done with any
       * resources being used by the old resultant image that we don't
View Full Code Here


    resultGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
        interpolationHintValue);
    resultGraphics.drawImage(src, 0, 0, targetWidth, targetHeight, null);

    // Just to be clean, explicitly dispose our temporary graphics object
    resultGraphics.dispose();

    // Return the scaled image to the caller.
    return result;
  }
View Full Code Here

        g2.setPaint(new GradientPaint(nStartOfText, 0,
                SystemColor.controlShadow, getWidth(), 0, new Color(255, 255,
                        255, 0)));
        g2.fillRect(nStartOfText, 0, getWidth(), ghostImage.getHeight());

        g2.dispose();

        treetable.getTree().setSelectionPath(path); // Select this path in the
        // tree

        // Wrap the path being transferred into a Transferable object
View Full Code Here

               BufferedImage bImg = new BufferedImage(width, height, imageType);
               Graphics2D g2d = bImg.createGraphics();
               g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                     RenderingHints.VALUE_INTERPOLATION_BICUBIC);
               g2d.drawImage(icon.getImage(), 0, 0, width, height, null);
               g2d.dispose();
  
               String formatName = "";
               if (contentType != null && contentType.indexOf("png") != -1)
                  formatName = "png";
               else if (contentType != null && (contentType.indexOf("jpg") != -1) ||
View Full Code Here

            // Create a half transparent drag image from icon
            BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2D = (Graphics2D)image.getGraphics();
            g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.66f));
            icon.paintIcon(component, g2D, 0, 0);
            g2D.dispose();
           
            ev.startDrag(null, image, new Point(12, 24),  transferable, this);
          } else {
            // Force the use of an empty image otherwise Mac OS X uses a grey rectangle
            ev.startDrag(null, EMPTY_IMAGE, new Point(48, 48), transferable, this);
View Full Code Here

      PageFormat pageFormat = getPageFormat(this.home.getPrint());
      Insets insets = getInsets();
      double scale = (getWidth() - insets.left - insets.right) / pageFormat.getWidth();
      g2D.scale(scale, scale);
      print(g2D, pageFormat, this.page);
      g2D.dispose();
    } catch (PrinterException ex) {
      throw new RuntimeException(ex);
    }
  }
 
View Full Code Here

          g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0));
          g2D.fill(new Rectangle2D.Double(0, 0, imageSize.width, imageSize.height));
          g2D.setComposite(oldComposite);
        }
        this.navigationPanel.paintAll(g2D);
        g2D.dispose();
        // Navigation panel image ready to be displayed
        this.navigationPanelImage = updatedImage;
        return;
      }
    }
View Full Code Here

      g2D.translate(pageFormat.getImageableX() + (pageFormat.getImageableWidth() - printSize) / 2,
          pageFormat.getImageableY() + (pageFormat.getImageableHeight() - printSize) / 2);
      double scale = printSize / printedImageSize;
      g2D.scale(scale, scale);
      g2D.drawImage(this.printedImage, 0, 0, this);
      g2D.dispose();

      return PAGE_EXISTS;
    } else {
      return NO_SUCH_PAGE;
    }
View Full Code Here

          public int filterRGB(int x, int y, int rgba) {
            // Always use foreground color and alpha
            return (rgba & 0xFF000000) | foregroundColorRgb;
          }
        })), 0, 0, null);
    imageGraphics.dispose();
    return image;
  }
 
  /**
   * Returns the border of a component where a user may drop objects.
View Full Code Here

                float scale = Math.min(1, 128f / Math.max(transferedImage.getWidth(), transferedImage.getHeight()));
                BufferedImage iconImage = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
                Graphics2D g2D = (Graphics2D)iconImage.getGraphics();
                g2D.scale(scale, scale);
                g2D.drawRenderedImage(transferedImage, null);
                g2D.dispose();
                return new ImageIcon(iconImage);
              }
            } catch (UnsupportedFlavorException ex) {
              // Use default representation
            } catch (IOException ex) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.