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 - 20 - 30, PND_PAPER_SIZE.height - 20 - 30);
- 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 = 20;
- matrix.ty = 20;
- 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