sivarajankumar / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

SOLUTION: "png alpha not supported" #182

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Take a ImageSnapshot of a component using the PNGEncoder and try 
addImageStream and the "png alpha not 
supported" error will be thrown.  The same goes for attaching any png with an 
alpha channel.

What is the expected output? What do you see instead?
Being able to attach a png image with an alpha channel

What version of the product are you using? On what operating system?
Latest as of Dec/12/09, Same issue regardless of OS

Please provide any additional information below.

A semi-solution is attached below it will encode to a png but without alpha 
channel support.  Based loosly on 
adobes PNGEncoder except it is asynchronous and uses vectors intstead of 
arrays.  File is attached and here is an 
example:
====

    var pngEncoder:XPNGEncoder = new XPNGEncoder();
    var bitmap:BitmapData = ImageSnapshot.captureBitmapData( uicomponent, new Matrix( 72, 0, 0, 72 ) );

    pngEncoder.addEventListener( XPNGCompleteEvent.PNG_COMPLETE, function( e:XPNGCompleteEvent ):void
    {
        var dataToSave:ByteArray = e.data;

        // pdf.addImageStream( dataToSave, ... );
                // you get the idea, it works but further optimizations could be made obviously to speed it up
    }

Original issue reported on code.google.com by beuker.m...@gmail.com on 13 Dec 2009 at 2:03

Attachments: