pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Brown (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIVOT-660) Picture resample fails on some BufferedImage
Date Wed, 27 Oct 2010 11:55:20 GMT

    [ https://issues.apache.org/jira/browse/PIVOT-660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925339#action_12925339
] 

Greg Brown commented on PIVOT-660:
----------------------------------

This seems like it might simply be a limitation of java.awt.image.BufferedImage. If so, there's
probably not much we can do about it in Pivot, aside from throwing an IllegalArgumentException.



> Picture resample fails on some BufferedImage
> --------------------------------------------
>
>                 Key: PIVOT-660
>                 URL: https://issues.apache.org/jira/browse/PIVOT-660
>             Project: Pivot
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>         Environment: Windows 7 Ultimate, Java 1.6u20
>            Reporter: Andrew Alegre
>            Priority: Trivial
>
> Picture resampling fails if the BufferedImage supplied was created with a ColorModel
and Raster. (i.e. no type specified)
> java.lang.IllegalArgumentException: Unknown image type 0
>         at java.awt.image.BufferedImage.<init>(BufferedImage.java:490)
>         at org.apache.pivot.wtk.media.Picture.resample(Picture.java:101)
>         at org.apache.pivot.wtk.media.Picture.resample(Picture.java:83)
> Work around is simply to build a new BufferedImage with a specified type and draw the
last image onto it:
>         BufferedImage bimg = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);
>         Graphics2D g2d = bimg.createGraphics();
>         g2d.drawImage(img, 0, 0, null);
>         Picture pic = new Picture(bimg);
>         pic.resample(200, 200);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message