Permalink
Browse files

Support generating index-color PNG files

Based on the request http://stackoverflow.com/questions/27036474/how-do-make-doxygen-generate-index-color-png-files for index colored png files, this functionality will be included in the newer versions (2.39) of dot.
The functionality -Tpng:cairo:gd will automatically be used by doxygen, though the file extension would be wrong (.png:cairo:gd).
With this patch the :cairo:gd is stripped from the image extension, but not from the -T of the dot command.
In the doxywizard the different possibilities are supplied as well. Note however that the DOT_IMAGE_FORMAT name is not checked when read from the Doxyfile so it is possible to use other renderer / formats as well due to the generic solution with getDot ImageExtension.
  • Loading branch information...
albert-github committed Feb 8, 2015
1 parent 5bfda3d commit a09ffed2f603699955c18c19e0d3e782fb61d93f
@@ -3271,7 +3271,9 @@ to be found in the default search path.
<docs>
<![CDATA[
The \c DOT_IMAGE_FORMAT tag can be used to set the image format of the images
generated by \c dot.
generated by \c dot. For an explanation of the image formats see the section output formats
in the documentation of the \c dot tool
(<a href="http://www.graphviz.org/">Graphviz</a>).
\note If you choose \c svg you need to set
\ref cfg_html_file_extension "HTML_FILE_EXTENSION" to \c xhtml in order to make the SVG files
visible in IE 9+ (other browsers do not have this requirement).
@@ -3281,6 +3283,14 @@ to be found in the default search path.
<value name='jpg'/>
<value name='gif'/>
<value name='svg'/>
<value name='png:gd'/>
<value name='png:gd:gd'/>
<value name='png:cairo'/>
<value name='png:cairo:gd'/>
<value name='png:cairo:cairo'/>
<value name='png:cairo:gdiplus'/>
<value name='png:gdiplus'/>
<value name='png:gdiplus:gdiplus'/>
</option>
<option type='bool' id='INTERACTIVE_SVG' defval='0' depends='HAVE_DOT'>
<docs>
@@ -1350,7 +1350,7 @@ void DocbookDocVisitor::startDotFile(const QCString &fileName,
}
baseName.prepend("dot_");
QCString outDir = Config_getString("DOCBOOK_OUTPUT");
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP);
m_t << "<para>" << endl;
visitPreStart(m_t, hasCaption, baseName + "." + imgExt, width, height);
@@ -659,7 +659,8 @@ static bool writeSVGFigureLink(FTextStream &out,const QCString &relPath,
// support the PNG format, we need to check the result.
static void checkDotResult(const QCString &imgName)
{
if (Config_getEnum("DOT_IMAGE_FORMAT")=="png")
QCString imgExt = getDotImageExtension();
if (imgExt=="png")
{
FILE *f = portable_fopen(imgName,"rb");
if (f)
@@ -2273,7 +2274,8 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out,
{
QDir d(path);
QCString baseName;
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
baseName.sprintf("inherit_graph_%d",id);
QCString imgName = baseName+"."+ imgExt;
QCString mapName = baseName+".map";
@@ -2323,7 +2325,7 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out,
resetReNumbering();
DotRunner *dotRun = new DotRunner(dotName,d.absPath().data(),TRUE,absImgName);
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(imgFmt,absImgName);
dotRun->addJob(MAP_CMD,absMapName);
DotManager::instance()->addRun(dotRun);
}
@@ -3128,7 +3130,8 @@ QCString DotClassGraph::writeGraph(FTextStream &out,
baseName = convertNameToFile(diskName());
// derive target file names from baseName
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -3156,7 +3159,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out,
{
DotRunner *dotRun = new DotRunner(absDotName,
d.absPath().data(),TRUE,absImgName);
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(imgFmt,absImgName);
if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName);
DotManager::instance()->addRun(dotRun);
@@ -3484,7 +3487,8 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out,
QCString mapName=escapeCharsInString(m_startNode->m_label,FALSE);
if (m_inverse) mapName+="dep";
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -3512,7 +3516,7 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out,
{
// run dot to create a bitmap image
DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName);
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(imgFmt,absImgName);
if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName);
DotManager::instance()->addRun(dotRun);
}
@@ -3796,7 +3800,8 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma
QCString baseName = m_diskName + (m_inverse ? "_icgraph" : "_cgraph");
QCString mapName = baseName;
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -3824,7 +3829,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma
{
// run dot to create a bitmap image
DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName);
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(imgFmt,absImgName);
if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName);
DotManager::instance()->addRun(dotRun);
@@ -3950,7 +3955,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
QCString baseName=m_dir->getOutputFileBase()+"_dep";
QCString mapName=escapeCharsInString(baseName,FALSE);
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -3988,7 +3994,7 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
{
// run dot to create a bitmap image
DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName);
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(imgFmt,absImgName);
if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName);
DotManager::instance()->addRun(dotRun);
}
@@ -4113,7 +4119,8 @@ void generateGraphLegend(const char *path)
MD5SigToString(md5_sig,sigStr.rawData(),33);
QCString absBaseName = (QCString)path+"/graph_legend";
QCString absDotName = absBaseName+".dot";
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgName = "graph_legend."+imgExt;
QCString absImgName = absBaseName+"."+imgExt;
if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
@@ -4133,7 +4140,7 @@ void generateGraphLegend(const char *path)
// run dot to generate the a bitmap image from the graph
DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName);
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(imgFmt,absImgName);
DotManager::instance()->addRun(dotRun);
}
else
@@ -4161,14 +4168,15 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir,
err("Output dir %s does not exist!\n",outDir); exit(1);
}
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgName = (QCString)outFile+"."+imgExt;
QCString absImgName = d.absPath().utf8()+"/"+imgName;
QCString absOutFile = d.absPath().utf8()+"/"+outFile;
DotRunner dotRun(inFile,d.absPath().data(),FALSE,absImgName);
if (format==GOF_BITMAP)
dotRun.addJob(imgExt,absImgName);
dotRun.addJob(imgFmt,absImgName);
else // format==GOF_EPS
{
if (Config_getBool("USE_PDFLATEX"))
@@ -4216,7 +4224,8 @@ void writeDotImageMapFromFile(FTextStream &t,
}
QCString mapName = baseName+".map";
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgName = baseName+"."+imgExt;
QCString absOutFile = d.absPath().utf8()+"/"+mapName;
@@ -4511,7 +4520,8 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t,
QCString sigStr(33);
MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
MD5SigToString(md5_sig,sigStr.rawData(),33);
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString baseName = m_diskName;
QCString imgName = baseName+"."+imgExt;
QCString absPath = d.absPath().data();
@@ -4541,7 +4551,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t,
if (graphFormat==GOF_BITMAP) // run dot to create a bitmap image
{
DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE);
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(imgFmt,absImgName);
if (writeImageMap) dotRun->addJob(MAP_CMD,absMapName);
DotManager::instance()->addRun(dotRun);
@@ -2001,7 +2001,7 @@ void HtmlDocVisitor::writeMscFile(const QCString &fileName,
}
baseName.prepend("msc_");
QCString outDir = Config_getString("HTML_OUTPUT");
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
MscOutputFormat mscFormat = MSC_BITMAP;
if ("svg" == imgExt)
mscFormat = MSC_SVG;
@@ -2045,7 +2045,7 @@ void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName,
baseName=baseName.left(i);
}
static QCString outDir = Config_getString("HTML_OUTPUT");
static QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
if (imgExt=="svg")
{
generatePlantUMLOutput(fileName,outDir,PUML_SVG);
@@ -3266,7 +3266,8 @@ void writeGraphInfo(OutputList &ol)
QCString legendDocs = theTranslator->trLegendDocs();
int s = legendDocs.find("<center>");
int e = legendDocs.find("</center>");
if (Config_getEnum("DOT_IMAGE_FORMAT")=="svg" && s!=-1 && e!=-1)
QCString imgExt = getDotImageExtension();
if (imgExt=="svg" && s!=-1 && e!=-1)
{
legendDocs = legendDocs.left(s+8) + "[!-- SVG 0 --]\n" + legendDocs.mid(e);
//printf("legendDocs=%s\n",legendDocs.data());
@@ -1676,7 +1676,8 @@ void RTFDocVisitor::writeDotFile(const QCString &fileName)
m_t << "{" << endl;
m_t << rtf_Style_Reset;
m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
m_t << baseName << "." << Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
m_t << baseName << "." << imgExt;
m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
m_t << "}" << endl;
m_lastIsPara=TRUE;
@@ -2435,7 +2435,8 @@ void RTFGenerator::endDotGraph(const DotClassGraph &g)
t << "{" << endl;
t << rtf_Style_Reset << endl;
t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
t << fn << "." << Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
t << fn << "." << imgExt;
t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
t << "}" << endl;
newParagraph();
@@ -2458,7 +2459,8 @@ void RTFGenerator::endInclDepGraph(const DotInclDepGraph &g)
t << "{" << endl;
t << rtf_Style_Reset << endl;
t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
t << fn << "." << Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
t << fn << "." << imgExt;
t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
t << "}" << endl;
DBG_RTF(t << "{\\comment (endInclDepGraph)}" << endl)
@@ -2488,7 +2490,8 @@ void RTFGenerator::endCallGraph(const DotCallGraph &g)
t << "{" << endl;
t << rtf_Style_Reset << endl;
t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
t << fn << "." << Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
t << fn << "." << imgExt;
t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
t << "}" << endl;
DBG_RTF(t << "{\\comment (endCallGraph)}" << endl)
@@ -2510,7 +2513,8 @@ void RTFGenerator::endDirDepGraph(const DotDirDeps &g)
t << "{" << endl;
t << rtf_Style_Reset << endl;
t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
t << fn << "." << Config_getEnum("DOT_IMAGE_FORMAT");
QCString imgExt = getDotImageExtension();
t << fn << "." << imgExt;
t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
t << "}" << endl;
DBG_RTF(t << "{\\comment (endDirDepGraph)}" << endl)
@@ -994,7 +994,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0
"};\n"
"\\endcode\n"
"Սրանով կստանանք հետևյալ գրաֆը."
"<p><center><img src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"Այս գրաֆի ուղղանկյունները ունեն հետևյալ իմաստը.\n"
"<ul>\n"
@@ -1044,7 +1044,7 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6
"\\endcode\n"
"If the \\c MAX_DOT_GRAPH_HEIGHT tag in the configuration file "
"is set to 240 this will result in the following graph:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"The boxes in the above graph have the following meaning:\n"
"<ul>\n"
@@ -1007,7 +1007,7 @@ class TranslatorBrazilian : public Translator
"};\n"
"\\endcode\n"
"Isto irá gerar o seguinte gráfo:"
"<p><center><img src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"As caixas no grafo acima tem as seguintes interpretações:\n"
"<ul>\n"
@@ -1019,7 +1019,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0
"};\n"
"\\endcode\n"
"Resultarà el gràfic següent:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"Les caixes del gràfic superior tenen aquesta interpretació:\n"
"<ul>\n"
@@ -910,7 +910,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_2
"};\n"
"\\endcode\n"
"结果将会生成以下图:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center></p>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center></p>\n"
"<p>\n"
"上图中的矩形有如下意义:\n"
"</p>\n"
@@ -1070,7 +1070,7 @@ class TranslatorCzech : public Translator
"};\n"
"\\endcode\n"
"K výše uvedenému bude vygenerován následující graf:"
"<p><center><img src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"Bloky (tj. uzly) v uvedeném grafu mají následující význam:\n"
"<ul>\n"
@@ -1116,7 +1116,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_4
"};\n"
"\\endcode\n"
"Dies liefert den folgenden Graphen:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center></p>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center></p>\n"
"<p>\n"
"Die Rechtecke in obigem Graphen bedeuten:\n"
"</p>\n"
@@ -993,7 +993,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0
"\\endcode\n"
"Hvis \\c MAX_DOT_GRAPH_HEIGHT i konfigurationsfilen "
"er sat til 240, vil dette resultere i følgende graf:"
"<p><center><img src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"De forskellige slags kasser i ovenstående graf har følgende "
"betydninger:\n"
@@ -1014,7 +1014,7 @@ class TranslatorEnglish : public Translator
"};\n"
"\\endcode\n"
"This will result in the following graph:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center></p>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center></p>\n"
"<p>\n"
"The boxes in the above graph have the following meaning:\n"
"</p>\n"
@@ -1017,7 +1017,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4
"};\n"
"\\endcode\n"
"Tio ĉi liveros la sekvan diagramon:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"La skatoloj de la supra diagramo havas la sekvajn signifojn:\n"
"<ul>\n"
@@ -1045,7 +1045,7 @@ class TranslatorSpanish : public Translator
"};\n"
"\\endcode\n"
"Dará como resultado el siguiente gráfico:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center></p>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center></p>\n"
"<p>\n"
"Las cajas en el gráfico arriba tienen el siguiente significado:\n"
"</p>\n"
@@ -1015,7 +1015,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5
"\\endcode\n"
"If the \\c MAX_DOT_GRAPH_HEIGHT tag in the configuration file "
"is set to 240 this will result in the following graph:"
"<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n"
"<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center>\n"
"<p>\n"
"The boxes in the above graph have the following meaning:\n"
"<ul>\n"
Oops, something went wrong.

0 comments on commit a09ffed

Please sign in to comment.