Atitit HSV-to-GRB should prioritize the use of the HSV color principle to facilitate human

Source: Internet
Author: User

Atitit HSV -to- GRB should prioritize the use of the HSV color principle to facilitate human

1.1. 1.1.HSV color card 1

1.2. conversion from HSV to RGB 1

1.3. HSVtoRGBColorV22

1.1. 1.1.HSV color card

1.2. conversion from HSV to RGB

Similarly, given in the HSV ( h, s, v) value defines a color with theh , and those that represent saturation and lightness, respectively. s and the v varies from 0 to 1 , corresponding in the RGB space ( R, g, b Three primary colors can be calculated as:


for each color vector (R, g, b),

1.3. HSVtoRGBColorV2

public static Color HSVtoRGBColorV2 (HSV HSV) {

float h = hsv.h;

float s = hsv.s;

Float v = hsv.v;

int Hi = (int) ((H/60)% 6);

float f = (h/60)-Hi;

float p = v * (1-s);

float q = v * (1-F * s);

float T = v * (1-(1-f) * s);

Switch (Hi) {

Case 0:

Return Makecolor (V,T,P);

Case 1:

Return Makecolor (Q,V,P);

Case 2:

Return Makecolor (p,v,t);

Case 3:

Return Makecolor (P,Q,V);

Case 4:

Return Makecolor (T,P,V);

Default://Case 5:

Return Makecolor (V,P,Q);

}

Return Hsvtorgb (Hsv.h, Hsv.s, HSV.V). getRGB ();

}

Private Static Color Makecolor(float v, float v2, float v3) {

return New Color(v,v2,v3);

}

Reference

Color Space conversion of RGB to HSV (HSL) -jiangxinyu column - Blog channel -CSDN. Net.html

author::  Nickname :Old Wow's claws( Full Name::AttilaxAkbar Al Rapanui Attilaksachanui) 

Kanji Name: Etila ( Ayron) , email:[email protected]

reprint Please indicate source: http://www.cnblogs.com/attilax/

Atiend

Atitit HSV-to-GRB should prioritize the use of the HSV color principle to facilitate human

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.