You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Yonas Jongkind (JIRA)" <ji...@apache.org> on 2009/09/06 09:16:57 UTC
[jira] Commented: (PDFBOX-513) PDJpeg does not support
transparency/alpha
[ https://issues.apache.org/jira/browse/PDFBOX-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12751836#action_12751836 ]
Yonas Jongkind commented on PDFBOX-513:
---------------------------------------
And a partial diff as well... Source refomatting made the full diff useless, but it's an easy bit of code to copy from the attached source:
84,85c98
< if (image != null)
< {
---
> if (image != null) {
103a117,139
> BufferedImage alpha = null;
> if (bi.getColorModel().hasAlpha()){
>
> alpha = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
> Graphics2D g = alpha.createGraphics();
> g.setColor(Color.BLACK);
> g.drawRect(0, 0, bi.getWidth(), bi.getHeight());
> g.setColor(Color.WHITE);
> g.drawImage(bi, 0, 0, null);
> for(int y = 0; y < alpha.getHeight(); y++){
> for(int x = 0; x < alpha.getWidth(); x++){
> Color color = new Color(alpha.getRGB(x, y));
> if(color.getRed() != 0 && color.getGreen() != 0 && color.getBlue() != 0){
> alpha.setRGB(x, y, (Color.white).getRGB());
> }
> }
> }
>
> BufferedImage image = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_USHORT_565_RGB);
> g = image.createGraphics();
> g.drawImage(bi, 0, 0, null);
> bi = image;
> }
> PDJpeg does not support transparency/alpha
> ------------------------------------------
>
> Key: PDFBOX-513
> URL: https://issues.apache.org/jira/browse/PDFBOX-513
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 0.8.0-incubator
> Environment: Any
> Reporter: Yonas Jongkind
> Attachments: PDJpeg.java
>
>
> The code does not handle this feature. Patch attached.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.