-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
I just noticed that the javadoc is probably incomplete or wrong when I reviewed another PR in that area:
Lines 23 to 35 in 508ad4a
public interface SVGRasterizer { | |
/** | |
* Rasterizes an SVG image from the provided {@code InputStream} using the | |
* specified zoom. | |
* | |
* @param stream the SVG image as an {@link InputStream}. | |
* @param zoom the scaling factor (in percent) e.g. {@code 200} for doubled | |
* size. This value must be greater zero. | |
* @return the {@link ImageData} for the rasterized image, or {@code null} if | |
* the input is not a valid SVG file or cannot be processed. | |
*/ | |
public ImageData rasterizeSVG(InputStream stream, int zoom) throws IOException; | |
} |
I see the following issues:
IOException
is thrown but not documented under what condition this happens, the@return
claims it returnnull
on invalid data but why not throwIOException
always it seems odd to havenull
here (then maybeOptional
would have been a better choice) and what invalid means.- In the head it talks about a "zoom" (also parameter is named) but then in the description it says it is a scaling factor in percent, where a factor usually has no unit and percent itself is usually defined as 1% be a factor of 0.01 so for a scaling factor that represents the double size one would expect to have 2.0 as a factor.
For example, 45% (read as "forty-five percent") is equal to the fraction 45/100, or 0.45.
So I think the javadoc should be streamlined here to avoid confusion even if it is an internal API and only has one implementation at the moment.
Metadata
Metadata
Assignees
Labels
No labels