Image programming in actionscript3 games (15 days in a row)

Source: Internet
Author: User
1.3.1 HSB color space model and its branches

The principle of first contact with the HSB mode starts from the following address.
Http://zh.wikipedia.org/wiki/HSL%E5%92%8CHSV%E8%89%B2%E5%BD%A9%E7%A9%BA%E9%97%B4

Figure 1.21 shows a color space copied from the previous article. It can be seen that HSB can be divided into HSL and HSV modes in the industry at least. They all use three-dimensional coordinate systems to describe the distribution of color values.

 
Figure 1.21 Color Space

The first attribute is the color, which indicates the color type, such as red, yellow, and green. The size of the color phase value comes from the visible spectrum in Physics (that is, we often call it the seven-colored Rainbow ). Among them, the red light at both ends is close to the purple light in the color form (may be related to the type of reflected color light). The great physicist Newton first round the linear color spectrum into a ring, the color and phase axes are made into loops. In such a color ring, the 0 and 360 degrees are equivalent to the red color, and other colors are arranged in the Rainbow gradient mode, respectively: Orange 30, yellow 60, green 120, blue 240 and purple 300 (the reason for uneven distribution is related to RGB processing. In fact, the distribution mode is more conducive to color matching ). After the brightness and saturation are introduced, all colors constitute a solid cylinder (essentially they can be expanded by a cone. For details, refer to the original article ). This attribute has the same understanding of HSV and HSL. In Figure 1.21, the angle indicated by the ring arrow (that is, the angle between the solid line and the dotted line, which is positive clockwise and negative counterclockwise) is equal to the value of hue.

The saturation value is represented by the distance from the coordinate point to the center of the circle (cylinder axis) in the coordinate system. The farther the saturation value is from the center of the circle, the higher the saturation, and the brighter the color. Value Range: 0 ~ 100.

The last attribute represents the brightness. The two color modes use different words (lightless and value). In the coordinate system, it represents the distance from the current point to the bottom of the cylinder. Value Range: 0 ~ 100.

In Figure 1.21, the dots on the left represent H = 240, S = 70, and L = 100 white. The dot on the right indicates the green values of H = 120, S = 67, and V = 83.

I cannot use concise statements to summarize the similarities and differences between them, but we can still see some characteristic differences through Figure 1.21:

1. the brightness of HSL is very consistent with the mathematical concept. When the brightness is 0, it must be black, and when the brightness is 100, it must be white. However, if the brightness of HSV is 0, it is black. If the brightness is 100, only one color of RGB light may be reflected.

2. the two do not have the same understanding of saturation. HSL considers that a very white color can also represent saturation, but HSV considers that a very white color must not be bright. Therefore, in the HSV mode, only when S is equal to 0 can it be completely white. S = 100, V = 100 is equivalent to L = 50 in HSL mode.

In fact, these two color modes have certain defects, such as yellow, which is usually more eye-catching than pink. However, in HSL mode, the brightness of yellow is not as high as that of pink, for example, the blue-blue mode is brighter than the blue mode, but the HSV mode tells us that the saturation of the former is lower than that of the latter.

Grayscale values (described later) can solve the above problems to some extent, but the limitations are still very large. The author once dreamed of using pure mathematical means to make up for the shortcomings of his art cell, and the results all ended in failure until a certain artist recommended me a few color software before I woke up. A colorpicker, which does not look very good, also occupies a storage space of dozens of megabytes. After checking the installation directory, it is found that the optical data table is close to 10 MB, and it is compressed. We can see that aesthetic knowledge is beyond the limit of just a few mathematical formulas. However, in any case, on behalf of programmers who have no artistic skills in the whole world, I would like to extend my high respect to the number scientists who have designed the HSB model.

Generally, software that involves a color filter uses the HSB mode, and either HSL or HSV is used. For example, Windows System Color panel and Microsoft Office use the HSL mode, while the Adobe series of software such as flash, Photoshop tends to select HSV. Because HSV software often prefers B to replace V, I often confuse the relationship between HSB, HSL, and HSV, which also leads me to a lot of detours in the following days. Therefore, when you encounter similar problems, we recommend that you first understand whether the HSB mentioned by others refers to HSL, HSV, or the color-phase model in a broad sense. I hope that my lessons will not be repeated.

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.