今天夜里想搞一搞easyx(doge)
R G B
饱和度H S V
HSVtoRGB :把HSV颜色转化成RGB颜色
绘制天蓝色图片
#include<easyx.h> #include<stdio.h> int main() { initgraph(800, 600); //设置背景颜色为HSV(219°,45%,95%) setbkcolor(HSVtoRGB(219, 0.45, 0.95)); cleardevice(); getchar(); closegraph(); return 0; }
绘制彩虹色窗体
#include<easyx.h> #include<stdio.h> int main() { initgraph(800, 600); //窗体高度为600,分为600份,每份增加360.0/600.0度色相 float dH = 360.0 / 600.0; float h = 0; for (int i = 0; i < 600; i++) { setlinecolor(HSVtoRGB(h, 1, 1)); line(0, i, 800, i); h += dH; } getchar(); closegraph(); return 0; }
绘制有彩虹的蓝天
🎆🎆🎆蓝天
#include<easyx.h> #include<stdio.h> int main() { initgraph(800, 600); float s = 0.76; float dS = s / 600; for (int i = 0; i < 600; i++) { setlinecolor(HSVtoRGB(216, s, 0.95)); line(0, i, 800, i); s-=dS; } getchar(); closegraph(); return 0; }
🎆🎆🎆彩虹
😎😎😎彩虹+蓝天
#include<easyx.h> #include<stdio.h> int main() { initgraph(800, 600); //天空 float s = 0.76; float dS = s / 600; for (int i = 0; i < 600; i++) { setlinecolor(HSVtoRGB(216, s, 0.95)); line(0, i, 800, i); s-=dS; } //彩虹 float h = 0; float dH = 360.0 / 100.0;//色相逐渐变化步长 for (int j = 300; j >= 200; j--) { setlinecolor(HSVtoRGB(h, 1, 1)); circle(400, 600, j); h += dH; } getchar(); closegraph(); return 0; }
Code over!