added command-line tool that auto-generates images for the JKQTPLotter documentation, implemented auto-generated plot-symbols
@ -1,5 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
add_custom_target(JKQTMathText_GenerateDocImages
|
||||
COMMENT "Building JKQTMathText Documentation Images ..."
|
||||
)
|
||||
|
||||
add_custom_target(JKQTPlotter_GenerateDocScreenshots
|
||||
COMMENT "Building JKQTPlotter Documentation Screenshots ..."
|
||||
)
|
||||
|
||||
add_custom_target(JKQTPlotter_GenerateDocImages
|
||||
COMMENT "Building JKQTPlotter Documentation Images ..."
|
||||
)
|
||||
|
||||
|
||||
add_custom_target(JKQTP_GenerateAllDocImages
|
||||
DEPENDS JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocScreenshots JKQTMathText_GenerateDocImages
|
||||
)
|
||||
|
||||
if(JKQtPlotter_BUILD_TOOLS)
|
||||
|
||||
@ -22,10 +38,6 @@ if(JKQtPlotter_BUILD_TOOLS)
|
||||
|
||||
set(JKQTMathText_GenerateDocImages_COMMAND $<TARGET_FILE:jkqtmathtext_render> ${JKQTMathText_GenerateDocImages_DefaultOptions})
|
||||
set(JKQTMathText_GenerateDocImages_OutputDir "${CMAKE_CURRENT_LIST_DIR}/images/jkqtmathtext/")
|
||||
add_custom_target(JKQTMathText_GenerateDocImages
|
||||
COMMENT "Building JKQTMathText Documentation Images ..."
|
||||
DEPENDS jkqtmathtext_render
|
||||
)
|
||||
|
||||
foreach(file ${JKQTMathText_GenerateDocImages_StdInputFiles})
|
||||
string(REGEX MATCH ".*_([^_\.]+)\.[A-Za-z]+" dummy ${file})
|
||||
@ -64,6 +76,33 @@ endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(JKQtPlotter_BUILD_TOOLS)
|
||||
|
||||
# custom target that generates the images for the JKQTPlotter documentation
|
||||
set(JKQTPlotter_GenerateDocImages_DefaultOptions )
|
||||
|
||||
|
||||
set(JKQTPlotter_GenerateDocImages_COMMAND $<TARGET_FILE:jkqtplotter_doc_imagegenerator> ${JKQTPlotter_GenerateDocImages_DefaultOptions})
|
||||
set(JKQTPlotter_GenerateDocImages_OutputDir "${CMAKE_CURRENT_LIST_DIR}/images/")
|
||||
|
||||
|
||||
add_custom_target(JKQTPlotter_GenerateDocImages_listplotsymbols
|
||||
COMMENT "Building JKQTPlotter Documentation Images: LISTPLOTSYMBOLS"
|
||||
COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --listsymbols --iconsize=32 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/symbols/"
|
||||
WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR}
|
||||
DEPENDS jkqtplotter_doc_imagegenerator
|
||||
)
|
||||
|
||||
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listplotsymbols)
|
||||
endif(JKQtPlotter_BUILD_TOOLS)
|
||||
|
||||
|
||||
|
||||
|
||||
if(JKQtPlotter_BUILD_EXAMPLES)
|
||||
|
||||
# custom target that generates the images for the JKQTMathText documentation
|
||||
@ -129,13 +168,6 @@ if(JKQtPlotter_BUILD_EXAMPLES)
|
||||
evalcurve/JKQTPXYFunctionLineGraph/--smallscreenshotplot
|
||||
)
|
||||
|
||||
add_custom_target(JKQTPlotter_GenerateDocScreenshots
|
||||
COMMENT "Building JKQTPlotter Documentation Screenshots ..."
|
||||
)
|
||||
|
||||
add_custom_target(JKQTPlotter_GenerateDocImages
|
||||
COMMENT "Building JKQTPlotter Documentation Images ..."
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -270,7 +270,10 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
<tr><th> Screenshot <th> Name <th> Notes/Description
|
||||
<tr><td> \image html jkqtmathtext_render_small.png
|
||||
<td> \subpage JKQTMathTextRenderCmdLineTool
|
||||
<td> uses JKQTMathText to render LaTeX Markup into an image file
|
||||
<td> uses JKQTMathText to render LaTeX Markup into an image file and used to render different images for the documentation
|
||||
<tr><td> \image html jkqtplotter_doc_imagegenerator_small.png
|
||||
<td> \subpage JKQTPlotterDocImageRenderCmdLineTool
|
||||
<td> uses JKQTPlotter to render different images for the documentation
|
||||
</table>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 102 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 297 B |
BIN
doc/images/symbols/symbol_char_at.png
Normal file
After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 398 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 272 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 568 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 538 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 573 B After Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 565 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 619 B After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 401 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 266 B |
BIN
screenshots/jkqtplotter_doc_imagegenerator_small.png
Normal file
After Width: | Height: | Size: 10 KiB |
@ -19,4 +19,5 @@ message( STATUS "...............................................................
|
||||
# examples specific to JKQtMathText
|
||||
message( STATUS ".. BUILDING TOOLS FOR JKQTMATHTEXT:" )
|
||||
add_subdirectory(jkqtmathtext_render)
|
||||
add_subdirectory(jkqtplotter_doc_imagegenerator)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Example (JKQTMathText): Command-Line Utility jkqtmathtext_render {#JKQTMathTextRenderCmdLineTool}
|
||||
# Tool (JKQTMathText): Command-Line Utility jkqtmathtext_render {#JKQTMathTextRenderCmdLineTool}
|
||||
JKQTMathText is a hand-written LaTeX-renderer for Qt (implemented in native C++, using Qt). It supports a large set of standard LaTeX markup and can render it to a QPainter.
|
||||
|
||||
This project (see `./examples/jkqtmathtext_render/`) is a command-line utility that accepts a LaTeX markup string and a filename for the generated image.
|
||||
|
33
tools/jkqtplotter_doc_imagegenerator/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(EXAMPLE_NAME jkqtplotter_doc_imagegenerator)
|
||||
set(EXENAME ${EXAMPLE_NAME})
|
||||
|
||||
message( STATUS ".. Building Tool ${EXAMPLE_NAME}" )
|
||||
|
||||
|
||||
# Set up source files
|
||||
set(SOURCES
|
||||
${EXAMPLE_NAME}.cpp
|
||||
)
|
||||
set(HEADERS )
|
||||
set(RESOURCES )
|
||||
set(UIS )
|
||||
|
||||
add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS})
|
||||
target_include_directories(${EXENAME} PRIVATE ../../lib)
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
target_link_libraries(${EXENAME} JKQTPlotterLib)
|
||||
elseif(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
target_link_libraries(${EXENAME} JKQTPlotterSharedLib)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
# Installation
|
||||
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
#Installation of Qt DLLs on Windows
|
||||
jkqtplotter_deployqt(${EXENAME})
|
||||
|
||||
|
2
tools/jkqtplotter_doc_imagegenerator/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# Tool (JKQTMathText): Command-Line Utility jkqtplotter_doc_imagegenerator {#JKQTPlotterDocImageRenderCmdLineTool}
|
||||
This command-line tool is used to generate images for the documentation.
|
@ -0,0 +1,81 @@
|
||||
/** \example jkqtplotter_doc_imagegenerator.cpp
|
||||
*
|
||||
* \ref JKQTPlotterDocImageRenderCmdLineTool
|
||||
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QTextStream>
|
||||
#include <algorithm>
|
||||
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
||||
#include<QRegularExpression>
|
||||
#include<QRegularExpressionMatch>
|
||||
#else
|
||||
#include<QRegExp>
|
||||
#endif
|
||||
#include "jkqtcommon/jkqtpstringtools.h"
|
||||
#include "jkqtcommon/jkqtpdrawingtools.h"
|
||||
#include "jkqtcommon/jkqtpenhancedpainter.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// 1. create Qt Appcilation object and a QCommandLineParser to go with it
|
||||
QApplication app(argc, argv);
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("JKQTPlotter command line tool that renders diverse images for the documentation");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
QCommandLineOption outputDirectoryOption("outputdir", "write results into this directory.", "outputdir", app.applicationDirPath());
|
||||
parser.addOption(outputDirectoryOption);
|
||||
QCommandLineOption listsymbolsOption("listsymbols", "list all symbols in the given output file and generate images.");
|
||||
parser.addOption(listsymbolsOption);
|
||||
QCommandLineOption iconsizeOption("iconsize", "typical size of the generatued images.", "iconsize", "24");
|
||||
parser.addOption(iconsizeOption);
|
||||
QCommandLineOption backgroundOption("background", "background color.", "background", "white");
|
||||
parser.addOption(backgroundOption);
|
||||
parser.process(app);
|
||||
|
||||
const QDir outputDir(parser.value(outputDirectoryOption));
|
||||
const bool listsymbols=parser.isSet(listsymbolsOption);
|
||||
const int iconsize=parser.value(iconsizeOption).toInt();
|
||||
const QColor backgroundColor = jkqtp_String2QColor(parser.value(backgroundOption));
|
||||
|
||||
if (listsymbols) {
|
||||
for (uint64_t i=0; i<JKQTPSymbolCount; i++) {
|
||||
const JKQTPGraphSymbols s=static_cast<JKQTPGraphSymbols>(i);
|
||||
QImage img(QSize(iconsize,iconsize),QImage::Format_ARGB32_Premultiplied);
|
||||
img.fill(backgroundColor);
|
||||
JKQTPEnhancedPainter p;
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::TextAntialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.begin(&img);
|
||||
JKQTPPlotSymbol(p, iconsize/2,iconsize/2,s,iconsize-4,2,QColor("blue"), QColor("salmon").lighter(120),QGuiApplication::font().family());
|
||||
p.end();
|
||||
const bool ok=img.save(outputDir.absoluteFilePath(JKQTPGraphSymbols2String(s)+".png"));
|
||||
std::cout<<"saving to "<<outputDir.absoluteFilePath(JKQTPGraphSymbols2String(s)+".png").toStdString()<<" ==> "<<std::boolalpha<<ok<<"\n";
|
||||
}
|
||||
QImage img(QSize(iconsize,iconsize),QImage::Format_ARGB32_Premultiplied);
|
||||
img.fill(backgroundColor);
|
||||
JKQTPEnhancedPainter p;
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::TextAntialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.begin(&img);
|
||||
JKQTPPlotSymbol(p, iconsize/2,iconsize/2,JKQTPCharacterSymbol+QChar('@').unicode(),iconsize-4,2,QColor("blue"), QColor("blue").lighter(),QGuiApplication::font().family());
|
||||
p.end();
|
||||
img.save(outputDir.absoluteFilePath("symbol_char_at.png"));
|
||||
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
TARGET = jkqtplotter_doc_imagegenerator
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += jkqtplotter_doc_imagegenerator.cpp
|
||||
|
||||
CONFIG += link_prl qt
|
||||
QT += core gui
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||
|
||||
|
||||
DEPENDPATH += ../../lib ../../qmake/staticlib/jkqtplotterlib
|
||||
INCLUDEPATH += ../../lib
|
||||
CONFIG (debug, debug|release) {
|
||||
DEPENDPATH += ../../qmake/staticlib/jkqtplotterlib/debug
|
||||
LIBS += -L../../qmake/staticlib/jkqtplotterlib/debug -L../../../qmake/staticlib/jkqtplotterlib/debug -ljkqtplotterlib_debug
|
||||
} else {
|
||||
DEPENDPATH += ../../qmake/staticlib/jkqtplotterlib/release
|
||||
LIBS += -L../../qmake/staticlib/jkqtplotterlib/release -L../../../qmake/staticlib/jkqtplotterlib/release -ljkqtplotterlib
|
||||
}
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
@ -0,0 +1,8 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += jkqtplotterlib jkqtplotter_doc_imagegenerator
|
||||
|
||||
jkqtmathtextlib.file = ../../qmake/staticlib/jkqtmathtextlib/jkqtmathtextlib.pro
|
||||
|
||||
jkqtplotter_doc_imagegenerator.file=$$PWD/jkqtplotter_doc_imagegenerator.pro
|
||||
jkqtplotter_doc_imagegenerator.depends = jkqtplotterlib
|