使用AS3 Flex的调整图像

编程入门 行业动态 更新时间:2024-10-19 03:23:47
本文介绍了使用AS3 Flex的调整图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我加载使用装载机的图像。一旦加载,我可以用得到位图数据位图(event.target.loader.content).bitmapData 。

I am loading an image using a Loader. Once loaded, I can get the bitmap data using Bitmap(event.target.loader.content).bitmapData.

不过由于我装是相当大的图像(2000×1600左右),我想,以减少大小和可能创建一个新的更小的位图200或300像素宽,有点像缩略图。

However since the images I am loading are quite large (around 2000 x 1600), I would like to reduce the size and create a new smaller bitmap maybe 200 or 300 pixels wide, sort of like a thumbnail.

我认为它与创建一个新的的BitmapData 与新的大小。但是我不能够得到那个工作正常。

I think it has to do with creating a new BitmapData with the new size. However I am not able to get that working properly.

任何想法?

推荐答案

没测试过,但是这应该给你一个想法:

Not tested, but this should give you an idea:

public function scaleBitmap(src: BitmapData, ratio: Number): BitmapData { var bmd: BitmapData = new BitmapData(src.width * ratio, src.height * ratio); var m: Matrix = new Matrix(); m.scale(ratio, ratio); bmd.draw(src, m); return bmd; }

更多推荐

使用AS3 Flex的调整图像

本文发布于:2023-11-23 16:03:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622060.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   Flex

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!