for (int y=0; y<bmpihr.biHeight; y++){
for (int x=0; x<bmpihr.biWidth; x++){
switch(select_hsv){
case H:
h = (pixel_buf[((bmpihr.biHeight-1)-y)*bmpihr.biWidth+x]>>16) & 0x1ff;
if(h>=0 && h<60){
r = 255;
g = (int)(((float)h/60.0)*255.0+0.5);
b = 0;
}else if(h>=60 && h<120){
r = (int)(((120.0-(float)h)/60.0)*255+0.5);
g = 255;
b = 0;
}else if(h>=120 && h<180){
r = 0;
g = 255;
b = (int)((((float)h-120.0)/60.0)*255+0.5);
}else if(h>=180 && h<240){
r = 0;
g = (int)(((240.0-(float)h)/60.0)*255+0.5);
b = 255;
}else if(h>=240 && h<300){
r = (int)((((float)h-240.0)/60.0)*255+0.5);
g = 0;
b = 255;
}else{ // h>=300 && h<=360
r = 255;
g = 0;
b = (int)(((360.0-(float)h)/60.0)*255+0.5);
}
break;
case S:
sv = (pixel_buf[((bmpihr.biHeight-1)-y)*bmpihr.biWidth+x] >> 8) & 0xff;
break;
default: // case V:
sv = pixel_buf[((bmpihr.biHeight-1)-y)*bmpihr.biWidth+x] & 0xff;
break;
}
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | - | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | - | - | - | - | - | - |