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);
       }
      }

  • 相关阅读:
    css设置兼容的透明样式
    mybatis 使用oracle merge into 语句踩坑实录
    eclipse导入SVN上的Maven多模块项目
    jquery.form插件中动态修改表单数据
    java的几种对象(po,dto,dao等)
    redis面试总结
    前段面试准备
    查询各科成绩最好的学生
    Github访问慢解决办法
    该文件有程序在使用
  • 原文地址:https://www.cnblogs.com/dongyl/p/3773174.html
Copyright © 2011-2022 走看看