API Review: BufferedImage import/export utilities

Matthieu BROUILLARD matthieu at brouillard.fr
Mon May 21 00:13:11 PDT 2012


Hello,

Are you sure that we need in this class the optional parameters in both
methods? As a end user of the API even if you expect the methods to write
to the provided objects, you will have to check the return parameter to be
sure that your provided object has been correctly filled.
Won't it be easier to just use the return object? Won't it make the API
simpler and the client code more readable?

Or if it is important that an already prepared image object is used to copy
the image into what about splitting in 4 methods and make this usage
explicit:
   public static WritableImage toFXImage(BufferedImage bimg);   // creates
a WritableImage
   public static void toFXImage(WritableImage wimg) throws Exception;   //
reuse the provided image or fail with expection
   public static BufferedImage fromFXImage(Image img);    // creates a
BufferedImage
   public static void fromFXImage(BufferedImage bimg) throws Exception;    //
reuse the provided image or fail with expection

Matthieu


More information about the openjfx-dev mailing list