xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harshini Madurapperuma <harshini.madurapper...@ifs.lk>
Subject RE: Bitmap support in BmpImage.java class ?
Date Wed, 13 Feb 2008 09:04:57 GMT
Hi Jeremias,

Thanks for your valid suggestions. Does 0.95 supports for 16 and 32 bit images? What about
the previous versions before 0.95? If you have a higher version can I get the algorithm or
the code?

Thanks
Harshini.

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
Sent: Wednesday, February 13, 2008 12:36 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Bitmap support in BmpImage.java class ?

Sure, you can. Either you replace BmpImage with the JAI implementation as discussed earlier
or you change BmpImage. In the latter case, you have to convert the 16 and 32 bit image data
to 24 bit RGB. Otherwise, the renderers will not process the image data correctly (FOP Trunk
is much more flexible here). For this you need to know a few things about the BMP format.
Start here to get more information:
http://en.wikipedia.org/wiki/BMP_file_format

I think it's probably easiest if you use ImageIO or JAI to load BMP images and convert them
to the required 24bit pixel stream using the
BufferedImage.getRGB() method as done in JAIImage. But if I were you I'd try to upgrade FOP
at least as soon as 0.95 is available next month.

On 13.02.2008 05:11:01 Harshini Madurapperuma wrote:
>  Hi all;
>
> I have the fop version 0.20.5, and I have to work with bitmap images.
> In BmpImage.java class the code supports only for 1,4,8 and 24 bit
> sizes, otherwise it throws an exception. Can't I modify this to
> support for 16 and 32 bits also with out changing the fop version.
> Your suggestions would be greatly appreciated.
>
> if (this.m_bitsPerPixel == 1)
>             bytes = (this.m_width + 7) / 8;
>         else if (this.m_bitsPerPixel == 24)
>             bytes = this.m_width * 3;
>         else if (this.m_bitsPerPixel == 4 || this.m_bitsPerPixel == 8)
>             bytes = this.m_width / (8 / this.m_bitsPerPixel);
>         else
>             throw new FopImageException("Image (" + this.m_href.toString()
>                                         + ") has " + this.m_bitsPerPixel
>                                         + " which is not a supported
> BMP format...");
>
> Regards,
> Harshini.



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and intended only for
the addressee. If you are not the intended recipient, please notify us
immediately and delete this e-mail from your system. Any use or disclosure of
the information contained herein is strictly prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message