로 변환 :얻을 방법의 BitmapData의 크기는 내가의 BitmapData 객체가 BYTEARRAY로 변환 한이 ByteArray
var bytes:ByteArray = bitmapDataA.getPixels(bitmapDataA.rect);
을 나는 나중에 .jpg 파일로 저장 :
writeStream.writeBytes(bytes, 0, bytes.bytesAvailable);
를 자, 내가 원하는 때
var file:File = File.documentsDirectory.resolvePath("data/"+photoNameVec[loadCounter]);
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.READ);
var fileContent:ByteArray = new ByteArray;
fileStream.readBytes(fileContent);
fileStream.close();
var bmpData:BitmapData = new BitmapData(XXX, YYY);
bmpData.setPixels(bmpData.rect, fileContent);
addChild(new Bitmap(bmpData));
그래픽을 올바르게 표시하려면 정확한 XXX 및 YYY를 가져와야합니다. 어떻게해야합니까?
편집 :
var bitmapDataA:BitmapData = new BitmapData(mpLoaderInfo.width, mpLoaderInfo.height);
var matrix:Matrix = new Matrix();
matrix.scale(1024/mpLoaderInfo.width, 768/mpLoaderInfo.height);
var bitmapDataB:BitmapData = new BitmapData(1024,768);
bitmapDataB.draw(mpLoaderInfo.content, matrix, null, null, new Rectangle(0,0,1024,768), true);
아직도 팁을 기다리고 :
된 ByteArray를 기반으로의 BitmapData 폭과 높이를 확인할 방법이 없었다, 나는이 768px X가 1024px에 내가 촬영 한 모든 사진을 변환하기로 결정 gettearray에서 너비 x 높이를 가져 오는 방법은 getPixels bitmapdata 방법입니다.
는
내 파일을 JPG로 인코딩되지 않은, 그것은 단지 원시의 BitmapData 된 ByteArray가 포함되어 있습니다. 그래서로드 된 파일은 그 내용에 비트 맵을 제공하지 않습니다 : ( – SzRaPnEL
Mayby 원하는 크기의 bytearray로 bytearray를 변환하는 방법이 있습니까? bytearrays 어딘가에 대해 들었지만, 사용법을 모릅니다. – SzRaPnEL
이 http : //help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html#loadBytes()를 사용하여 바이트 배열을 'Loader'에로드합니다. –