void gifLabelVerticalText(char *fileName, char **labels, int labelCount, int height) /* Make a gif file with given labels. This will check to see if fileName * exists already and has not changed, and if so do nothing. */ { struct memGfx *straight = altColorLabels(labels, labelCount, height); struct memGfx *rotated = mgRotate90(straight); struct memGfx *existing = NULL; #ifdef USE_PNG struct tempName tn; makeTempName(&tn, "gifLabelVertTemp", ".png"); mgSavePng(rotated, tn.forCgi, FALSE); rename(tn.forCgi, fileName); #else if (fileExists(fileName)) existing = mgLoadGif(fileName); /* the savings here is in the user's own browser cache - not updated if no change */ if (!sameGifContents(rotated, existing)) { struct tempName tn; makeTempName(&tn, "gifLabelVertTemp", ".gif"); mgSaveGif(rotated, tn.forCgi, FALSE); rename(tn.forCgi, fileName); } #endif mgFree(&straight); mgFree(&rotated); if (existing) mgFree(&existing); }
void memPngClose(struct memPng **pG) /* Write out and close and free. */ { struct memPng *g = *pG; if (g != NULL) { struct memGfx *mg = (struct memGfx *)g; mgSavePng(mg, g->fileName, g->useTransparency); freez(&g->fileName); mgFree(&mg); *pG = NULL; } }
void gifLabelVerticalText(char *fileName, char **labels, int labelCount, int height) /* Make a gif file with given labels. This will check to see if fileName * exists already and has not changed, and if so do nothing. */ { struct memGfx *straight = altColorLabels(labels, labelCount, height); struct memGfx *rotated = mgRotate90(straight); struct memGfx *existing = NULL; struct tempName tn; makeTempName(&tn, "gifLabelVertTemp", ".png"); mgSavePng(rotated, tn.forCgi, FALSE); rename(tn.forCgi, fileName); mgFree(&straight); mgFree(&rotated); if (existing) mgFree(&existing); }