Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static public function setDnpPaper(bd:BitmapData):BitmapData
- {
- var resultPictureSize:Rectangle = new Rectangle(0, 0, PND_PAPER_SIZE.width - parseInt( Main._config.vendor.margins[0] - parseInt( Main._config.vendor.margins[1] ), PND_PAPER_SIZE.height - parseInt( Main._config.vendor.margins[2] - parseInt( Main._config.vendor.margins[3] ) );
- var sourceRatio:Number = bd.width / bd.height;
- var destRatio:Number = resultPictureSize.width / resultPictureSize.height;
- var matrix:Matrix;
- var ratio:Number;
- if (sourceRatio > destRatio)
- {
- ratio = resultPictureSize.width / bd.width;
- }
- else
- {
- ratio = resultPictureSize.height / bd.height;
- }
- matrix = new Matrix();
- matrix.scale(ratio, ratio);
- var result_bd:BitmapData = new BitmapData(resultPictureSize.width, resultPictureSize.height, false, 0xFFFFFF);
- result_bd.draw(bd, matrix, null, null, null, true);
- var pnd_paper_bd:BitmapData = new BitmapData(PND_PAPER_SIZE.width, PND_PAPER_SIZE.height, false, 0xFFFFFF);
- matrix = new Matrix();
- matrix.tx = parseInt( Main._config.vendor.margins[0] ;
- matrix.ty = parseInt( Main._config.vendor.margins[2];
- pnd_paper_bd.draw(result_bd, matrix, null, null, null, true);
- return pnd_paper_bd;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement