Program na miešanie farieb metódami RGB, CMY, HSV, HLS

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Kategória: Programy v C, C++
fapa.pngProgram: Fapa.cHelp.cHelp.hMys.cMys.h
Súbor exe: Fapa.exe
Potrebné: Egavga.bgiHelp.txtLitt.chrTrip.chr

Program ktorý názorne ukazuje spôsob miešania farieb na základe týchto metód

Použité modely sú tieto:
RGB - red, green, blue (červená, zelená, modrá)
CMY - cyan, magenta, yellow (tyrkysová, fialová, žltá)
HSV - Hue saturation value
HLS - Hue lightness value
// HELP.C                    Copyright (c) TrSek alias Zdeno Sekerak 
// Sucast programu Fapa.c. Obsahuje vsetko ohladom zobrazenia help   
// suboru. Precita subor help.txt.                                   
// Na prvej strane zobrazi jednotlive moznosti miesania farieb.      
//                                                                   
// Datum:14.12.1994                             http://www.trsek.com 
 
#include <graphics.h>
 
// nakresli obrazky v help okne
void obrazky ( void )
{
int xs,ys;
 
  xs=80,ys=80;
  setcolor(YELLOW);			/* help  RGB */
  line(64+xs,74+ys,64+xs,4+ys);
  line(64+xs,74+ys,150+xs,74+ys);
  line(64+xs,74+ys,9+xs,120+ys);
  outtextxy(68+xs,4+ys,"B modr ");
  outtextxy(9+xs,120+ys,"R Ÿerven ");
  outtextxy(140+xs,74+ys,"G zelen ");
  setcolor(DARKGRAY);
  bar3d(28+xs,52+ys,70+xs,103+ys,36,1);
  outtextxy(xs-30,ys-10,"RGB model");
  setcolor(YELLOW);
  outtextxy(64+xs,74+ys,"Ÿierna");
  outtextxy(xs,38+ys,"fialov ");
  outtextxy(75+xs,102+ys,"§lt ");
  outtextxy(110+xs,23+ys,"tyrkysov ");
  outtextxy(70+xs,39+ys,"biela");
 
  xs=80,ys=240;				/* help CMY  */
  setcolor(YELLOW);
  line(64+xs,74+ys,64+xs,4+ys);
  line(64+xs,74+ys,150+xs,74+ys);
  line(64+xs,74+ys,9+xs,120+ys);
  outtextxy(68+xs,4+ys,"Y §lt ");
  outtextxy(9+xs,120+ys,"C tyrkysov ");
  outtextxy(140+xs,74+ys,"M fialov ");
  setcolor(DARKGRAY);
  bar3d(28+xs,52+ys,70+xs,103+ys,36,1);
  outtextxy(xs-30,ys-10,"CMY model");
  setcolor(YELLOW);
  outtextxy(64+xs,74+ys,"biela");
  outtextxy(xs,38+ys,"zelen ");
  outtextxy(75+xs,102+ys,"modr ");
  outtextxy(110+xs,23+ys,"Ÿerven ");
  outtextxy(70+xs,39+ys,"Ÿierna");
 
  xs=340;ys=80;				/* help HSV  */
  setcolor(YELLOW);
  line(56+xs,15+ys,56+xs,133+ys);
  line(56+xs,133+ys,105+xs,133+ys);
  line(56+xs,133+ys,105+xs,120+ys);
  arc(53+xs,133+ys,0,20,40);
  setcolor(DARKGRAY);
  line(56+xs,133+ys,25+xs,40+ys);
  line(56+xs,133+ys,33+xs,58+ys);
  line(25+xs,40+ys,33+xs,58+ys);
  line(56+xs,133+ys,58+xs,58+ys);
  line(33+xs,58+ys,58+xs,58+ys);
  line(56+xs,133+ys,89+xs,40+ys);
  line(58+xs,58+ys,89+xs,40+ys);
  line(89+xs,40+ys,80+xs,20+ys);
  line(55+xs,20+ys,80+xs,20+ys);
  line(55+xs,20+ys,25+xs,40+ys);
  outtextxy(xs-30,ys-10,"HSV model");
  setcolor(YELLOW);
  outtextxy(-25+xs,40+ys,"tyrkysov ");
  outtextxy(20+xs,6+ys,"zelen  V");
  outtextxy(82+xs,6+ys,"§lt ");
  outtextxy(91+xs,38+ys,"Ÿerven ");
  outtextxy(15+xs,58+ys,"modr ");
  outtextxy(60+xs,58+ys,"fialov ");
  outtextxy(57+xs,40+ys,"biela");
  outtextxy(40+xs,135+ys,"Ÿierna");
  outtextxy(105+xs,105+ys,"H");
  outtextxy(105+xs,130+ys,"S");
 
  xs=340;ys=240;				/* help HLS  */
  setcolor(YELLOW);
  line(56+xs,15+ys,56+xs,133+ys);
  line(56+xs,133+ys,105+xs,133+ys);
  line(56+xs,133+ys,105+xs,120+ys);
  arc(53+xs,133+ys,0,20,40);
  setcolor(DARKGRAY);
  line(56+xs,133+ys,14+xs,75+ys);
  line(56+xs,133+ys,100+xs,75+ys);
  line(56+xs,20+ys,14+xs,75+ys);
  line(56+xs,20+ys,100+xs,75+ys);
  ellipse(56+xs,75+ys,0,360,42,12);
  outtextxy(xs-30,ys-10,"HSL model");
  setcolor(YELLOW);
  outtextxy(-25+xs,68+ys,"tyrkysov ");
  outtextxy(20+xs,49+ys,"zelen ");
  outtextxy(82+xs,49+ys,"§lt ");
  outtextxy(91+xs,66+ys,"Ÿerven ");
  outtextxy(15+xs,86+ys,"modr ");
  outtextxy(60+xs,86+ys,"fialov ");
  outtextxy(68+xs,6+ys,"biela");
  outtextxy(40+xs,135+ys,"Ÿierna");
  outtextxy(105+xs,105+ys,"H");
  outtextxy(105+xs,130+ys,"S");
}