public static Image getImage ( Properties attributes ) throws BadElementException , MalformedURLException , IOException { String value ; value = attributes . getProperty ( ElementTags . URL ) ; if ( value == null ) throw new MalformedURLException ( "The URL of the image is missing." ) ; Image image = Image . getInstance ( value ) ; value = attributes . getProperty ( ElementTags . ALIGN ) ; int align = 0 ; if ( value != null ) { if ( ElementTags . ALIGN_LEFT . equalsIgnoreCase ( value ) ) align |= Image . LEFT ; else if ( ElementTags . ALIGN_RIGHT . equalsIgnoreCase ( value ) ) align |= Image . RIGHT ; else if ( ElementTags . ALIGN_MIDDLE . equalsIgnoreCase ( value ) ) align |= Image . MIDDLE ; } if ( "true" . equalsIgnoreCase ( attributes . getProperty ( ElementTags . UNDERLYING ) ) ) align |= Image . UNDERLYING ; if ( "true" . equalsIgnoreCase ( attributes . getProperty ( ElementTags . TEXTWRAP ) ) ) align |= Image . TEXTWRAP ; image . setAlignment ( align ) ; value = attributes . getProperty ( ElementTags . ALT ) ; if ( value != null ) { image . setAlt ( value ) ; } String x = attributes . getProperty ( ElementTags . ABSOLUTEX ) ; String y = attributes . getProperty ( ElementTags . ABSOLUTEY ) ; if ( ( x != null ) && ( y != null ) ) { image . setAbsolutePosition ( Float . parseFloat ( x + "f" ) , Float . parseFloat ( y + "f" ) ) ; } value = attributes . getProperty ( ElementTags . PLAINWIDTH ) ; if ( value != null ) { image . scaleAbsoluteWidth ( Float . parseFloat ( value + "f" ) ) ; } value = attributes . getProperty ( ElementTags . PLAINHEIGHT ) ; if ( value != null ) { image . scaleAbsoluteHeight ( Float . parseFloat ( value + "f" ) ) ; } value = attributes . getProperty ( ElementTags . ROTATION ) ; if ( value != null ) { image . setRotation ( Float . parseFloat ( value + "f" ) ) ; } return image ; }
Creates an Image object based on a list of properties .