Class ImageReplacedElement

  • All Implemented Interfaces:
    ReplacedElement

    public class ImageReplacedElement
    extends java.lang.Object
    implements ReplacedElement
    An ImageReplacedElement is a ReplacedElement that contains a Image. It's used as a container for images included within XML being rendered. The image contained is immutable.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.awt.Image _image  
      private java.awt.Point _location  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ImageReplacedElement()  
        ImageReplacedElement​(java.awt.Image image, int targetWidth, int targetHeight)
      Creates a new ImageReplacedElement and scales it to the size specified if either width or height has a valid value (values are > -1), otherwise original size is preserved.
    • Field Detail

      • _image

        protected java.awt.Image _image
      • _location

        private java.awt.Point _location
    • Constructor Detail

      • ImageReplacedElement

        protected ImageReplacedElement()
      • ImageReplacedElement

        public ImageReplacedElement​(java.awt.Image image,
                                    int targetWidth,
                                    int targetHeight)
        Creates a new ImageReplacedElement and scales it to the size specified if either width or height has a valid value (values are > -1), otherwise original size is preserved. The idea is that the image was loaded at a certain size (that's the Image instance here) and that at the time we create the ImageReplacedElement we have a target W/H we want to use.
        Parameters:
        image - An image.
        targetWidth - The width we'd like the image to have, in pixels.
        targetHeight - The height we'd like the image to have, in pixels.