Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

Printing image with mask in Adobe Air

$
0
0

I have createad an application for framed photos.This application creates a Canvas which can hold several framed photos. Following is the code of the framed photo:

 

<mx:Canvas id="imageContainer" horizontalScrollPolicy="off" verticalScrollPolicy="off" clipContent="false">
        <mx:Image id="image_img" source="app:/image.jpg" maintainAspectRatio="false" width="500" height="500" cacheAsBitmap="true"/>
        <mx:Image id="mask_img" source="app:/mask.png" maintainAspectRatio="false" width="300" height="300" cacheAsBitmap="true"/>
        <mx:Image id="frame_img" source="app:/frame.png" maintainAspectRatio="false" width="300" height="300" cacheAsBitmap="true"/>
</mx:Canvas>

 

when these are loaded, I use:

 

image_img.mask = mask_img;

 

to apply the mask on the image. this looks fine on the screen, but when I try to print it the mask is not applied!

Actually I have found two ways to do this. The first is to add the Canvas directly to a print job:

 

     var printOption:PrintJobOptions = new PrintJobOptions();
     printOption.printAsBitmap = true;
     myPrintJob.addPage(frameContainer, null, printOption);

     myPrintJob.send();

 

this has a very good print quality but the masks do not work.

the second way is to take a "screenshot" in a bitmap and print that:

 

     var previewBD:BitmapData = new BitmapData( frameCanvas.width, frameCanvas.height, false );
     previewBD.draw( frameCanvas, null, null, null, null, true );
     var b:Bitmap = new Bitmap;
     b.bitmapData = previewBD;
     var s:Sprite = new Sprite;
     s.addChild(b);

     myPrintJob.addPage(s, null, printOption);

 

in this case the mask works but the print quality drops drastically!

is there any way to print with good quality AND having the mask?

is this a bug of AIR or am I missing something?


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>