int* milyen_szinu_lehet(int pont_sorszam,model input){ int * retval,i,k = 0; int j = maxcolor(m); retval = (int*)calloc(sizeof(int), j+1);//elsõ a darabszám for(i = 1; i <= j; i++){ if (i == pont_sorszam)i++; if(!van_ilyen_szinu_szomszedja(i,pont_sorszam)){ retval[k+1] = i;k++; } } if(k ==0&&j >= MAX_color){retval[0] = 0; return retval;} if(k>0) {retval[0] = k ; return retval;} if (k ==0 && j< MAX_color) { retval[0] =1; retval[1] = j+1; return retval;} exit(-2); return retval; }
void KoUniColorChooser::updateSelectorsB() { //kDebug(30004)() <<"B selected"; quint8 data[4]; data[2] = 0; data[1] = 255; data[0] = m_BIn->value(); data[3] = 255; KoColor topleft(data, rgbColorSpace()); data[2] = 255; data[1] = 255; KoColor topright(data, rgbColorSpace()); data[2] = 0; data[1] = 0; KoColor bottomleft(data, rgbColorSpace()); data[2] = 255; data[1] = 0; KoColor bottomright(data, rgbColorSpace()); m_xycolorselector->setColors(topleft,topright,bottomleft,bottomright); data[2] = m_RIn->value(); data[1] = m_GIn->value(); data[0] = 0; KoColor mincolor(data, rgbColorSpace()); data[0] = 255; KoColor maxcolor(data, rgbColorSpace()); m_colorSlider->setColors(mincolor, maxcolor); m_xycolorselector->blockSignals(true); m_colorSlider->blockSignals(true); m_xycolorselector->setValues(m_RIn->value(), m_GIn->value()); m_colorSlider->setValue(m_BIn->value()); m_xycolorselector->blockSignals(false); m_colorSlider->blockSignals(false); }
int ft2(void){/* Egyáltalán lehetséges még a célt elérni? */ int i = maxcolor(m); if (i <= MAX_color) return 1; else return 0; }
static void generate_colorbar( FILE *htmlrep, /* Output file */ time_t begintime, time_t endtime, int alignment, /* Align by hour/day/month */ int bartype, /* Day/Week/Month/Year bar */ char *hostname, char *service, char *caption, /* Title */ replog_t *periodlog, /* Log entries for period */ reportinfo_t *repinfo) /* Info for the percent summary */ { int secsperpixel; char *pctstr = ""; replog_t *colorlog, *walk; int changeval = 0; int changealign = 0; /* * Pixel-based charts are better, but for backwards * compatibility allow for a graph that has 100 "pixels" * and adds a "%" to the width specs. */ if (usepct) { pixels = 100; pctstr = "%"; } /* How many seconds required for 1 pixel */ secsperpixel = ((endtime - begintime) / pixels); /* Need to re-sort the period-log to chronological order */ colorlog = NULL; { replog_t *tmp; for (walk = periodlog; (walk); walk = tmp) { tmp = walk->next; walk->next = colorlog; colorlog = walk; walk = tmp; } } /* Determine the back/forward link times */ switch (bartype) { case DAY_BAR : changeval = len1d; changealign = ALIGN_HOUR; break; case WEEK_BAR : changeval = len1w; changealign = ALIGN_DAY; break; case MONTH_BAR : changeval = len4w; changealign = ALIGN_DAY; break; case YEAR_BAR : changeval = len1y; changealign = ALIGN_MONTH; break; } /* Beginning of page */ fprintf(htmlrep, "<TABLE SUMMARY=\"Bounding rectangle\" WIDTH=\"%d%s\" BORDER=0 BGCOLOR=\"#666666\">\n", pixels, pctstr); fprintf(htmlrep, "<TR><TD>\n"); /* The date stamps, percent summaries and zoom/reset links */ fprintf(htmlrep, "<TABLE SUMMARY=\"%s\" WIDTH=\"100%%\" BORDER=0 FRAME=VOID CELLSPACING=0 CELLPADDING=1 BGCOLOR=\"#000033\">\n", caption); fprintf(htmlrep, "<TR BGCOLOR=%s><TD>\n", barbkgcolor); fprintf(htmlrep, " <TABLE SUMMARY=\"Adjustment, Past navigation\" WIDTH=\"100%%\" BORDER=0 CELLSPACING=0 CELLPADDING=0>\n"); if (usepct) { fprintf(htmlrep, " <TR><TD ALIGN=RIGHT VALIGN=TOP><A HREF=\"%s&PIXELS=%d\">Time reset</A></TD></TR>\n", selfurl, (usepct ? 0 : pixels)); } else { fprintf(htmlrep, " <TR><TD ALIGN=RIGHT VALIGN=TOP><A HREF=\"%s&ENDTIME=%u&PIXELS=%d\">Zoom +</A></TD></TR>\n", selfurl, (unsigned int)endtime, pixels+200); if (pixels > 200) { fprintf(htmlrep, " <TR><TD ALIGN=RIGHT VALIGN=TOP><A HREF=\"%s&ENDTIME=%u&PIXELS=%d\">Zoom -</A></TD></TR>\n", selfurl, (unsigned int)endtime, pixels-200); } } fprintf(htmlrep, " <TR><TD ALIGN=LEFT VALIGN=BOTTOM><BR>\n"); if (colorlog && colorlog->starttime <= begintime) { fprintf(htmlrep, "<A HREF=\"%s&ENDTIME=%u&PIXELS=%d\">", selfurl, calc_time(endtime, -changeval, changealign, END_UNCHANGED), (usepct ? 0 : pixels)); } fprintf(htmlrep, "<B>%s</B>", ctime(&begintime)); if (colorlog && colorlog->starttime <= begintime) fprintf(htmlrep, "</A>"); fprintf(htmlrep, "\n </TD></TR>\n"); fprintf(htmlrep, " </TABLE>\n"); fprintf(htmlrep, "</TD>\n"); fprintf(htmlrep, "<TD ALIGN=CENTER>\n"); generate_pct_summary(htmlrep, hostname, service, caption, repinfo, secsperpixel); fprintf(htmlrep, "</TD>\n"); fprintf(htmlrep, "<TD>\n"); fprintf(htmlrep, " <TABLE SUMMARY=\"Adjustment, Future navigation\" WIDTH=\"100%%\" BORDER=0 CELLSPACING=0 CELLPADDING=0>\n"); fprintf(htmlrep, " <TR><TD ALIGN=LEFT VALIGN=TOP><A HREF=\"%s&PIXELS=%d\">Time reset</A></TD></TR>\n", selfurl, (usepct ? 0 : pixels)); if (!usepct) { fprintf(htmlrep, " <TR><TD ALIGN=LEFT VALIGN=TOP><A HREF=\"%s&ENDTIME=%u&PIXELS=%d\">Zoom reset</A></TD></TR>\n", selfurl, (unsigned int)endtime, DEFPIXELS); } fprintf(htmlrep, " <TR><TD ALIGN=RIGHT VALIGN=BOTTOM><BR>\n"); fprintf(htmlrep, " <A HREF=\"%s&ENDTIME=%d&PIXELS=%d\">", selfurl, calc_time(endtime, +changeval, changealign, END_UNCHANGED), (usepct ? 0 : pixels)); fprintf(htmlrep, "<B>%s</B>", ctime(&endtime)); fprintf(htmlrep, "</A>\n"); fprintf(htmlrep, " </TD></TR>\n"); fprintf(htmlrep, " </TABLE>\n"); fprintf(htmlrep, "</TD>\n"); fprintf(htmlrep, "</TR>\n"); fprintf(htmlrep, "<TR BGCOLOR=%s><TD COLSPAN=5><HR></TD></TR>\n", barbkgcolor); fprintf(htmlrep, "</TABLE>\n"); /* The period marker line */ fprintf(htmlrep, "<TABLE SUMMARY=\"Periods\" WIDTH=\"100%%\" BORDER=0 FRAME=VOID CELLSPACING=0 CELLPADDING=0 BGCOLOR=\"#000033\">\n"); fprintf(htmlrep, "<TR>\n"); { time_t begininterval = begintime; time_t endofinterval; char tag[20]; char *bgcols[2] = { "\"#000000\"", "\"#555555\"" }; int curbg = 0; int intervalpixels, tagcolor; time_t minduration = 1800; struct tm *tmbuf; do { endofinterval = calc_time(begininterval, 0, alignment, END_END); dbgprintf("Period starts %u ends %u - %s", (unsigned int)begininterval, (unsigned int)endofinterval, ctime(&endofinterval)); tmbuf = localtime(&begininterval); switch (bartype) { case DAY_BAR : minduration = 1800; strftime(tag, sizeof(tag), "%H", tmbuf); break; case WEEK_BAR : minduration = 14400; strftime(tag, sizeof(tag), "%a", tmbuf); break; case MONTH_BAR : minduration = 43200; strftime(tag, sizeof(tag), "%d", tmbuf); break; case YEAR_BAR : minduration = 10*86400; strftime(tag, sizeof(tag), "%b", tmbuf); break; } intervalpixels = ((endofinterval - begininterval) / secsperpixel); tagcolor = maxcolor(colorlog, begininterval, endofinterval); fprintf(htmlrep, "<TD WIDTH=\"%d%s\" ALIGN=CENTER BGCOLOR=%s>", intervalpixels, pctstr, bgcols[curbg]); if ((endofinterval - begininterval) > minduration) { int dolink = (colorlog && endofinterval >= colorlog->starttime); if (dolink) fprintf(htmlrep, "<A HREF=\"%s&ENDTIME=%u&PIXELS=%d\">", selfurl, (unsigned int)endofinterval, (usepct ? 0 : pixels)); fprintf(htmlrep, "<FONT COLOR=\"%s\"><B>%s</B></FONT>", tagcolors[tagcolor], tag); if (dolink) fprintf(htmlrep, "</A>"); } fprintf(htmlrep, "</TD>\n"); curbg = (1 - curbg); if ((endofinterval + 1) <= begininterval) { /* * This should not happen! */ fprintf(htmlrep, "Time moves backwards! begintime=%u, alignment=%d, begininterval=%u\n", (unsigned int)begintime, alignment, (unsigned int)begininterval); begininterval = endtime; } begininterval = endofinterval + 1; } while (begininterval < endtime); } fprintf(htmlrep, "</TR>\n"); fprintf(htmlrep, "</TABLE>\n"); /* The actual color bar */ fprintf(htmlrep, "<TABLE SUMMARY=\"Color status graph\" WIDTH=\"100%%\" BORDER=0 FRAME=VOID CELLSPACING=0 CELLPADDING=0 BGCOLOR=\"#000033\">\n"); fprintf(htmlrep, "<TR>\n"); /* First entry may not start at our report-start time */ if (colorlog == NULL) { /* No data for period - all white */ fprintf(htmlrep, "<TD WIDTH=\"100%%\" BGCOLOR=white NOWRAP> </TD>\n"); } else if (colorlog->starttime > begintime) { /* Data starts after the bar does - so a white period in front */ int pixels = ((colorlog->starttime - begintime) / secsperpixel); if (((colorlog->starttime - begintime) >= (secsperpixel/2)) && (pixels == 0)) pixels = 1; if (pixels > 0) { fprintf(htmlrep, "<TD WIDTH=\"%d%s\" BGCOLOR=%s NOWRAP> </TD>\n", pixels, pctstr, "white"); } } for (walk = colorlog; (walk); walk = walk->next) { /* Show each interval we have data for */ int pixels = (walk->duration / secsperpixel); /* Intervals that give between 0.5 and 1 pixel are enlarged */ if ((walk->duration >= (secsperpixel/2)) && (pixels == 0)) pixels = 1; if (pixels > 0) { fprintf(htmlrep, "<TD WIDTH=\"%d%s\" BGCOLOR=%s NOWRAP> </TD>\n", pixels, pctstr, ((walk->color == COL_CLEAR) ? "white" : colorname(walk->color))); } } fprintf(htmlrep, "</TR>\n"); fprintf(htmlrep, "</TABLE>\n"); fprintf(htmlrep, "</TD>\n"); fprintf(htmlrep, "</TR>\n"); fprintf(htmlrep, "</TABLE>\n"); fprintf(htmlrep, "<BR><BR>\n"); }