| 1 |
|
|---|
| 2 |
/** |
|---|
| 3 |
* - SirdsAS3 - |
|---|
| 4 |
* RDS/SISステレオグラム生成ライブラリ |
|---|
| 5 |
* |
|---|
| 6 |
* RDSImageクラス |
|---|
| 7 |
* SIRDSの画像・補助点・結像画像を格納する |
|---|
| 8 |
* |
|---|
| 9 |
* @author dsler |
|---|
| 10 |
* @version 1.0.0 |
|---|
| 11 |
* @update 2009/07/02 |
|---|
| 12 |
* |
|---|
| 13 |
* Licensed under The MIT License |
|---|
| 14 |
* Copyright (c) 2009 dsler |
|---|
| 15 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 16 |
* of this software and associated documentation files (the "Software"), to deal |
|---|
| 17 |
* in the Software without restriction, including without limitation the rights |
|---|
| 18 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 19 |
* copies of the Software, and to permit persons to whom the Software is |
|---|
| 20 |
* furnished to do so, subject to the following conditions: |
|---|
| 21 |
* The above copyright notice and this permission notice shall be included in |
|---|
| 22 |
* all copies or substantial portions of the Software. |
|---|
| 23 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 24 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 25 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|---|
| 26 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 27 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 28 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 29 |
* THE SOFTWARE. |
|---|
| 30 |
*/ |
|---|
| 31 |
|
|---|
| 32 |
package org.libspark.dsler.SirdsAS3 |
|---|
| 33 |
{ |
|---|
| 34 |
import flash.display.Bitmap; |
|---|
| 35 |
import flash.display.BitmapData; |
|---|
| 36 |
import flash.display.Sprite; |
|---|
| 37 |
import flash.filters.BitmapFilter; |
|---|
| 38 |
import flash.filters.BitmapFilterQuality; |
|---|
| 39 |
import flash.filters.BlurFilter; |
|---|
| 40 |
|
|---|
| 41 |
public class RDSImage extends Sprite |
|---|
| 42 |
{ |
|---|
| 43 |
private var _rds:Sprite = new Sprite; |
|---|
| 44 |
private var _spdot:Sprite; |
|---|
| 45 |
private var _spdotPos:String; |
|---|
| 46 |
private var _spdotColor:uint; |
|---|
| 47 |
private var _shape:Sprite = new Sprite; |
|---|
| 48 |
private var _patternWidth:int; |
|---|
| 49 |
private var _blurSize:Number = 0; |
|---|
| 50 |
|
|---|
| 51 |
public function RDSImage(rds:Sprite, patternWidth:int, shape:BitmapData) |
|---|
| 52 |
{ |
|---|
| 53 |
var rbm:BitmapData = new BitmapData(rds.width, rds.height); |
|---|
| 54 |
_patternWidth = patternWidth; |
|---|
| 55 |
|
|---|
| 56 |
rbm.draw(rds); |
|---|
| 57 |
_rds.addChild(new Bitmap(rbm)); |
|---|
| 58 |
addChild(_rds); |
|---|
| 59 |
|
|---|
| 60 |
_spdot = new Sprite; |
|---|
| 61 |
_spdotColor = 0x000000; |
|---|
| 62 |
_spdot.graphics.beginFill(0x000000); |
|---|
| 63 |
_spdot.graphics.drawCircle(0, 0, 7); |
|---|
| 64 |
_spdot.graphics.drawCircle(_patternWidth, 0, 7); |
|---|
| 65 |
_spdot.x = _rds.width*0.5 - _spdot.width*0.5 + 3; |
|---|
| 66 |
_spdot.y = 15; |
|---|
| 67 |
_spdot.visible = false; |
|---|
| 68 |
addChild(_spdot); |
|---|
| 69 |
|
|---|
| 70 |
_shape.addChild(new Bitmap(shape.clone())); |
|---|
| 71 |
_shape.alpha = 0; |
|---|
| 72 |
addChild(_shape); |
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
public function set supportDotPosition(val:String):void{ |
|---|
| 76 |
if(val == "top") _spdot.y = 15; |
|---|
| 77 |
else if(val == "bottom") _spdot.y = _rds.height - 15; |
|---|
| 78 |
else if(val == "center") _spdot.y = _rds.height / 2 - _spdot.height / 2; |
|---|
| 79 |
} |
|---|
| 80 |
public function get supportDotPosition():String{ |
|---|
| 81 |
return(_spdotPos); |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
public function set supportDotColor(val:uint):void{ |
|---|
| 85 |
_spdotColor = val; |
|---|
| 86 |
_spdot.graphics.clear(); |
|---|
| 87 |
_spdot.graphics.beginFill(_spdotColor); |
|---|
| 88 |
_spdot.graphics.drawCircle(0, 0, 7); |
|---|
| 89 |
_spdot.graphics.drawCircle(_patternWidth, 0, 7); |
|---|
| 90 |
} |
|---|
| 91 |
public function get supportDotColor():uint{ |
|---|
| 92 |
return(_spdotColor); |
|---|
| 93 |
} |
|---|
| 94 |
|
|---|
| 95 |
public function set supportDotVisible(val:Boolean):void{ |
|---|
| 96 |
_spdot.visible = val; |
|---|
| 97 |
} |
|---|
| 98 |
public function get supportDotVisible():Boolean{ |
|---|
| 99 |
return(_spdot.visible); |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
public function set blurSize(val:Number):void{ |
|---|
| 103 |
_blurSize = val; |
|---|
| 104 |
var b:BitmapFilter = new BlurFilter(_blurSize, _blurSize, BitmapFilterQuality.HIGH); |
|---|
| 105 |
var mf:Array = new Array; |
|---|
| 106 |
mf.push(b); |
|---|
| 107 |
this.filters = mf; |
|---|
| 108 |
} |
|---|
| 109 |
public function get blurSize():Number{ |
|---|
| 110 |
return(_blurSize); |
|---|
| 111 |
} |
|---|
| 112 |
|
|---|
| 113 |
public function set shapeAlpha(val:Number):void{ |
|---|
| 114 |
_shape.alpha = val; |
|---|
| 115 |
} |
|---|
| 116 |
public function get shapeAlpha():Number{ |
|---|
| 117 |
return(_shape.alpha); |
|---|
| 118 |
} |
|---|
| 119 |
|
|---|
| 120 |
public function get bitmapData():BitmapData{ |
|---|
| 121 |
var bm:BitmapData = new BitmapData(this.width, this.height); |
|---|
| 122 |
bm.draw(this); |
|---|
| 123 |
return(bm); |
|---|
| 124 |
} |
|---|
| 125 |
|
|---|
| 126 |
} |
|---|
| 127 |
} |
|---|