From: <de...@us...> - 2008-08-12 19:54:04
|
Revision: 3790 http://fudaa.svn.sourceforge.net/fudaa/?rev=3790&view=rev Author: deniger Date: 2008-08-12 19:54:13 +0000 (Tue, 12 Aug 2008) Log Message: ----------- ajout d'une methode qui permet de creer une image adapte a l'affichage ecran Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java 2008-08-12 19:54:01 UTC (rev 3789) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java 2008-08-12 19:54:13 UTC (rev 3790) @@ -33,7 +33,8 @@ * @version $Id: CtuluLibImage.java,v 1.12 2007-06-05 08:57:44 deniger Exp $ */ public final class CtuluLibImage { - private CtuluLibImage() {} + private CtuluLibImage() { + } public static float getRatio(final int _sup, final int _inf) { return ((float) _sup) / ((float) _inf); @@ -44,8 +45,10 @@ } /** - * @param _imageParams la tables des parametres: peut etre null. - * @return true si le client doit cr\xE9er une image compatible avec l'affichage de l'\xE9cran + * @param _imageParams + * la tables des parametres: peut etre null. + * @return true si le client doit cr\xE9er une image compatible avec l'affichage + * de l'\xE9cran * @see CtuluImageProducer#PARAMS_CREATE_SCREEN_COMPATIBLE_IMAGE */ public static boolean isCompatibleImageAsked(Map _imageParams) { @@ -53,6 +56,12 @@ && _imageParams.get(CtuluImageProducer.PARAMS_CREATE_SCREEN_COMPATIBLE_IMAGE) == Boolean.TRUE; } + public static void setCompatibleImageAsked(Map _imageParams) { + if (_imageParams != null) { + _imageParams.put(CtuluImageProducer.PARAMS_CREATE_SCREEN_COMPATIBLE_IMAGE, Boolean.TRUE); + } + } + public static int getImageRGBType(Map _imageParams) { return mustFillBackground(_imageParams) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; } @@ -80,9 +89,12 @@ } /** - * @param _c le compsant a imprimer - * @param _w la largeur de l'image - * @param _h la hauteur + * @param _c + * le compsant a imprimer + * @param _w + * la largeur de l'image + * @param _h + * la hauteur * @param _params * @return */ @@ -120,7 +132,8 @@ } } - if (i == null) i = new BufferedImage(_w, _h, getImageRGBType(_params)); + if (i == null) + i = new BufferedImage(_w, _h, getImageRGBType(_params)); return i; } @@ -158,7 +171,8 @@ } } - // il y a un bogue avec le plugin javaio sur certains fichiers jpg: on va essayer de le virer + // il y a un bogue avec le plugin javaio sur certains fichiers jpg: on va + // essayer de le virer if (res != null && inputOk) { try { res.getHeight(0); @@ -168,7 +182,8 @@ if (it != null && it.hasNext()) { // on prend le prochain lecteur res = (ImageReader) it.next(); - if (res == null) inputOk = false; + if (res == null) + inputOk = false; else { try { res.setInput(ImageIO.createImageInputStream(_f)); @@ -224,7 +239,8 @@ * @return */ private static BufferedImage createThumbnail(BufferedImage _initImage, int _newWidth, int _newHeight, int _type) { - if (Fu.DEBUG && FuLog.isDebug()) FuLog.debug("CIM: on utilise technique swingx pour les thumbnails"); + if (Fu.DEBUG && FuLog.isDebug()) + FuLog.debug("CIM: on utilise technique swingx pour les thumbnails"); int width = _initImage.getWidth(); int height = _initImage.getHeight(); @@ -254,7 +270,8 @@ } if (temp == null || isTranslucent) { - if (g2 != null) g2.dispose(); + if (g2 != null) + g2.dispose(); temp = createImage(width, height, _type); g2 = temp.createGraphics(); setBestQuality(g2); @@ -306,7 +323,8 @@ } public static BufferedImage resize(final BufferedImage _init, final int _newW, final int _newH, final int _type) { - if (_newH < _init.getHeight() && _newW < _init.getWidth()) return createThumbnail(_init, _newW, _newH, _type); + if (_newH < _init.getHeight() && _newW < _init.getWidth()) + return createThumbnail(_init, _newW, _newH, _type); final BufferedImage res = new BufferedImage(_newW, _newH, _type); final Graphics2D g2 = res.createGraphics(); g2.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |