zoukankan      html  css  js  c++  java
  • 在线签名,并保存到本地

    saveImgGroup的大小由里面的图片决定。

    <s:Group  top="75" width="1440" height="830" horizontalCenter="0">
       <!--相片-->
       <s:Group id="saveImgGroup" horizontalCenter="0" verticalCenter="0">
        <s:BitmapImage id="signPhoto" maxWidth="1440" maxHeight="830" horizontalCenter="0"
           scaleMode="letterbox" source="http://121.0.0.1/baozhi/2.png" verticalCenter="0"/>
        <s:Group id="drawWords" width="{signPhoto.width}" height="{signPhoto.height}"
           horizontalCenter="0" verticalCenter="0"/>
       </s:Group>
       
      </s:Group>

    注:saveBitmapData=new BitmapData(saveImgGroup.width,saveImgGroup.height,true,0);
       saveBitmapData.draw(saveImgGroup);

    最后保存的图片的大小是由saveImgGroup.width,saveImgGroup.height决定的,而saveBitmapData.draw()会在saveImgGroup的左上角截取大小为

    saveImgGroup.width,saveImgGroup.height的区域。

    /**
       *在线保存图片
       * */
      private var saveBitmapData:BitmapData;
      private function saveBtnClickHandler(evt:MouseEvent):void
      {
       saveBitmapData=new BitmapData(saveImgGroup.width,saveImgGroup.height,true,0);
       saveBitmapData.draw(saveImgGroup);
       var imgByteArray:ByteArray=PNGEncoder.encode(saveBitmapData);
       var file:File=new File("E:\PhotoAndSignature\signImg\100.png");
       var fs:FileStream=new FileStream();
       try
       {
        fs.open(file, FileMode.WRITE);
        fs.writeBytes(imgByteArray);
        fs.close();
       }
       catch (e:Error)
       {
        trace(e.message);
       }
      }

  • 相关阅读:
    php环境配置中各个模块在网站建设中的功能
    PHP+Apache+MySQL+phpMyAdmin在win7系统下的环境配置
    August 17th 2017 Week 33rd Thursday
    August 16th 2017 Week 33rd Wednesday
    August 15th 2017 Week 33rd Tuesday
    August 14th 2017 Week 33rd Monday
    August 13th 2017 Week 33rd Sunday
    August 12th 2017 Week 32nd Saturday
    August 11th 2017 Week 32nd Friday
    August 10th 2017 Week 32nd Thursday
  • 原文地址:https://www.cnblogs.com/dongyl/p/3773174.html
Copyright © 2011-2022 走看看