已知B的bitmapdata 和 X的bitmapData求 A的bitmapdata

需要生成如图A的效果,已经有图B和任意大小的图X

A:                      B:                      X:



   



  Q :假设已经有 B的 bitmapdata (var :BitmapData = B;)和X的bitmapData(var bitmapData_X:BitmapData = C;),求A的bitmapdata_A

A:

                var bHalfWidth:Number = bitmapData_B.width/2;
                   
                var xWidth:Number = bitmapData_X.width;
                var xHeight:Number = bitmapData_X.height;

                var scaledHeight:Number = bHalfWidth*2/3;
                var scaledWidth:Number =   xWidth*scaledXHeight/xHeight;

                var scaledBitmapData:BitmapData = new BitmapData(scaledHeight,scaledWidth)

                var scale:Number = scaledHeight/xHeight;
                var matrix:Matrix = new Matrix();
                matrix.createBox(scale,scale,-Math.PI/2,0,scaledWidth);
                scaledBitmapData.draw(new Bitmap(bitmapData_X),matrix);
                   
                bitmapData_B.merge(scaledBitmapData,new Rectangle(0,0,scaledBitmapData.width,
scaledBitmapData.height),
 new Point(bitmapData_B.width/2+5,(bitmapData_B.height-scaledBitmapData.height)/2),
0xff,0xff,0xff,0xff);

 

你可能感兴趣的:(C++,c,C#)