API java : AffineTransformOp


java.awt.image
Class AffineTransformOp

java.lang.Object
  extended by java.awt.image.AffineTransformOp
All Implemented Interfaces:
BufferedImageOp, RasterOp

public class AffineTransformOp
extends Object
implements BufferedImageOp, RasterOp

This class uses an affine transform to perform a linear mapping from 2D coordinates in the source image or Raster to 2D coordinates in the destination image or Raster. The type of interpolation that is used is specified through a constructor, either by a RenderingHints object or by one of the integer interpolation types defined in this class.

If a RenderingHints object is specified in the constructor, the interpolation hint and the rendering quality hint are used to set the interpolation type for this operation. The color rendering hint and the dithering hint can be used when color conversion is required.

Note that the following constraints have to be met:

  • The source and destination must be different.
  • For Raster objects, the number of bands in the source must be equal to the number of bands in the destination.

See Also:
AffineTransform, BufferedImageFilter, RenderingHints.KEY_INTERPOLATION, RenderingHints.KEY_RENDERING, RenderingHints.KEY_COLOR_RENDERING, RenderingHints.KEY_DITHERING

Field Summary
static int TYPE_BICUBIC
          Bicubic interpolation type.
static int TYPE_BILINEAR
          Bilinear interpolation type.
static int TYPE_NEAREST_NEIGHBOR
          Nearest-neighbor interpolation type.
 
Constructor Summary
AffineTransformOp(AffineTransform xform, int interpolationType)
          Constructs an AffineTransformOp given an affine transform and the interpolation type.
AffineTransformOp(AffineTransform xform, RenderingHints hints)
          Constructs an AffineTransformOp given an affine transform.
 
Method Summary
 BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM)
          Creates a zeroed destination image with the correct size and number of bands.
 WritableRaster createCompatibleDestRaster(Raster src)
          Creates a zeroed destination Raster with the correct size and number of bands.
 BufferedImage filter(BufferedImage src, BufferedImage dst)
          Transforms the source BufferedImage and stores the results in the destination BufferedImage.
 WritableRaster filter(Raster src, WritableRaster dst)
          Transforms the source Raster and stores the results in the destination Raster.
 Rectangle2D getBounds2D(BufferedImage src)
          Returns the bounding box of the transformed destination.
 Rectangle2D getBounds2D(Raster src)
          Returns the bounding box of the transformed destination.
 int getInterpolationType()
          Returns the interpolation type used by this op.
 Point2D getPoint2D(Point2D srcPt, Point2D dstPt)
          Returns the location of the corresponding destination point given a point in the source.
 RenderingHints getRenderingHints()
          Returns the rendering hints used by this transform operation.
 AffineTransform getTransform()
          Returns the affine transform used by this transform operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NEAREST_NEIGHBOR

public static final int TYPE_NEAREST_NEIGHBOR
Nearest-neighbor interpolation type.

See Also:
Constant Field Values

TYPE_BILINEAR

public static final int TYPE_BILINEAR
Bilinear interpolation type.

See Also:
Constant Field Values

TYPE_BICUBIC

public static final int TYPE_BICUBIC
Bicubic interpolation type.

See Also:
Constant Field Values
Constructor Detail

AffineTransformOp

public AffineTransformOp(AffineTransform xform,
                         RenderingHints hints)
Constructs an AffineTransformOp given an affine transform. The interpolation type is determined from the RenderingHints object. If the interpolation hint is defined, it will be used. Otherwise, if the rendering quality hint is defined, the interpolation type is determined from its value. If no hints are specified (hints is null), the interpolation type is TYPE_NEAREST_NEIGHBOR.

Parameters:
xform - The AffineTransform to use for the operation.
hints - The RenderingHints object used to specify the interpolation type for the operation.
Throws:
ImagingOpException - if the transform is non-invertible.
See Also:
RenderingHints.KEY_INTERPOLATION, RenderingHints.KEY_RENDERING

AffineTransformOp

public AffineTransformOp(AffineTransform xform,
                         int interpolationType)
Constructs an AffineTransformOp given an affine transform and the interpolation type.

Parameters:
xform - The AffineTransform to use for the operation.
interpolationType - One of the integer interpolation type constants defined by this class: TYPE_NEAREST_NEIGHBOR, TYPE_BILINEAR, TYPE_BICUBIC.
Throws:
ImagingOpException - if the transform is non-invertible.
Method Detail

getInterpolationType

public final int getInterpolationType()
Returns the interpolation type used by this op.

Returns:
the interpolation type.
See Also:
TYPE_NEAREST_NEIGHBOR, TYPE_BILINEAR, TYPE_BICUBIC

filter

public final BufferedImage filter(BufferedImage src,
                                  BufferedImage dst)
Transforms the source BufferedImage and stores the results in the destination BufferedImage. If the color models for the two images do not match, a color conversion into the destination color model is performed. If the destination image is null, a BufferedImage is created with the source ColorModel.

