获取Flash中最后渲染的屏幕光栅

发布于 2024-07-22 21:01:57 字数 200 浏览 3 评论 0原文

AS3中有没有办法访问舞台的最后渲染? 该渲染结果是否缓存在可访问的地方? 我特别无法自己将舞台重新渲染为位图,因为这太昂贵了,这就是我尝试使用最后一个渲染的原因。

我需要这个,因为我试图在屏幕的某些特定范围内实现一些热扭曲效果,而在 2D 中实现这一点的标准方法是使用位移图来抖动原始图像。 当然,我对在 Flash 中实现热变形的其他想法持开放态度。

Is there a way in AS3 to access the last render of the stage? Is that render result cached somewhere accessible? I specifically cannot re-render the stage myself to a Bitmap because that would be far too expensive, which is why I'm trying to use the last render.

I need this because I'm trying to do some heat-distortion effects within some specific bounds of the screen, and a standard way to do that in 2D is by using a displacement map to jitter the pristine image. Of course, I'm open to other ideas to do heat distortion in Flash.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

倒数 2024-07-29 21:01:57

我很确定我们无法访问它(尽管我真的不明白为什么)。 我知道flash只是重绘了每一帧的舞台变化。 您可以通过右键单击 Flash 调试播放器并选择“显示重绘区域”来看到这一点。

您可以尝试查看人们使用 卷积过滤器 和 < a href="http://injun.ru/flash10api/flash/filters/DisplacementMapFilter.html" rel="nofollow noreferrer">置换贴图过滤器。 以下是一些示例:

有例子似乎尽管它们的舞台尺寸相当小,但仍能以良好的速度正常工作。

I am pretty sure we do not have access to this (although I don't really see why). I know that flash only redraws the changes of the stage from frame to frame. You can see this by right clicking on the Flash Debug Player and selecting "Show Redraw Regions".

You could try looking at what people are doing with the Convolution Filter and the Displacement Map Filter. Here are some examples:

There examples seem to work fine, with good speeds, although they have quite small stage sizes.

司马昭之心 2024-07-29 21:01:57

我 99.9% 确信你不能。 我以前从未遇到过任何提及这一点的情况。 不过,这将是一个很棒的功能。 抱歉,我知道这不是特别有帮助。

I'm 99.9% sure you can't. I've never come across any mention of that before. Would be a great feature though. Sorry, I know that's not particularly helpful.

一萌ing 2024-07-29 21:01:57

您无法访问栅格,但有一个解决方法。

不要将应用程序 Sprite(或 MovieClip)放在舞台上,而是将应用程序 Sprite 绘制到位图上并将其放置在舞台上。 这样您只需渲染一次,但可以访问上次渲染的位图。

缺点是 Flash 每帧都会渲染所有应用程序精灵(而不仅仅是脏矩形)。

You cannot acces the raster, but there's a workaround.

Instead of having your application Sprite (or MovieClip) sit on the stage, draw your application sprite onto a bitmap and place that on the stage. This way you render only once, but can access the bitmap from the last render.

The downside is that that Flash renders all of your application sprite each frame (not just the dirty rectangles).

旧情别恋 2024-07-29 21:01:57

如果您不介意需要 Flash Player 10,您可以尝试自定义
Pixel Bender 滤镜附加到要扭曲的舞台或 DisplayObject。

然而,如果 Flash 像标准过滤器那样在幕后创建缓存位图,那么性能不会比创建您自己的位图更好。

If you don't mind requiring Flash Player 10 you could try a custom
Pixel Bender filter attached to the stage or DisplayObject you want to distort.

However if Flash creates a cache bitmap under the covers like it does for the standard filters then performance won't be any better than creating your own bitmap.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文