Image programming in actionscript3 games (serialization 90)

Source: Internet
Author: User

Total Directory: http://blog.csdn.net/iloveas2014/article/details/38304477

4.5.4 handle the ringing phenomenon

The above correction Matrix cannot be used to eliminate the ringing phenomenon. In flash IDE, We have optimized the filter details by improving the quality. According to the description in the Help file, the quality is actually the number of Fuzzy Operations. Therefore, we may wish to use this method for processing.

 

First, write the value in the getconfilter method to 1. We use the absolute mean matrix. Then, set the filter code:

 

var con:ConvolutionFilter = getConFilter(20, 0, false) _main_txt.filters = [con, con];

 

I wrote the creation of convolutionfilter separately to facilitate modification and avoid unnecessary duplicate creation of code. The effect is 4.58.

 

 

Figure 4.58 perform two convolution operations on Text

 

There is a big gap between the blurfilter and the Medium-quality blurfilter (Figure 4.59). The Blur degree is serious. Indeed, the Blur range is doubled for each blur. Therefore, first, we need to reduce the matrix size of convolutionfilter by half, and then we can offset the impact of the two mod-fuzzy operations. That is, the first parameter of getconfilter is changed to 10.

 

Figure 4.59 quality flash fuzzy Filter


Run again to get the effect of 4.60. The Blur degree is close, but there is a new problem: Because the Blur range is smaller, the color is obviously deeper.

 

Figure 4.60 halving the matrix size

 

At this time, we naturally think of the impact of divisor. Remove the filter by 0.5 to fade the color. The result is consistent with that of the Medium-quality fuzzy filter (Figure 4.61 ).

 

Figure 4.61 effect after removing factor 0.5

 

Due to space limitations, high quality, or blurx is not equal to blury, I will not show you one by one here. Interested readers can test it on their own.

 

So far, the algorithm principle of Flash simple filter has been completely revealed, and fuzzy is actually the result of the mean filtering matrix. In general, the calculation formula is relatively simple and the processing steps are relatively small. Although some sacrifices have been made in terms of quality, the result is a relatively fast execution speed, let the CPU do more.

 

According to relevant data, the projection Fuzzy Algorithm in Photoshop is also medium-quality fuzzy (Figure 4.62). The conclusion was tested by the author and is basically reliable. Because the number of Fuzzy Operations is equal to 2, it is called the quadratic mean Filtering Algorithm in graphics (graphics are irrelevant to flash and cannot be described from the visual angle, how can we use the perceptual word "quality ). Of course, the fuzzy algorithms in Photoshop are far more than this. They are not based on convolutionfilter, so we will not discuss them here.

 

Figure 4.62 fuzzy projection in Photoshop

 

Since the algorithm can penetrate into every pixel, we can use mathematical formulas to implement the filter algorithm after having the pixel-level tool bitmapdata, in addition to helping you implement more complex layers in Photoshop, it can also be easily transferred to any advanced language that supports image programming (the reason for speaking a high-level language is because a low-level language like assembly, there are few operational instructions and it is quite difficult to implement them. For example, Starling's fuzzy filter uses the agal assembly language in part, if you are interested, you can check starling's source file to study its algorithm) without worrying about whether it has built-in filters.

 


 

Image programming in actionscript3 games (serialization 90)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.