- 浏览: 80297 次
- 性别:
- 来自: 四川
最新评论
-
iceblue510808:
你好,能给我发下你写的这个吗?想学习下,谢谢了Adobe Bu ...
Flex图文混排 -
sxy09:
diding 写道xingfustar 写道哥们,够狠,可以共 ...
Flex图文混排 -
sxy09:
给份源码吧,学习研究下 419119915@qq.com
Flex图文混排之后期开发 -
zhangxiaopei:
哥,你还在吗?能发一份源码给我吗?谢谢,不甚感激邮箱:zhan ...
Flex图文混排之后期开发 -
zhangxiaopei:
兄弟能给源码给我吗?谢谢邮箱zhangoceansoft@12 ...
Flex图文混排
一个老外的比较有用的类,自已整合到自已的utls包中:
1.用法:
2.类源文件:JPGSizeExtractor.as
1.用法:
import flash.events.Event; import net.diding.utils.JPGSizeExtractor; private var je:JPGSizeExtractor; private function DDinit():void { je=new JPGSizeExtractor(); je.addEventListener(JPGSizeExtractor.PARSE_COMPLETE, sizeHandler); je.extractSize("http://192.168.1.102/buzzword/bin-debug/hpde.jpg"); } private function sizeHandler(e:Event):void { trace("Dimensions: " + je.width + " x " + je.height); }
2.类源文件:JPGSizeExtractor.as
package net.diding.utils { import flash.net.URLStream; import flash.net.URLRequest; import flash.events.Event; import flash.events.ProgressEvent; import flash.utils.Endian; public class JPGSizeExtractor extends URLStream { protected static const SOF0:Array=[0xFF, 0xC0, 0x00, 0x11, 0x08]; public static const PARSE_COMPLETE:String="parseComplete"; public static const PARSE_FAILED:String="parseFailed"; protected var dataLoaded:uint; protected var jpgWidth:uint; protected var jpgHeight:uint; protected var jumpLength:uint; protected var stopWhenParseComplete:Boolean; protected var traceDebugInfo:Boolean; public function JPGSizeExtractor() { endian=Endian.BIG_ENDIAN; } protected function jumpBytes(count:uint):void { for (var i:uint=0; i < count; i++) { readByte(); } } protected function progressHandler(e:ProgressEvent):void { dataLoaded=bytesAvailable; var APPSections:Array=new Array(); for (var i:int=1; i < 16; i++) { APPSections[i]=[0xFF, 0xE0 + i]; } var index:uint=0; var byte:int=0; var address:int=0; while (bytesAvailable >= SOF0.length + 4) { var match:Boolean=false; // Only look for new APP table if no jump is in queue if (jumpLength == 0) { byte=readUnsignedByte(); address++; // Check for APP table for each (var APP:Array in APPSections) { if (byte == APP[index]) { match=true; if (index + 1 >= APP.length) { if (traceDebugInfo) trace("APP" + Number(byte - 0xE0).toString(16).toUpperCase() + " found at 0x" + address.toString(16).toUpperCase()); // APP table found, skip it as it may contain thumbnails in JPG (we don't want their SOF's) jumpLength=readUnsignedShort() - 2; // -2 for the short we just read } } } } // Jump here, so that data has always loaded if (jumpLength > 0) { if (traceDebugInfo) trace("Trying to jump " + jumpLength + " bytes (available " + Math.round(Math.min(bytesAvailable / jumpLength, 1) * 100) + "%)"); if (bytesAvailable >= jumpLength) { if (traceDebugInfo) trace("Jumping " + jumpLength + " bytes to 0x" + Number(address + jumpLength).toString(16).toUpperCase()); jumpBytes(jumpLength); match=false; jumpLength=0; } else break; // Load more data and continue } else { // Check for SOF if (byte == SOF0[index]) { match=true; if (index + 1 >= SOF0.length) { // Matched SOF0 if (traceDebugInfo) trace("SOF0 found at 0x" + address.toString(16).toUpperCase()); jpgHeight=readUnsignedShort(); jpgWidth=readUnsignedShort(); if (traceDebugInfo) trace("Dimensions: " + jpgWidth + " x " + jpgHeight); removeEventListener(ProgressEvent.PROGRESS, progressHandler); // No need to look for dimensions anymore if (stopWhenParseComplete && connected) close(); dispatchEvent(new Event(PARSE_COMPLETE)); break; } } if (match) { index++; } else { index=0; } } } } protected function fileCompleteHandler(e:Event):void { if (!jpgWidth || jpgHeight) dispatchEvent(new Event(PARSE_FAILED)); } public function extractSize(fileURL:String, stopWhenParsed:Boolean=true):void { addEventListener(ProgressEvent.PROGRESS, progressHandler); addEventListener(Event.COMPLETE, fileCompleteHandler); dataLoaded=0; jumpLength=0; if (traceDebugInfo) trace("Started loading '" + fileURL + "'"); stopWhenParseComplete=stopWhenParsed; super.load(new URLRequest(fileURL)); } public function get loaded():uint { return dataLoaded; } public function get width():uint { return jpgWidth; } public function get height():uint { return jpgHeight; } public function set debug(newDebug:Boolean):void { traceDebugInfo=newDebug; } public function get debug():Boolean { return traceDebugInfo; } } }
发表评论
-
Flex 4.5 – Using Mobile View Transitions
2011-05-18 16:45 2475收录的一篇文章: 原文地址:http://devgirl.or ... -
Flex Array多参数排名(含有并列名次)
2011-04-25 21:52 1481最近有一个项目,客户不仅要求报表同时呈现: 1.员工在整个公司 ... -
从数据库读取数据并在Tree上分组呈现
2011-04-06 23:34 2335最近有一项目,需要从mysql数据库读取数据,到Flex中呈现 ... -
Flex Air 周边整合之碎语
2011-03-05 20:13 2012手边近期有一个项目( ... -
SDK 4.5 (Hero)TextLayout 随记
2010-11-15 22:24 4102TextLayout前沿更新: http://sourcefo ... -
Flex4.5 Hero
2010-11-06 21:03 3027Flex4.5 已在10.24发布,今天终于静下来玩玩它了 下 ... -
Flex4 Declarations in ActionScript
2010-11-02 20:26 2996抽空整理Cairgorn3时,由于喜欢Code,而不喜欢Blo ... -
AS3公历转农历和农历转公历
2010-11-01 21:49 528今天例行整理硬盘中的文件时,看到收录一篇JAVA农历转公历的类 ... -
Flex DataGrid 内嵌AutoCompleteDataGrid
2010-10-27 23:26 1042这个东东是根据flashcommand的AutoComplet ... -
Flex DataGrid 内嵌ComboBox 再内嵌一个 DataGrid
2010-10-27 23:10 1484由于设计需要,曾要用到一个功能模块,但由于数据量的问题,最终p ... -
美发城的烫染护理系统和仓库管理软件
2010-10-27 23:06 1097这段时间,做了两个软件:美发城的烫染护理系统和仓库管理软件 P ... -
Flash Builder 4 的一个作品
2009-07-27 10:33 7887月17日放假,到现在完成了一个网站,记录一下 http:// ... -
Flex存bmp图像
2009-03-28 12:13 2165前言: 这阵子没事在研究buzzword,并试图还原前台,费 ... -
Flex图文混排之后期开发
2009-03-07 22:14 6735一:now SDK: flex_sdk_4.0.0.61 ... -
纯AS的RemoteAMF3
2009-03-03 23:35 1568[纯AS的RemoteAMF3] 目前支持:AMFPHP,C ... -
FxTextArea插入图片后,图片上方空隙的解决
2009-03-02 21:51 2383由于开发一个运行期间由用户来设置dg表,无意间打开Navica ... -
Flex Datagrid 行列增加和删除(支持右键)
2009-03-02 19:28 12012目前能实现的功能: 1.支持编辑表头; 2.删除添加自动更新序 ... -
Flex提交Datagrid数据存为xml
2009-03-01 14:38 3131Flex 代码区 MyDataDG为datagrid,执行提 ... -
采用AS开发Module
2009-03-01 13:34 12521.采用ModuleLoader /********** ... -
Flex图文混排
2009-03-01 13:26 7010这几天没事,学习Gumbo的FxTextArea,开发了一个F ...
相关推荐
VC 获取图像长宽大小,并不是字节大小,而得到图像的高度像素值和宽度像素值。程序运行后,点击“获取大斜像素后,即可显示出图像的宽度和高度。
Halcon学习之六:获取Image图像中Region区域的特征参数
oracle获取图像属性,包含宽度、高度等信息。代码形式是包+函数,可自己扩充获取其他属性的函数。 调用: select blob_img.get_width(t.blob字段), blob_img.get_height(t.blob字段) from 表名t;
编写程序,对灰度图像进行二值分割,并进行 基本的图像分析。(图像可以自行搜集,要求图像中应有多个目 ...3)单独计算目标一的面积、周长。 4)求各个目标的最小外接矩形及长宽比。 5)程序有GUI。
soft_用ASP判断图像长宽的组件.zip.zip
目前我们常用的获取图片实际宽度高度的方法,要么是在DOM中写入,要么就是等图片加载完毕后才开始获取,用户体验极其不好,今天特意整理一个办法,可以让javascript在html加载完毕后就可以立即获取img文件的头数据...
C#获取桌面大小源码 长宽像素
② 适合宽度:保持图像长宽比例缩放图像,使图像宽度等于视图宽度。 ③ 适合高度:保持图像长宽比例缩放图像,使图像高度等于视图高度。 ④ 适合屏幕:自动判断图像的显示方式,使图像能在当前视图上完整显示。 ⑶ ...
通过CRC计算图片的宽度个高度,CTF比赛类题目,一个图片CRC校验没有错误,但是图片不全,可能是因为高度和宽度不够。
② 适合宽度:保持图像长宽比例缩放图像,使图像宽度等于视图宽度。 ③ 适合高度:保持图像长宽比例缩放图像,使图像高度等于视图高度。 ④ 适合屏幕:自动判断图像的显示方式,使图像能在当前视图上完整显示。 ⑶ ...
首先通过水平集以及形态学方法获得预处理后的目标图像,利用PCA算法获取SAR图像舰船目标的长轴,结合最小二乘椭圆拟合方法获取舰船目标的短轴,最终得到舰船目标的长宽特征。通过实测SAR图像处理结果表明,该方法能够在...
需要获得图片的长宽,在IE、FireFox下均正常,就TMD在Chrome中不行,有人说是Chrome版本的问题,最终终于找到了解决方法,在这与大家分享下
不需要加载整个图像,即可获得图片的宽高信息
针对现有煤层图像裂隙识别方法未较好地考虑裂隙的形态特征或未较好地获取裂隙的整体信息的问题,通过分析煤层图像及其不同灰度阈值下二值图中裂隙的形态特征,定义了煤层裂隙判定系数,并取二值图中区域的长度、宽度和...
完全是源码,用vs2012开发,不过,把类拿 过去 ,直接调用就可以了,我用的是2.0编译的,纯源码,希望 大家喜欢
② 适合宽度:保持图像长宽比例缩放图像,使图像宽度等于视图宽度。 ③ 适合高度:保持图像长宽比例缩放图像,使图像高度等于视图高度。 ④ 适合屏幕:自动判断图像的显示方式,使图像能在当前视图上完整显示。 ⑶ ...
(2)通过文件内容得出文件大小、位图数据起始字节、图像长宽及每像素的位数等信息; (3)提取出原图像中的位图数据,另存为lena.raw,并通过Photoshop打开改文件,查看所读取的数据; (4)仅取原始图像左上角1/...
一个实现对图像进行双线性内插算法的程序代码
QT基于C语言读图片的宽高,支持gif、bmp、jpg、png,分数最高只能这么多,有点少了
② 适合宽度:保持图像长宽比例缩放图像,使图像宽度等于视图宽度。 ③ 适合高度:保持图像长宽比例缩放图像,使图像高度等于视图高度。 ④ 适合屏幕:自动判断图像的显示方式,使图像能在当前视图上完整显示。 ⑶ ...