The coordinates of the rectangle returned by getBounds2D(BufferedImage) are not necessarily the same as the coordinates of the BufferedImage returned by this method. If the upper-left corner coordinates of the rectangle are negative then this part of the rectangle is not drawn. If the upper-left corner coordinates of the rectangle are positive then the filtered image is drawn at that position in the destination BufferedImage.

An IllegalArgumentException is thrown if the source is the same as the destination.

Specified by:
filter in interface BufferedImageOp
Parameters:
src - The BufferedImage to transform.
dst - The BufferedImage in which to store the results of the transformation.
Returns:
The filtered BufferedImage.
Throws:
IllegalArgumentException - if src and dst are the same
ImagingOpException - if the image cannot be transformed because of a data-processing error that might be caused by an invalid image format, tile format, or image-processing operation, or any other unsupported operation.

filter

public final WritableRaster filter(Raster src,
                                   WritableRaster dst)
Transforms the source Raster and stores the results in the destination Raster. This operation performs the transform band by band.

If the destination Raster is null, a new Raster is created. An IllegalArgumentException may be thrown if the source is the same as the destination or if the number of bands in the source is not equal to the number of bands in the destination.

The coordinates of the rectangle returned by getBounds2D(Raster) are not necessarily the same as the coordinates of the WritableRaster returned by this method. If the upper-left corner coordinates of rectangle are negative then this part of the rectangle is not drawn. If the coordinates of the rectangle are positive then the filtered image is drawn at that position in the destination Raster.

Specified by:
filter in interface RasterOp
Parameters:
src - The Raster to transform.
dst - The Raster in which to store the results of the transformation.
Returns:
The transformed Raster.
Throws:
ImagingOpException - if the raster cannot be transformed because of a data-processing error that might be caused by an invalid image format, tile format, or image-processing operation, or any other unsupported operation.

getBounds2D

public final Rectangle2D getBounds2D(BufferedImage src)
Returns the bounding box of the transformed destination. The rectangle returned is the actual bounding box of the transformed points. The coordinates of the upper-left corner of the returned rectangle might not be (0, 0).

Specified by:
getBounds2D in interface BufferedImageOp
Parameters:
src - The BufferedImage to be transformed.
Returns:
The Rectangle2D representing the destination's bounding box.

getBounds2D

public final Rectangle2D getBounds2D(Raster src)
Returns the bounding box of the transformed destination. The rectangle returned will be the actual bounding box of the transformed points. The coordinates of the upper-left corner of the returned rectangle might not be (0, 0).

Specified by:
getBounds2D in interface RasterOp
Parameters:
src - The Raster to be transformed.
Returns:
The Rectangle2D representing the destination's bounding box.

createCompatibleDestImage

public BufferedImage createCompatibleDestImage(BufferedImage src,
                                               ColorModel destCM)
Creates a zeroed destination image with the correct size and number of bands. A RasterFormatException may be thrown if the transformed width or height is equal to 0.

If destCM is null, an appropriate ColorModel is used; this ColorModel may have an alpha channel even if the source ColorModel is opaque.

Specified by:
createCompatibleDestImage in interface BufferedImageOp
Parameters:
src - The BufferedImage to be transformed.
destCM - ColorModel of the destination. If null, an appropriate ColorModel is used.
Returns:
The zeroed destination image.

createCompatibleDestRaster

public WritableRaster createCompatibleDestRaster(Raster src)
Creates a zeroed destination Raster with the correct size and number of bands. A RasterFormatException may be thrown if the transformed width or height is equal to 0.

Specified by:
createCompatibleDestRaster in interface RasterOp
Parameters:
src - The Raster to be transformed.
Returns:
The zeroed destination Raster.

getPoint2D

public final Point2D getPoint2D(Point2D srcPt,
                                Point2D dstPt)
Returns the location of the corresponding destination point given a point in the source. If dstPt is specified, it is used to hold the return value.

Specified by:
getPoint2D in interface BufferedImageOp
Specified by:
getPoint2D in interface RasterOp
Parameters:
srcPt - The Point2D that represents the source point.
dstPt - The Point2D in which to store the result.
Returns:
The Point2D in the destination that corresponds to the specified point in the source.

getTransform

public final AffineTransform getTransform()
Returns the affine transform used by this transform operation.

Returns:
The AffineTransform associated with this op.

getRenderingHints

public final RenderingHints getRenderingHints()
Returns the rendering hints used by this transform operation.

Specified by:
getRenderingHints in interface BufferedImageOp
Specified by:
getRenderingHints in interface RasterOp
Returns:
The RenderingHints object associated with this op.

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

8 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-734
Document créé le 24/07/06 21:10, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http:///www.gaudry.be/java-api-rf-java/awt/image/AffineTransformOp.html
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15838 documents
455 astuces.
550 niouzes.
3107 definitions.
447 membres.
8121 messages.

Document genere en :
0,07 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
On ne peut pas arrêter le flot des vagues, mais on peut apprendre à surfer.

Jon Kabat-Zinn
 
l'infobrol
Nous sommes le Mardi 23 Mai 2017, 10:41, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)