チェンジセット 1458
- コミット日時:
- 2008/09/30 20:09:38 (5 年前)
- ファイル:
-
- as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as (更新) (5 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPCanvas.as (更新) (6 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPCanvasWindowControl.as (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/PenDetailControlScript.as (更新) (4 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/PenDetailWindowControl.mxml (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayerArray.as (更新) (2 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLogger.as (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPPen.as (更新) (2 diffs)
- as3/gunyarapaint/trunk/nicopedia/org/libspark/nicopedia/Com.as (更新) (3 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml
r1403 r1458 139 139 private function checkImage():void { 140 140 if (MiscUtils.compareObject( 141 logcan.getPNGImage(), debugCheckPng)) { 141 logcan.dataForPost['image'], 142 debugCheckPng)) { 142 143 Alert.show('合ってる。'); 143 144 } else { as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as
r1403 r1458 1 private const DEBUG:Boolean = false;1 private const DEBUG:Boolean = true; 2 2 3 3 import flash.events.Event; … … 94 94 } 95 95 } 96 gpCanvas = gpCanvasWindow.createCanvas(canvasWidth, canvasHeight, undoBufferSize, null, null, penDetailWindow .pen);96 gpCanvas = gpCanvasWindow.createCanvas(canvasWidth, canvasHeight, undoBufferSize, null, null, penDetailWindow); 97 97 initGunyaraPaintCanvas(); 98 98 } … … 195 195 canvasWidth = baseImg.width; 196 196 canvasHeight = baseImg.height; 197 gpCanvas = gpCanvasWindow.createCanvas(0, 0, undoBufferSize, null, baseImg, penDetailWindow .pen);197 gpCanvas = gpCanvasWindow.createCanvas(0, 0, undoBufferSize, null, baseImg, penDetailWindow); 198 198 initGunyaraPaintCanvas(); 199 199 this.enabled = true; … … 272 272 new Com().postOekaki(fromTextInput.text, 273 273 messageTextArea.text, 274 gpCanvas.getPNGImage(),275 gpCanvas.compressedLog,276 274 oekakiId, 277 gpCanvas.concatLayerPNGImage, 278 gpCanvas.logCount 275 gpCanvas.dataForPost 279 276 ); 280 277 } … … 296 293 private function checkPngHandler(evt:FlexEvent):void { 297 294 if (MiscUtils.compareObject( 298 logcan.getPNGImage(), gpCanvas.getPNGImage())) { 295 logcan.dataForPost['image'], 296 gpCanvas.dataForPost['image'])) { 299 297 Alert.show('合ってる。'); 300 298 } else { as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPCanvas.as
r1403 r1458 1 1 package org.libspark.gunyarapaint.controls 2 2 { 3 import com.adobe.images.PNGEncoder;4 5 3 import flash.display.Bitmap; 6 4 import flash.display.BitmapData; … … 10 8 import flash.events.MouseEvent; 11 9 import flash.geom.Point; 12 import flash.utils.ByteArray;13 10 14 11 import mx.core.UIComponent; 15 12 import mx.managers.CursorManager; 16 13 14 import org.libspark.gunyarapaint.controls.PenDetailWindowControl; 17 15 import org.libspark.gunyarapaint.entities.GPLayerArray; 18 16 import org.libspark.gunyarapaint.entities.GPLogger; … … 46 44 47 45 private var _layerWindow:GPLayerWindowControl; // レイヤのコントロール 48 49 public function GPCanvas(width:uint, height:uint, undoBufferSize:uint, logger:GPLogger, baseData:BitmapData, initPen:GPPen) 46 private var _penDetailWindow:PenDetailWindowControl; // ペンのコントロール。 47 48 public function GPCanvas(width:uint, height:uint, undoBufferSize:uint, logger:GPLogger, baseData:BitmapData, penDetailWindow:PenDetailWindowControl) 50 49 { 51 50 this.percentHeight = 100; … … 113 112 114 113 // ペン関連の初期化 115 pen = initPen; 114 if (penDetailWindow) { 115 _penDetailWindow = penDetailWindow; 116 _pen = penDetailWindow.pen; 117 } else { 118 _pen = new GPPen(); 119 } 120 _pen.canvas = this; 116 121 _undoBuffer = new GPUndoBuffer(undoBufferSize, _layers); 117 122 … … 121 126 public function set layerWindow(lw:GPLayerWindowControl):void { 122 127 _layerWindow = lw; 128 } 129 130 public function set penDetailWindow(pdw:PenDetailWindowControl):void { 131 _penDetailWindow = pdw; 123 132 } 124 133 … … 465 474 return _log; 466 475 } 467 public function getPNGImage():ByteArray { 468 return PNGEncoder.encode(_layers.combinedBitmapData); 469 } 470 public function get compressedLog():ByteArray { 471 return _log.getCompressedLog(); 472 } 473 public function get concatLayerPNGImage():ByteArray { 474 return PNGEncoder.encode(_layers.concatBitmapData); 475 } 476 public function get logCount():uint { 477 return _log.getLogCount(); 478 } 479 476 public function get dataForPost():Object { 477 var o:Object = _layers.dataForPost; 478 o['compressed_log'] = _log.getCompressedLog(); 479 o['log_count'] = _log.getLogCount(); 480 o['info']['pen_details'] = [_penDetailWindow.dataForPost]; // TODO: 今後はpaletteが複数 481 return o; 482 } 480 483 public function completePlayLog():void { 481 484 this.dispatchEvent(new Event('completePlayLog')); as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPCanvasWindowControl.as
r1179 r1458 56 56 private var scrollDragStartPoint:Point; 57 57 58 public function createCanvas(width:uint, height:uint, undoBufferSize:uint, logger:GPLogger, baseData:BitmapData, pen :GPPen):GPCanvas {58 public function createCanvas(width:uint, height:uint, undoBufferSize:uint, logger:GPLogger, baseData:BitmapData, penDetailWindow:PenDetailWindowControl):GPCanvas { 59 59 if (!_canvas) { 60 _canvas = new GPCanvas(width, height, undoBufferSize, logger, baseData, pen );60 _canvas = new GPCanvas(width, height, undoBufferSize, logger, baseData, penDetailWindow); 61 61 //_canvas.setStyle('borderColor', 0x000000); 62 62 //_canvas.setStyle('borderStyle', 'solid'); as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/PenDetailControlScript.as
r1179 r1458 1 import org.libspark.gunyarapaint.entities.GPPen;2 3 1 import mx.containers.GridItem; 4 2 import mx.core.Application; … … 10 8 import mx.managers.PopUpManager; 11 9 10 import org.libspark.gunyarapaint.entities.GPPen; 12 11 import org.sepy.controls.SColorPicker; 13 12 import org.sepy.events.SPickerEvent; … … 20 19 import org.libspark.gunyarapaint.controls.GPCanvas; 21 20 import flash.events.Event; 21 import org.libspark.gunyarapaint.controls.PenDetailControl; 22 22 mx.core.IFlexDisplayObject; // for not erase 23 23 … … 278 278 return _pen; 279 279 } 280 281 public function get dataForPost():Object { 282 return { 283 'palettes': [ 284 gridItemPalette1.getStyle('backgroundColor'), 285 gridItemPalette2.getStyle('backgroundColor'), 286 gridItemPalette3.getStyle('backgroundColor'), 287 gridItemPalette4.getStyle('backgroundColor'), 288 gridItemPalette5.getStyle('backgroundColor'), 289 gridItemPalette6.getStyle('backgroundColor'), 290 gridItemPalette7.getStyle('backgroundColor'), 291 gridItemPalette8.getStyle('backgroundColor'), 292 gridItemPalette9.getStyle('backgroundColor'), 293 gridItemPalette10.getStyle('backgroundColor'), 294 gridItemPalette11.getStyle('backgroundColor'), 295 gridItemPalette12.getStyle('backgroundColor'), 296 gridItemPalette13.getStyle('backgroundColor'), 297 gridItemPalette14.getStyle('backgroundColor'), 298 gridItemPalette15.getStyle('backgroundColor'), 299 gridItemPalette16.getStyle('backgroundColor'), 300 gridItemPalette17.getStyle('backgroundColor'), 301 gridItemPalette18.getStyle('backgroundColor'), 302 gridItemPalette19.getStyle('backgroundColor'), 303 gridItemPalette20.getStyle('backgroundColor'), 304 gridItemPalette21.getStyle('backgroundColor') 305 ] 306 }; 307 } as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/PenDetailWindowControl.mxml
r1180 r1458 11 11 return penDetail; 12 12 } 13 public function get dataForPost():Object { 14 return [penDetail.dataForPost]; // TODO: 現在は111パレットのみだけど、配列化する 15 } 13 16 </mx:Script> 14 17 </mx:TitleWindow> as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayerArray.as
r1352 r1458 1 1 package org.libspark.gunyarapaint.entities 2 2 { 3 import com.adobe.images.PNGEncoder; 4 3 5 import flash.display.BitmapData; 4 6 import flash.display.BlendMode; … … 194 196 } 195 197 196 // レイヤーをそれぞれ縦に連結したBitmapDataを取得。宗原さまThank you! 197 public function get concatBitmapData():BitmapData { 198 // レイヤーをそれぞれ縦に連結したBitmapDataと、レイヤ情報が入ったObjectを取得。宗原さまThank you! 199 public function get dataForPost():Object { 200 // BitmapData 198 201 var cb:BitmapData = new BitmapData(_width, _height * _a.length); 202 var info:Array = new Array(); 199 203 var rect:Rectangle = new Rectangle(0, 0, _width, _height); 200 204 for (var i:uint = 0; i < _a.length; i++) { 201 205 cb.copyPixels(_a[i].bitmapData, rect, new Point(0, _height * i)); 202 } 203 return cb; 206 info.push({ 207 'lock': _a[i].lock ? 'true' : 'false', 208 'visible': _a[i].show ? 'true' : 'false', 209 'blendMode': _a[i].blendMode 210 }); 211 } 212 return { 213 'image': PNGEncoder.encode(_combinedBitmapData), 214 'layers_image': PNGEncoder.encode(cb), 215 'info': { 216 'layer_infos': info 217 } 218 }; 204 219 } 205 220 as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLogger.as
r1307 r1458 78 78 public function createViewerCanvas(baseImg:BitmapData):GPCanvas { 79 79 resetPosition(); 80 var pen:GPPen = new GPPen(); 81 var canvas:GPCanvas = new GPCanvas(width, height, undoBufferSize, this, baseImg, pen); 80 var canvas:GPCanvas = new GPCanvas(width, height, undoBufferSize, this, baseImg, null); 82 81 return canvas; 83 82 } as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPPen.as
r1344 r1458 10 10 import flash.geom.Point; 11 11 12 import mx.controls.Alert; 13 12 14 import org.libspark.gunyarapaint.controls.GPCanvas; 13 15 import org.libspark.gunyarapaint.controls.GPCanvasWindowControl; 14 16 import org.libspark.gunyarapaint.controls.PenDetailControl; 15 16 import mx.controls.Alert;17 17 18 18 public class GPPen … … 365 365 _previewShape.graphics.moveTo(GPCanvas.zz(fromX), GPCanvas.zz(fromY)); 366 366 _previewShape.graphics.lineTo(GPCanvas.zz(toX), GPCanvas.zz(toY)); 367 } 367 } 368 368 } 369 369 } as3/gunyarapaint/trunk/nicopedia/org/libspark/nicopedia/Com.as
r1403 r1458 2 2 { 3 3 import flash.display.DisplayObject; 4 4 import com.adobe.serialization.json.JSON; 5 5 import mx.core.UIComponent; 6 6 … … 90 90 } 91 91 92 public function postOekaki(name:String, msg:String, 93 image:ByteArray, log:ByteArray, ref_oekaki_id:uint, 94 image_layers:ByteArray, log_count:uint):void { 92 public function postOekaki(name:String, msg:String, ref_oekaki_id:uint, data:Object):void { 95 93 var r:URLRequest = new URLRequest(); 96 94 var v:URLVariables = new URLVariables(); 97 95 var b:ByteArray = new ByteArray(); 98 99 96 v.cookie = cookie; 100 97 v.magic = magic; … … 102 99 v.MESSAGE = msg; 103 100 v.ref_oekaki_id = ref_oekaki_id; 104 v.log_count = log_count;101 v.log_count = data['log_count']; 105 102 var form:String = v.toString(); 106 103 b.writeUTFBytes(':' + form.length + '=' + form); 107 b.writeUTFBytes('&IMAGE:' + image.length + '='); 108 b.writeBytes(image); 109 b.writeUTFBytes('&IMAGE_LOG:' + log.length + '='); 110 b.writeBytes(log); 111 b.writeUTFBytes('&IMAGE_LAYERS:' + image_layers.length + '='); 112 b.writeBytes(image_layers); 104 b.writeUTFBytes('&IMAGE:' + data['image'].length + '='); 105 b.writeBytes(data['image']); 106 b.writeUTFBytes('&IMAGE_LOG:' + data['compressed_log'].length + '='); 107 b.writeBytes(data['compressed_log']); 108 b.writeUTFBytes('&IMAGE_LAYERS:' + data['layers_image'].length + '='); 109 b.writeBytes(data['layers_image']); 110 v.info = JSON.encode(data['info']); 113 111 r.url = postUrl; 114 r.method = URLRequestMethod.POST; 112 r.method = URLRequestMethod.POST; 115 113 r.contentType = 'application/x-nicopedia-oekaki'; 116 114 r.data = b;

