Package fr.univ_eiffel.legotools.image
Class NearestNeighborStrategy
java.lang.Object
fr.univ_eiffel.legotools.image.NearestNeighborStrategy
- All Implemented Interfaces:
ResolutionStrategy
Stratégie de redimensionnement "Plus proche voisin" (Nearest Neighbor).
Pourquoi cette classe ?
C'est l'algorithme le plus rapide et le plus simple qui existe.
Il ne crée aucune nouvelle couleur (pas de flou, pas de mélange).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionresize(BufferedImage source, int targetWidth, int targetHeight) Redimensionne l'image en sélectionnant simplement le pixel source correspondant.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.univ_eiffel.legotools.image.ResolutionStrategy
getRGB, toRGB
-
Constructor Details
-
NearestNeighborStrategy
public NearestNeighborStrategy()Constructeur par défaut.
-
-
Method Details
-
resize
Redimensionne l'image en sélectionnant simplement le pixel source correspondant.- Specified by:
resizein interfaceResolutionStrategy- Parameters:
source- Image d'origine.targetWidth- Largeur cible.targetHeight- Hauteur cible.- Returns:
- Une image redimensionnée brute (pixelisée).
-