zoukankan      html  css  js  c++  java
  • ActionScript实现把多张图片组合成一张图片

     1 /**
     2  * ComingX.com Business License
     3  * 
     4  * Copyright 2012. All rights reserved.
     5  *
     6  * @Author: Lanjie_Shan
     7  * @Email:shanlanjie#hotmail.com
     8  * @Created date: 2012-6-21
     9  */
    10 package
    11 {
    12     import flash.display.Bitmap;
    13     import flash.display.BitmapData;
    14     import flash.display.BitmapDataChannel;
    15     import flash.display.Sprite;
    16     import flash.events.Event;
    17     import flash.geom.Point;
    18     import flash.geom.Rectangle;
    19 
    20     [SWF(width=800, height=600, frameRate=24, backgroundColor=0xE2E2E2)]    
    21     public class ImageGroupDemo extends Sprite
    22     {
    23         [Embed(source="aaa.png")]      
    24         public var BrownCollector:Class;  //图片大小为100*100
    25         public var canvas:BitmapData;
    26         public var spritesheet:BitmapData;
    27         public var rect:Rectangle;
    28         public function ImageGroupDemo()
    29         {
    30             spritesheet = (new BrownCollector() as Bitmap).bitmapData;
    31             canvas = new BitmapData(400,500,true,0xffffff);
    32             addChild(new  Bitmap(canvas));
    33             rect = new Rectangle(0,0,100,100);
    34             for(var j:int = 0; j<5; j++)
    35             {
    36                 for(var i:int = 0; i<4; i++)
    37                 {
    38                     canvas.copyPixels(spritesheet,rect,new Point(i*100,j*100) );   
    39                 }
    40             }
    41         }
    42     }
    43 }

    效果图:

  • 相关阅读:
    android判断服务是否是运行状态
    Android调用OCR识别图像中的文字
    Java生成各种条形码
    android 实现摇一摇功能
    【读书笔记】Html5游戏开发
    SpeechLib 语音播报
    罗盘
    注释文档在线编辑及生成
    系统空闲时间判断&命名验证
    Asp.Net MVC中使用ACE模板之Jqgrid
  • 原文地址:https://www.cnblogs.com/shanlanjie/p/2558607.html
Copyright © 2011-2022 走看看