// FAPA.C Copyright (c) TrSek alias Zdeno Sekerak // Program ktory nazorne ukazuje sposob miesania farieb na zaklade // tychto metod: RGB, CMY, HSV alebo HLS. // Vsetko je nazorne popasane a je mozne online menit hodnoty. // // Datum:14.12.1994 http://www.trsek.com #include #include #include #include #include #include #include #include #include #include "help.h" #include "mys.h" char *tex[]={"ESC-Exit","F1-Help","","F3-RGB","F4-CMY","F5-HSV", "F6-HLS","F7-GRAY","F8-Old","F9-FAPA"}; char *col[][3]={{"BLUE","GREEN","RED"},{"YELLOW","MAGENTA","CYAN"},{"HUGE","SATURATION","VOLUME"}, {"HUGE","SYTOST","LIGHT"},{"GRAY","",""},{"","",""}, {"OLD","OLD","OLD"}}; void GetPath(char* cesta,char* args); char* JoinPath(char* cesta,char* subor); void uvod( int ); void fapa( void ); void butfree( int, int, int, int, int, int); void butput ( int, int, int, int, int, int); void button ( int, int ); void movbut ( int, int ); void uvod_kre( int , int); void prac_obr( void ); int vykonat(char *); void init_pot( void ); void oz_col ( void ); void get_rgb ( float * , int ); void put_rgb ( float * , int ); void prev_to_rgb ( void ); void prev_from_rgb ( void ); int help ( void ); void press ( void ); void change( int ); void duha ( void ); int minmax( int , int , int , int ); void zhasni( void ); int strana( int , int , char * , FILE * ); unsigned far *butmap; float butony[4],oldbut[4]; int inbut,akcol,typpa,old_akcol,po; int gmaxx,gmaxy; char cesta[128]; void main(int argv, char* args[]) { int i,y; int ch; int but,xm,ym; int pomer,pomy; float oldc[256][3]; unsigned size; int drv = DETECT, mode = 0 ; char kam[128]; // zisti cestu spustania GetPath(cesta, args[0]); detectgraph( &drv, &mode ); initgraph( &drv, &mode, JoinPath(cesta, "egavga.bgi")); setbkcolor(BLUE); cleardevice(); gmaxx=getmaxx();gmaxy=getmaxy(); size=imagesize(gmaxx-89,137,gmaxx-80,151); butmap=(unsigned int far*) _graphgetmem(size); if (butmap==NULL) inbut=0; else inbut=1; uvod_kre(1,0); for (i=0;i<=getmaxcolor();i++) get_rgb(oldc[i],i); oldc[0][1]=0;oldc[0][2]=0;oldc[0][3]=0; ch=0;randomize(); do { for (i=0;i<=getmaxcolor();i++) { if ((i!=RED) && (i!=YELLOW) && (i!=BLUE)) { butony[1]=random(gmaxy-206); butony[2]=random(gmaxy-206); butony[3]=random(gmaxy-206); put_rgb(butony,i); } } //sound(random(1000)); delay(100);nosound(); if (kbhit()) ch=getch(); } while (ch!=13); zhasni(); prac_obr(); butony[1]=1;butony[2]=1;butony[3]=1; oldbut[1]=1;oldbut[2]=1;oldbut[3]=1; getimage(gmaxx-89,137,gmaxx-80,151,butmap); typpa=3;akcol=0;old_akcol=0; button(typpa,1); init_mys(); po=0; for (i=0;i<=getmaxcolor();i++) { butony[1]=oldc[i][1];butony[2]=oldc[i][2];butony[3]=oldc[i][3]; put_rgb(butony,i); } oz_col(); do { zobmys(1); getmys( &but, &xm, &ym ); if (but==2) { ch=27;button(0,1); } if (but==1) { zobmys(0); if ((ym<=40) && (ym>=15)) { if ((xm>=20) && (xm<=70)) { button(0,1);ch=27; } if ((xm>=81) && (xm<=131)) { button(1,1);help();button(1,0);} if ((xm>=203) && (xm<=253)) { button(typpa,0);change(0);button(3,1);} if ((xm>=264) && (xm<=304)) { button(typpa,0);change(1);button(4,1);} if ((xm>=325) && (xm<=365)) { button(typpa,0);change(2);button(5,1);} if ((xm>=386) && (xm<=426)) { button(typpa,0);change(3);button(6,1);} if ((xm>=447) && (xm<=487)) { if (vykonat("Prekonvertovať na šedú škálu.")) { button(typpa,0);button(7,1); for (i=0;i<=getmaxcolor();i++) {akcol=i;oz_col(); butony[1]=i*((gmaxy-206)/getmaxcolor()); butony[2]=butony[1];butony[3]=butony[1]; butony[1]=butony[2]; oldbut[3]=butony[2];oldbut[2]=butony[2]; oldbut[1]=butony[2]; movbut(1,0);} akcol=0;duha();oz_col();change(4);button(7,1);}} if ((xm>=508) && (xm<=548)) { if (vykonat("Vrátiť pôvodné farby.")) { button(typpa,0);button(8,1);change(6); for (i=0;i<=getmaxcolor();i++) { butony[1]=oldc[i][1];butony[2]=oldc[i][2];butony[3]=oldc[i][3]; oldbut[1]=oldc[i][1];oldbut[2]=oldc[i][2];oldbut[3]=oldc[i][3]; akcol=i; movbut(1,0); } duha();typpa=3;akcol=0;oz_col();change(0); button(8,0); button(3,1);}} if ((xm>=569) && (xm<=609)) {button(9,1);fapa();button(9,0);} } if ((ym<=gmaxy-50) && (ym>=135)) { xm=gmaxx-xm; if ((xm<=93) && (xm>=77)) { do { set_mys(gmaxx-20,gmaxy/2); getmys( &but, &xm, &ym); if (ymgmaxy/2) for (i=gmaxy/2;i<=ym;i=i+2) movbut(3, 2); } while (but==1); set_mys(gmaxx-80,140); ym=0;xm=0; } if ((xm<=64) && (xm>=48)) { do { set_mys(gmaxx-50,gmaxy/2); getmys( &but, &xm, &ym); if (ymgmaxy/2) for (i=gmaxy/2;i<=ym;i=i+2) movbut(2, 2); } while (but==1); set_mys(gmaxx-50,140); ym=0;xm=0; } if ((xm<=35) && (xm>=20)) { do { set_mys(gmaxx-25,gmaxy/2); getmys( &but, &xm, &ym); if (ymgmaxy/2) for (i=gmaxy/2;i<=ym;i=i+2) movbut(1, 2); } while (but==1); set_mys(gmaxx-25,140); ym=0;xm=0; } xm=gmaxx-xm; } if ((ym>=55) && (ym<=gmaxy-50)) if ((xm>=20) && (xm<=gmaxx-107)) { pomer=((gmaxx-127)/16); pomy=getmaxcolor()/16+1; ym=ym/((gmaxy-127)/pomy); xm=(xm-20)/pomer+ym*16; if ((xm>=0) && (xm<=15)) {akcol=ym*16+xm;oz_col();} } zobmys(1); } if (kbhit()) ch=getch(); else if (ch!=27) ch=1; if (ch==27) button(0,1); if ((ch==113) || (ch==81)) movbut(3,-2); /*pre Q*/ if ((ch==119) || (ch==86)) movbut(2,-2); /*pre W*/ if ((ch==101) || (ch==69)) movbut(1,-2); /*pre E*/ if ((ch==97 ) || (ch==65)) movbut(3, 2); /*pre A*/ if ((ch==115) || (ch==83)) movbut(2, 2); /*pre S*/ if ((ch==100) || (ch==68)) movbut(1, 2); /*pre D*/ if (ch==0) { if (kbhit) { zobmys(0); ch=getch(); switch (ch) { case 59: button(1,1);help();button(1,0);break; case 61: button(typpa,0);change(0);button(3,1);break; case 62: button(typpa,0);change(1);button(4,1);break; case 63: button(typpa,0);change(2);button(5,1);break; case 64: button(typpa,0);change(3);button(6,1);break; case 65: if (vykonat("Prekonvertovať na šedú škálu.")) { button(typpa,0);button(7,1); for (i=0;i<=getmaxcolor();i++) { butony[1]=i*((gmaxy-206)/getmaxcolor()); butony[2]=butony[1];butony[3]=butony[1]; butony[1]=butony[2]; oldbut[3]=butony[2];oldbut[2]=butony[2]; oldbut[1]=butony[2]; movbut(1,0);akcol=i;oz_col();} duha();akcol=0;oz_col();change(4);button(7,1); } break; case 66: if (vykonat("Vrátiť pôvodné farby.")) { button(typpa,0);button(8,1);change(6); for (i=0;i<=getmaxcolor();i++) { butony[1]=oldc[i][1];butony[2]=oldc[i][2];butony[3]=oldc[i][3]; oldbut[1]=oldc[i][1];oldbut[2]=oldc[i][2];oldbut[3]=oldc[i][3]; akcol=i; movbut(1,0); } duha();typpa=3;akcol=0;oz_col();change(0); button(8,0); button(3,1);}break; case 67: button(9,1);fapa();button(9,0);break; case 75: if (akcol>0) akcol=akcol-1;oz_col();break; case 77: if (akcol170) && (x<220) && (y>200) && (y<220)) { konc=1; butput(170,200,220,220,3,LIGHTGRAY); outtextxy(183,200,"Ano"); } if ((x>350) && (x<400) && (y>200) && (y<220)) { konc=0; butput(350,200,400,220,3,LIGHTGRAY); outtextxy(363,200,"Nie"); } } if (kbhit()) { ch=getch(); if ((ch==65) || (ch== 97)) { konc=1; butput(170,200,220,220,3,LIGHTGRAY); outtextxy(183,200,"Ano"); } if ((ch==78) || (ch==110)) { konc=0; butput(350,200,400,220,3,LIGHTGRAY); outtextxy(363,200,"Nie"); } } } while ((konc!=0) && (konc!=1)); settextstyle(2,0,5); duha(); oz_col(); return(konc); } void butput (int x1, int y1, int x2, int y2, int but, int col) { int i; setfillstyle(1,col); bar(rcmx(x1),rcmy(y1),rcmx(x2),rcmy(y2)); setcolor(DARKGRAY); for (i=1;i<=but;i++) { line(rcmx(x2+i),rcmy(y1-i),rcmx(x1-i),rcmy(y1-i)); line(rcmx(x1-i),rcmy(y1-i),rcmx(x1-i),rcmy(y2+i)); } setcolor(WHITE); for (i=1;i<=but;i++) { line(rcmx(x2+i),rcmy(y1-i),rcmx(x2+i),rcmy(y2+i)); line(rcmx(x2+i),rcmy(y2+i),rcmx(x1-i),rcmy(y2+i)); } } void button(int porad, int ako ) { settextstyle(2,0,4); if (ako) { butput(20+porad*61, 15, 70+porad*61, 40, 3,LIGHTGRAY); setcolor(DARKGRAY); outtextxy(25+porad*61, 20, tex[porad]); if (porad>2) { oz_col(); init_pot(); } } else { butfree(20+porad*61,15,70+porad*61,40,3,LIGHTGRAY); outtextxy(25+porad*61,20,tex[porad]); } } void init_pot( void ) { int y,i; float krok; butfree(gmaxx-93,135,gmaxx-77,gmaxy-50,3,LIGHTGRAY); butfree(gmaxx-64,135,gmaxx-48,gmaxy-50,3,LIGHTGRAY); butfree(gmaxx-35,135,gmaxx-20,gmaxy-50,3,LIGHTGRAY); butfree(gmaxx-87,137,gmaxx-82,138+butony[3],2,LIGHTGRAY); butfree(gmaxx-58,137,gmaxx-53,138+butony[2],2,LIGHTGRAY); butfree(gmaxx-29,137,gmaxx-24,138+butony[1],2,LIGHTGRAY); butfree(gmaxx-93,gmaxy-35,gmaxx-77,gmaxy-15,3,LIGHTGRAY); butfree(gmaxx-64,gmaxy-35,gmaxx-48,gmaxy-15,3,LIGHTGRAY); butfree(gmaxx-35,gmaxy-35,gmaxx-20,gmaxy-15,3,LIGHTGRAY); krok=0;setcolor(DARKGRAY);y=i=0;y=y+1; if ((141<=gmaxy-56) && (((gmaxy-197)/50)>0)) for (i=141;i<=gmaxy-56;i=i+(gmaxy-197)/50,krok=krok+0.25) { line(gmaxx-93,i,gmaxx-92,i); line(gmaxx-64,i,gmaxx-63,i); line(gmaxx-35,i,gmaxx-34,i); if (krok==(y=krok)) { line(gmaxx-93,i,gmaxx-90,i); line(gmaxx-64,i,gmaxx-61,i); line(gmaxx-35,i,gmaxx-32,i); } } for (i=1;i<=3;i++) movbut(i,0); } void prac_obr( void ) { int i; setbkcolor(LIGHTGRAY); cleardevice(); setfillstyle(1,LIGHTGRAY); butfree(5,5,gmaxx-5,gmaxy-5,5,LIGHTGRAY); setfillstyle(1,BLUE); settextstyle(2,0,4); for (i=0;i<=9;i++) { if (i!=2) { butfree(20+i*61,15,70+i*61,40,3,LIGHTGRAY); outtextxy(25+i*61,20,tex[i]); } } setbkcolor(BLACK); butfree(20,55,gmaxx-107,gmaxy-50,3,BLACK); butfree(20,gmaxy-35,gmaxx-200,gmaxy-15,3,LIGHTGRAY); outtextxy(25,gmaxy-33,"FAREBNA PALETA (c) 1994, Software by TRSEK & Sille. Počítačová grafika"); butfree(gmaxx-183,gmaxy-35,gmaxx-107,gmaxy-15,3,LIGHTGRAY); outtextxy(gmaxx-178,gmaxy-33,"Percentá ->"); butfree(gmaxx-93,55,gmaxx-77,125,3,LIGHTGRAY); butfree(gmaxx-64,55,gmaxx-48,125,3,LIGHTGRAY); butfree(gmaxx-35,55,gmaxx-20,125,3,LIGHTGRAY); init_pot(); settextstyle(2,1,4); for (i=1;i<=3;i++) outtextxy(gmaxx-7-i*28,57,col[0][i-1]); duha(); } // robi efekt prelinania sa farieb void duha( void ) { int x,y,pomer,pomy; pomer=(gmaxx-127)/16; pomy=getmaxcolor()/16; if (pomy==0) pomy=1; for (y=0;y<=pomy-1;y++) for (x=20;x<=gmaxx-107;x++) { setcolor(((y*(gmaxx-127)+x-20)/pomer)); line(x,y*((gmaxy-105)/pomy)+55,x,55+(y+1)*((gmaxy-105)/pomy)); } } // zobrazi help subor int help( void ) { int font,s,y,x,but,good; char ch,re[80],re2[2]; FILE *fopen(),*f; char kam[128]; butfree(20,55,gmaxx-57,gmaxy-50,3,LIGHTGRAY); settextstyle(2,0,5); butfree(40,gmaxy-80,140,gmaxy-60,2,LIGHTGRAY); butfree(180,gmaxy-80,280,gmaxy-60,2,LIGHTGRAY); butfree(320,gmaxy-80,430,gmaxy-60,2,LIGHTGRAY); butfree(470,gmaxy-80,570,gmaxy-60,2,LIGHTGRAY); setcolor(DARKGRAY); outtextxy(50,gmaxy-81,"PgUp-Hore"); outtextxy(190,gmaxy-81,"PgDn-Dole"); outtextxy(330,gmaxy-81,"Enter-Koniec"); outtextxy(480,gmaxy-81,"Strana:"); font=installuserfont("litt"); settextstyle(font,0,6); f=fopen(JoinPath(cesta,"help.txt","r"); if (f==NULL) return(0); s=-1;re2[1]='\0'; sprintf(re,"%3d",s+1); outtextxy(536,gmaxy-81,re); do { bar(20,55,gmaxx-57,gmaxy-83); if (s==-1) { settextstyle(font,0,4); obrazky(); good=0; settextstyle(font,0,6); } else { if ((good=strana(1,s,re,f))==0) { for (y=1;y<=20;y++) { setcolor(DARKGRAY); for (x=0;x<=strlen(re);x++) { re2[0]=re[x]; if (re[x]=='@') setcolor(YELLOW); else outtextxy(40+x*8,45+y*16,re2); } if ((good=strana(0,s,re,f))!=0) y=21; } } } ch=0;zobmys(1); do { getmys(&but,&x,&y); if (but==1) { y=gmaxy-y; if ((y<80) && (y>60)) { if ((x>40) && (x<140)) { s=s-1;if (s<-1) s=-1;} if ((x>180) && (x<280)) { s=s+1;if (good!=0) s=s-1;} ch=27; if ((x>320) && (x<430)) ch=13; } } if (kbhit()) { ch=getch(); if (ch==0) ch=getch(); switch (ch) { case 73:{ s=s-1;ch=27;if (s<-1) s=-1; }break; case 81:{ s=s+1;ch=27;if (good!=0) s=s-1;}break; } } } while ((ch!=13) && (ch!=27)); zobmys(0); setcolor(LIGHTGRAY); bar(536,gmaxy-79,568,gmaxy-64); setcolor(DARKGRAY); sprintf(re,"%3d",s+1); outtextxy(536,gmaxy-81,re); } while (ch!=13); prac_obr(); oz_col(); button(typpa,1); return(0); } // zobrazi jednu stranu z helpu int strana( int ako, int s, char re[], FILE *f ) { FILE *fopen(); int i; char kam[128]; if (ako==1) { fclose(f); f=fopen(JoinPath(cesta,"help.txt","r"); i=0; do { i=i+1; fscanf(f,"%s",re); } while ((i<=s*20) && (feof(f)==0)); } else fscanf(f,"%s",re); return(feof(f)); } // pocka na stlacenie klavesu, alebo mysi void press( void ) { int ch,but,xm,ym; do { if (kbhit()) ch=getch(); getmys( &but, &xm, &ym ); if (but==2) ch=13; } while (ch!=13); } void movbut(int but, int smer ) { char s[3]; int i,buton; prev_to_rgb(); put_rgb(butony,akcol); prev_from_rgb(); for (i=1;i<=3;i++) { setcolor(LIGHTGRAY); settextstyle(2,0,4); sprintf(s,"%2.0f",(100.0*butony[i])/277); outtextxy(gmaxx-i*29-3,gmaxy-32,"███"); setcolor(DARKGRAY); outtextxy(gmaxx-i*29-3,gmaxy-32,s); } zobmys(0); butony[but]=butony[but]+smer; if (butony[but]>(gmaxy-206)) butony[but]=gmaxy-206; if (butony[but]<0) butony[but]=0; for (buton=1;buton<=3;buton++) { if (oldbut[buton]!=butony[buton]) { if (butony[buton]>oldbut[buton]) { for (i=oldbut[buton];i<=butony[buton];i++) putimage(gmaxx-buton*29-2,137+i,butmap,0); } else { for (i=oldbut[buton];i>=butony[buton];i--) putimage(gmaxx-buton*29-2,137+i,butmap,0); } } } for (i=1;i<=3;i++) oldbut[i]=butony[i]; } void put_rgb( float butony[3], int colo ) { struct palettetype paleta; getpalette(&paleta); setrgbpalette(paleta.colors[colo],(63*butony[3])/(gmaxy-206), (63*butony[2])/(gmaxy-206),(63*butony[1])/(gmaxy-206)); } void change( int poradie ) { int i; prev_to_rgb(); butfree(gmaxx-92,55,gmaxx-77,125,3,LIGHTGRAY); butfree(gmaxx-64,55,gmaxx-48,125,3,LIGHTGRAY); butfree(gmaxx-35,55,gmaxx-20,125,3,LIGHTGRAY); settextstyle(2,1,4); for (i=1;i<=3;i++) outtextxy(gmaxx-7-i*28,57,col[poradie][i-1]); typpa=poradie+3; prev_from_rgb(); } void oz_col() { int pomer,pomy; int x,y; pomer=((gmaxx-127)/16); pomy=getmaxcolor()/16+1; y=old_akcol/16;x=old_akcol-16*y; setcolor(old_akcol); line(22+x*pomer,y*((gmaxy-105)/pomy)+55,19+(x+1)*pomer,(y+1)*((gmaxy-105)/pomy)+55); line(19+(x+1)*pomer,y*((gmaxy-105)/pomy)+55,22+x*pomer,(y+1)*((gmaxy-105)/pomy)+55); line(21+x*pomer,y*((gmaxy-105)/pomy)+55,18+(x+1)*pomer,(y+1)*((gmaxy-105)/pomy)+55); line(18+(x+1)*pomer,y*((gmaxy-105)/pomy)+55,21+x*pomer,(y+1)*((gmaxy-105)/pomy)+55); pomer=((gmaxx-127)/16); pomy=getmaxcolor()/16+1; y=akcol/16;x=akcol-16*y; setcolor(WHITE); line(22+x*pomer,y*((gmaxy-105)/pomy)+55,19+(x+1)*pomer,(y+1)*((gmaxy-105)/pomy)+55); line(19+(x+1)*pomer,y*((gmaxy-105)/pomy)+55,22+x*pomer,(y+1)*((gmaxy-105)/pomy)+55); setcolor(DARKGRAY); line(21+x*pomer,y*((gmaxy-105)/pomy)+55,18+(x+1)*pomer,(y+1)*((gmaxy-105)/pomy)+55); line(18+(x+1)*pomer,y*((gmaxy-105)/pomy)+55,21+x*pomer,(y+1)*((gmaxy-105)/pomy)+55); get_rgb( butony , akcol); prev_from_rgb(); init_pot(); old_akcol=akcol; } void get_rgb( float butony[3], int colo ) { struct REGPACK in; struct palettetype paleta; getpalette(&paleta); in.r_ax=0x1015; in.r_bx=paleta.colors[colo]; intr(0x10,&in); butony[3]=((in.r_dx & 0xFF00)/0xFF)*((gmaxy-206))/63; butony[2]=((in.r_cx & 0xFF00)/0xFF)*((gmaxy-206))/63; butony[1]= (in.r_cx & 0x00FF)*((gmaxy-206))/63; } int minmax ( int a, int b, int c, int p ) { int i; if (a>b) { i=b; b=a; a=i; } if (b>c) { i=b; b=c; c=i; } if (a>b) { i=b; b=a; a=i; } if (p==1) return(a); if (p==3) return(c); return(0); } void zhasni( void ) { int i; for (i=0;i<=getmaxcolor();i++) { butony[1]=0;butony[2]=0;butony[3]=0; put_rgb(butony,i); } } void prev_to_rgb() { int i; float f,p,q,t,h,s,v; switch (typpa) { case 4:butony[1]=gmaxy-206-butony[1]; butony[2]=gmaxy-206-butony[2]; butony[3]=gmaxy-206-butony[3]; break; case 5: case 6:{ h=290*(butony[1]/(gmaxy-206)); s=(butony[2]/(gmaxy-206)); v=(butony[3]/(gmaxy-206)); h=h/60; i=h; f=h-i; p=v*(1.0-s); q=v*(1.0-(s*f)); t=v*(1-(s*(1-f))); switch (i) { case 0: butony[3]=(gmaxy-206)*v;butony[2]=(gmaxy-206)*t; butony[1]=(gmaxy-206)*p;break; case 1: butony[3]=(gmaxy-206)*q;butony[2]=(gmaxy-206)*v; butony[1]=(gmaxy-206)*p;break; case 2: butony[3]=(gmaxy-206)*p;butony[2]=(gmaxy-206)*v; butony[1]=(gmaxy-206)*t;break; case 3: butony[3]=(gmaxy-206)*p;butony[2]=(gmaxy-206)*q; butony[1]=(gmaxy-206)*v;break; case 4: butony[3]=(gmaxy-206)*t;butony[2]=(gmaxy-206)*p; butony[1]=(gmaxy-206)*v;break; case 5: butony[3]=(gmaxy-206)*v;butony[2]=(gmaxy-206)*p; butony[1]=(gmaxy-206)*q;break; } } break; } } void prev_from_rgb() { float max,min,delta; float h,s,v; switch (typpa) { case 4:butony[1]=gmaxy-206-butony[1]; butony[2]=gmaxy-206-butony[2]; butony[3]=gmaxy-206-butony[3]; break; case 5: case 6: po=po+1; if (po>3) po=2; max=minmax(butony[1],butony[2],butony[3],3); min=minmax(butony[1],butony[2],butony[3],1); v=max; s=gmaxy; if (max==0) s=0; else s=(1.0*(gmaxy-206)*(max-min))/max; if (s==0) h=0; else { delta=max-min; if (butony[3]==max) { h=(butony[2]-1.0*butony[1])/delta; } else if (butony[2]==max) { h=2+(butony[1]-1.0*butony[3])/delta; } else { h=4+(butony[3]-1.0*butony[2])/delta; } h=h*60; if (h<0) h=0; if (h>290) h=290; h=(h*(1.0*gmaxy-206)/290); } if (typpa==6) { delta=fabs(v-((gmaxy-206)/2)); delta=(gmaxy-206)/2-fabs(v-((gmaxy-206)/2)); if (delta<0) delta=0; if (s>delta) s=delta; } butony[1]=h;butony[2]=s;butony[3]=v; break; case 7:butony[1]=butony[1]; butony[2]=butony[1]; butony[3]=butony[1];break; } } // z argumentu programu zisti adresar adkial bol // spustany void GetPath(char* cesta,char* args) { int i; strcpy(cesta,args); i=strlen(args); while (cesta[--i]!='\\'); cesta[++i]='\0'; } // spoji cestu a subor do jednoho char* JoinPath(char* cesta,char* subor) { char pom[255]; strcpy(pom,cesta); strcat(pom,subor); return pom; }