Permalink
Browse files

Merge branch 'develop'

Added:
    Combine similar characters in images table.
    Simple drawing tools (rect, point, fill, line).
    Import/export presets to xml files.
    Font ascent/descent tags.
    Alpha component for foreground and background colors.
    Support for transparent character background.
    Set foreground and background colors with command line.

Changed:
    New dialog to setup font.
    Templates.
    Use unicode characters only from 0x0000 to 0xffff.
    Changelog xml file format.

Fixed:
    Preview with empty script.
    Image output for empty conversion data (image too small or skipped by custom algorithm).
    Workaroung for infinite loop then adding points.

Removed:
    Removed option 'alpha-channel' in font document, with command line argument and template tags.
  • Loading branch information...
riuson committed Jul 21, 2016
2 parents ff449e0 + 492d9da commit 29a5a98e5a0f60508280fe90fd456ae32954303e
Showing with 10,951 additions and 2,411 deletions.
  1. +42 −0 .travis.yml
  2. +2 −6 README
  3. +15 −14 classes/action-handlers/actionfilehandlers.cpp
  4. +20 −114 classes/action-handlers/actionfonthandlers.cpp
  5. +82 −482 classes/action-handlers/actionimagehandlers.cpp
  6. +0 −7 classes/action-handlers/actionimagehandlers.h
  7. +86 −11 classes/cmdline/modeconvertfont.cpp
  8. +2 −0 classes/cmdline/modeconvertfont.h
  9. +1 −1 classes/cmdline/modeconvertimage.cpp
  10. +1 −0 classes/compression/rlecompressor.cpp
  11. +1 −1 classes/compression/rlesequence.cpp
  12. +59 −18 classes/data/datacontainer.cpp
  13. +9 −4 classes/data/datacontainer.h
  14. +390 −153 classes/data/fontdocument.cpp
  15. +23 −18 classes/data/fontdocument.h
  16. +31 −65 classes/data/imagedocument.cpp
  17. +6 −1 classes/data/imagedocument.h
  18. +8 −2 classes/data/imagesmodel.cpp
  19. +21 −0 classes/data/tfontparameters.h
  20. +90 −0 classes/imageeditor/editor.cpp
  21. +69 −0 classes/imageeditor/editor.h
  22. +52 −0 classes/imageeditor/iimageeditor.h
  23. +45 −0 classes/imageeditor/iimageeditorparams.h
  24. +61 −0 classes/imageeditor/iimageeditortool.h
  25. +258 −0 classes/imageeditor/toolcolor.cpp
  26. +86 −0 classes/imageeditor/toolcolor.h
  27. +247 −0 classes/imageeditor/toolfill.cpp
  28. +82 −0 classes/imageeditor/toolfill.h
  29. +223 −0 classes/imageeditor/toolline.cpp
  30. +82 −0 classes/imageeditor/toolline.h
  31. +212 −0 classes/imageeditor/toolpen.cpp
  32. +79 −0 classes/imageeditor/toolpen.h
  33. +293 −0 classes/imageeditor/toolrect.cpp
  34. +94 −0 classes/imageeditor/toolrect.h
  35. +156 −0 classes/imageeditor/toolsmanager.cpp
  36. +78 −0 classes/imageeditor/toolsmanager.h
  37. +164 −0 classes/imageeditor/toolzoom.cpp
  38. +80 −0 classes/imageeditor/toolzoom.h
  39. +60 −0 classes/operations/documentoperator.cpp
  40. +45 −0 classes/operations/documentoperator.h
  41. +110 −0 classes/operations/fontminimizeheight.cpp
  42. +51 −0 classes/operations/fontminimizeheight.h
  43. +54 −0 classes/operations/fontresize.cpp
  44. +40 −0 classes/operations/fontresize.h
  45. +205 −0 classes/operations/imageeditinexternaltool.cpp
  46. +51 −0 classes/operations/imageeditinexternaltool.h
  47. +147 −0 classes/operations/imageexport.cpp
  48. +51 −0 classes/operations/imageexport.h
  49. +72 −0 classes/operations/imageflip.cpp
  50. +50 −0 classes/operations/imageflip.h
  51. +54 −0 classes/operations/imagegrayscale.cpp
  52. +43 −0 classes/operations/imagegrayscale.h
  53. +111 −0 classes/operations/imageimport.cpp
  54. +49 −0 classes/operations/imageimport.h
  55. +54 −0 classes/operations/imageinverse.cpp
  56. +43 −0 classes/operations/imageinverse.h
  57. +70 −0 classes/operations/imageresize.cpp
  58. +51 −0 classes/operations/imageresize.h
  59. +77 −0 classes/operations/imagerotate.cpp
  60. +57 −0 classes/operations/imagerotate.h
  61. +79 −0 classes/operations/imageshift.cpp
  62. +58 −0 classes/operations/imageshift.h
  63. +41 −0 classes/operations/ioperation.h
  64. +64 −1 classes/parser/convert/bitmaphelper.cpp
  65. +5 −0 classes/parser/convert/bitmaphelper.h
  66. +26 −6 classes/parser/convert/bitstream.cpp
  67. +64 −1 classes/parser/convert/converterhelper.cpp
  68. +1 −0 classes/parser/convert/converterhelper.h
  69. +7 −0 classes/parser/convert/convimage.cpp
  70. +3 −0 classes/parser/convert/convimage.h
  71. +70 −0 classes/parser/convert/fonthelper.cpp
  72. +9 −0 classes/parser/convert/fonthelper.h
  73. +33 −4 classes/parser/parsedimagedata.cpp
  74. +6 −1 classes/parser/parsedimagedata.h
  75. +114 −130 classes/parser/parser.cpp
  76. +3 −5 classes/parser/parser.h
  77. +37 −23 classes/parser/tags.cpp
  78. +4 −0 classes/parser/tags.h
  79. +0 −97 classes/settings/bitmapeditoroptions.cpp
  80. +58 −1 classes/settings/fonteditoroptions.cpp
  81. +6 −0 classes/settings/fonteditoroptions.h
  82. +50 −0 classes/settings/imageeditoroptions.cpp
  83. +10 −13 classes/settings/{bitmapeditoroptions.h → imageeditoroptions.h}
  84. +95 −8 classes/settings/presets/fontoptions.cpp
  85. +8 −0 classes/settings/presets/fontoptions.h
  86. +172 −20 classes/settings/presets/imageoptions.cpp
  87. +15 −0 classes/settings/presets/imageoptions.h
  88. +201 −35 classes/settings/presets/matrixoptions.cpp
  89. +14 −0 classes/settings/presets/matrixoptions.h
  90. +197 −22 classes/settings/presets/prepareoptions.cpp
  91. +15 −0 classes/settings/presets/prepareoptions.h
  92. +89 −5 classes/settings/presets/preset.cpp
  93. +3 −1 classes/settings/presets/preset.h
  94. +128 −10 classes/settings/presets/reorderingoptions.cpp
  95. +10 −0 classes/settings/presets/reorderingoptions.h
  96. +71 −6 classes/settings/presets/templateoptions.cpp
  97. +7 −0 classes/settings/presets/templateoptions.h
  98. +11 −1 classes/status/statusmanager.cpp
  99. +8 −1 controls/about/dialogabout.cpp
  100. +16 −1 controls/about/dialogabout.ui
  101. +25 −38 controls/fonts/font-editor/editortabfont.cpp
  102. +12 −14 controls/fonts/font-editor/editortabfont.h
  103. +4 −0 controls/fonts/font-new/charactersmodel.cpp
  104. +196 −280 controls/fonts/font-new/dialogfontselect.cpp
  105. +19 −40 controls/fonts/font-new/dialogfontselect.h
  106. +273 −159 controls/fonts/font-new/dialogfontselect.ui
  107. +295 −0 controls/fonts/font-new/dialogfontselectdata.cpp
  108. +93 −0 controls/fonts/font-new/dialogfontselectdata.h
  109. +5 −2 controls/fonts/font-new/unicodeblocksmodel.cpp
  110. +7 −3 controls/fonts/font-preview/dialogfontpreview.cpp
  111. +287 −0 controls/imageeditor/windoweditor.cpp
  112. +81 −0 controls/imageeditor/windoweditor.h
  113. +92 −0 controls/imageeditor/windoweditor.ui
  114. +16 −14 controls/images/editortabimage.cpp
  115. +9 −4 controls/images/editortabimage.h
  116. +18 −15 controls/images/widgetbitmapeditor.cpp
  117. +8 −1 controls/main/mainwindow.cpp
  118. +86 −3 controls/setup/dialogoptions.cpp
  119. +4 −0 controls/setup/dialogoptions.h
  120. +14 −0 controls/setup/dialogoptions.ui
  121. +5 −4 controls/setup/parts/matrix/matrixpreviewmodel.cpp
  122. +2 −0 controls/setup/parts/prepare/demogenerator.cpp
  123. +8 −1 controls/updates/dialogupdates.cpp
  124. +1 −1 interfaces/idocument.h
  125. +78 −7 lcd-image-converter.pro
  126. +674 −0 license
  127. +4 −3 readme.md
  128. +9 −1 resources/font.tmpl
  129. +0 −1 resources/history.css
  130. +226 −197 resources/history.xml
  131. +140 −105 resources/history.xsl
  132. +81 −0 resources/icons/tools/tool_color.svg
  133. +186 −0 resources/icons/tools/tool_color_swap.svg
  134. +157 −0 resources/icons/tools/tool_fill.svg
  135. +66 −0 resources/icons/tools/tool_line.svg
  136. +136 −0 resources/icons/tools/tool_pen.svg
  137. +67 −0 resources/icons/tools/tool_rect.svg
  138. +74 −0 resources/icons/tools/tool_rect_filled.svg
  139. +74 −0 resources/icons/tools/tool_rect_filled_outline.svg
  140. +74 −0 resources/icons/tools/tool_rect_outline.svg
  141. +78 −0 resources/icons/tools/tool_zoom.svg
  142. +3 −1 resources/image.tmpl
  143. +449 −165 resources/lcd-image-converter-ru.ts
  144. +14 −2 resources/resources.qrc
  145. +15 −0 resources/scan_scripts/scan_template.js
  146. +18 −18 tests/parts/testbitmaphelper.cpp
  147. +1 −1 tests/parts/testbitstream.cpp
  148. +75 −3 tests/parts/testconverterhelper.cpp
  149. +23 −0 tests/parts/testconverterhelper.h
  150. +1 −1 tests/parts/testprepareoptions.cpp
  151. +2 −2 tests/parts/testpresets.cpp
  152. +3 −0 tests/samples.qrc
  153. +59 −34 tests/test.pro
  154. +1 −2 win-res.rc
@@ -0,0 +1,42 @@
language: cpp
compiler: gcc

dist: trusty
sudo: required

env:
global:
- MAKEFLAGS="-j4"
matrix:
- QT_BASE=48
- QT_BASE=51
- QT_BASE=55
- QT_BASE=56

before_install:
- if [ "$QT_BASE" = "48" ]; then sudo add-apt-repository --yes ppa:beineri/opt-qt487-trusty; fi
- if [ "$QT_BASE" = "51" ]; then sudo add-apt-repository --yes ppa:beineri/opt-qt511-trusty; fi
- if [ "$QT_BASE" = "55" ]; then sudo add-apt-repository --yes ppa:beineri/opt-qt551-trusty; fi
- if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository --yes ppa:beineri/opt-qt561-trusty; fi
- sudo apt-get update -qq

install:
- if [ "$QT_BASE" = "48" ]; then sudo apt-get install -y --force-yes opt-qt4-qmake opt-qt4-dev-tools opt-qt4-linguist-tools; fi
- if [ "$QT_BASE" = "51" ]; then sudo apt-get install -y --force-yes qt51base qt51xmlpatterns qt51svg qt51script qt51tools; fi
- if [ "$QT_BASE" = "55" ]; then sudo apt-get install -y --force-yes qt55base qt55xmlpatterns qt55svg qt55script qt55tools; fi
- if [ "$QT_BASE" = "56" ]; then sudo apt-get install -y --force-yes qt56base qt56xmlpatterns qt56svg qt56declarative qt56tools; fi
- sudo apt-get install -y --force-yes build-essential libglu1-mesa-dev

before_script:
- if [ "$QT_BASE" = "48" ]; then source /opt/qt-4.8/bin/qt-4.8-env.sh; fi
- if [ "$QT_BASE" = "51" ]; then source /opt/qt51/bin/qt51-env.sh; fi
- if [ "$QT_BASE" = "55" ]; then source /opt/qt55/bin/qt55-env.sh; fi
- if [ "$QT_BASE" = "56" ]; then source /opt/qt56/bin/qt56-env.sh; fi


script:
- if [ "$QT_BASE" = "48" ]; then /opt/qt-4.8/bin/qmake lcd-image-converter.pro; fi
- if [ "$QT_BASE" = "51" ]; then /opt/qt51/bin/qmake lcd-image-converter.pro; fi
- if [ "$QT_BASE" = "55" ]; then /opt/qt55/bin/qmake lcd-image-converter.pro; fi
- if [ "$QT_BASE" = "56" ]; then /opt/qt56/bin/qmake lcd-image-converter.pro; fi
- make
8 README
@@ -4,7 +4,7 @@ This program allows you to create bitmaps and fonts, and transform them to "C"
source format for embedded applications.

Home page: http://www.riuson.com/lcd-image-converter
Mailto: riuson@gmail.com
Mailto: Vladimir <riuson@gmail.com>

================================================================================
This program is free software: you can redistribute it and/or modify
@@ -28,10 +28,6 @@ chmod +x build.sh
# run
./_linux/release/lcd-image-converter

================================================================================

Additional packages on Ubuntu 14.04, Qt5:
libqt5xmlpatterns5 libqt5xmlpatterns5-dev libqt5xmlpatterns5-private-dev
qtscript5-dev qttools5-dev-tools
See http://www.riuson.com/lcd-image-converter/others/build-from-sources

================================================================================
@@ -32,6 +32,7 @@
#include "datacontainer.h"
#include "idocument.h"
#include "preset.h"
#include "tfontparameters.h"
//-----------------------------------------------------------------------------
ActionFileHandlers::ActionFileHandlers(QObject *parent) :
ActionHandlersBase(parent)
@@ -79,17 +80,11 @@ void ActionFileHandlers::newFont_triggered()
ed->document()->beginChanges();

QString chars = dialog.characters();
int size;
QString family, style;
bool monospaced, antialiasing;
tFontParameters parameters;
dialog.getFontParameters(&parameters);

family = dialog.fontFamily();
style = dialog.fontStyle();
size = dialog.fontSize();
monospaced = dialog.monospaced();
antialiasing = dialog.antialiasing();

ed->setFontCharacters(chars, family, style, size, monospaced, antialiasing);
ed->setFontCharacters(chars,
parameters);

emit this->tabCreated(ed);

@@ -388,11 +383,17 @@ void ActionFileHandlers::convertDocument(IDocument *document, bool request)
// converter output file name
QString outputFileName = document->outputFilename();

// document file name
QString documentFileName = document->documentFilename();

// if file name not specified, show dialog
bool filenameNotSpecified = outputFileName.isEmpty();
bool outputFilenameNotSpecified = outputFileName.isEmpty();

// if document not saved, do not save output file name
bool documentFilenameNotSpecified = documentFileName.isEmpty();

// show dialog
if (request || filenameNotSpecified)
if (request || outputFilenameNotSpecified)
{
QFileDialog dialog(qobject_cast<QWidget *>(this->parent()));
dialog.setAcceptMode(QFileDialog::AcceptSave);
@@ -402,7 +403,7 @@ void ActionFileHandlers::convertDocument(IDocument *document, bool request)
dialog.setDefaultSuffix(QString("c"));
dialog.setWindowTitle(tr("Save result file as"));

if (filenameNotSpecified)
if (outputFilenameNotSpecified)
{
dialog.selectFile(document->documentName());
}
@@ -435,7 +436,7 @@ void ActionFileHandlers::convertDocument(IDocument *document, bool request)
file.write(result.toUtf8());
file.close();

if (document->outputFilename() != outputFileName)
if ((document->outputFilename() != outputFileName) && !documentFilenameNotSpecified)
{
document->setOutputFilename(outputFileName);
}
@@ -30,9 +30,11 @@
#include "imainwindow.h"
#include "idocument.h"
#include "datacontainer.h"
#include "limits"
#include "bitmapeditoroptions.h"
#include "dialogcanvasresize.h"
#include "tfontparameters.h"
#include "documentoperator.h"
#include "imageinverse.h"
#include "fontminimizeheight.h"
#include "fontresize.h"
//-----------------------------------------------------------------------------
ActionFontHandlers::ActionFontHandlers(QObject *parent) :
ActionHandlersBase(parent)
@@ -43,35 +45,21 @@ void ActionFontHandlers::fontChange_triggered()
{
if (EditorTabFont *etf = qobject_cast<EditorTabFont *>(this->mMainWindow->currentTab()))
{
QString chars, fontFamily, style;
int size;
bool monospaced, antialiasing;
etf->fontCharacters(&chars, &fontFamily, &style, &size, &monospaced, &antialiasing);
QString chars;
tFontParameters parameters;
etf->fontCharacters(&chars, &parameters);

DialogFontSelect dialog(this->mMainWindow->parentWidget());
dialog.setCharacters(chars);
//dialog.selectFont(fontFamily, style, size, monospaced, antialiasing);
dialog.setFontFamily(fontFamily);
dialog.setFontStyle(style);
dialog.setFontSize(size);
dialog.setMonospaced(monospaced);
dialog.setAntialising(antialiasing);
dialog.setFontParameters(parameters);

if (dialog.exec() == QDialog::Accepted)
{
QString chars = dialog.characters();
int size;
QString family, style;
bool monospaced, antialiasing;

//dialog.selectedFont(&family, &style, &size, &monospaced, &antialiasing);
family = dialog.fontFamily();
style = dialog.fontStyle();
size = dialog.fontSize();
monospaced = dialog.monospaced();
antialiasing = dialog.antialiasing();
dialog.getFontParameters(&parameters);

etf->setFontCharacters(chars, family, style, size, monospaced, antialiasing);
etf->setFontCharacters(chars, parameters);
}
}
}
@@ -80,111 +68,29 @@ void ActionFontHandlers::fontInverse_triggered()
{
if (this->editor() != NULL)
{
this->editor()->document()->beginChanges();;

QStringList keys = this->editor()->document()->dataContainer()->keys();
QListIterator<QString> it(keys);
it.toFront();
while (it.hasNext())
{
QString key = it.next();
const QImage *original = this->editor()->document()->dataContainer()->image(key);
QImage result(*original);
result.invertPixels();
this->editor()->document()->dataContainer()->setImage(key, &result);
}

this->editor()->document()->endChanges(false);
Operations::DocumentOperator docOp(this);
Operations::ImageInverse imageInverse(this);
docOp.apply(this->editor()->document(), imageInverse);
}
}
//-----------------------------------------------------------------------------
void ActionFontHandlers::fontResize_triggered()
{
if (this->editor() != NULL)
{
QStringList keys = this->editor()->document()->dataContainer()->keys();

DialogCanvasResize dialog(this->editor()->document()->dataContainer(), this->mMainWindow->parentWidget());
dialog.selectKeys(keys);

if (dialog.exec() == QDialog::Accepted)
{
int left, top, right, bottom;
dialog.resizeInfo(&left, &top, &right, &bottom);

if (left != 0 || top != 0 || right != 0 || bottom != 0)
{
this->editor()->document()->beginChanges();

QStringListIterator iterator(keys);
while (iterator.hasNext())
{
QString key = iterator.next();

const QImage *original = this->editor()->document()->dataContainer()->image(key);
QImage result = BitmapHelper::crop(original, left, top, right, bottom, BitmapEditorOptions::color2());
this->editor()->document()->dataContainer()->setImage(key, &result);
}

this->editor()->document()->endChanges(false);
}
}
Operations::DocumentOperator docOp(this);
Operations::FontResize fontResize(this->mMainWindow->parentWidget(), this);
docOp.apply(this->editor()->document(), fontResize);
}
}
//-----------------------------------------------------------------------------
void ActionFontHandlers::fontMinimizeHeight_triggered()
{
if (this->editor() != NULL)
{
IDocument *doc = this->editor()->document();

int left = std::numeric_limits<int>::max();
int top = std::numeric_limits<int>::max();
int right = 0;
int bottom = 0;
int l, t, r, b;

// find limits
QStringList keys = doc->dataContainer()->keys();
QListIterator<QString> it(keys);
it.toFront();
while (it.hasNext())
{
QString key = it.next();
const QImage *original = doc->dataContainer()->image(key);

BitmapHelper::findEmptyArea(original, &l, &t, &r, &b);

left = qMin(left, l);
top = qMin(top, t);
right = qMin(right, r);
bottom = qMin(bottom, b);
}

DialogCanvasResize dialog(doc->dataContainer(), this->mMainWindow->parentWidget());
dialog.selectKeys(keys);
dialog.setResizeInfo(-left, -top, -right, -bottom);
if (dialog.exec() == QDialog::Accepted)
{
dialog.resizeInfo(&left, &top, &right, &bottom);

if (left != 0 || top != 0 || right != 0 || bottom != 0)
{
doc->beginChanges();

QStringListIterator iterator(keys);
while (iterator.hasNext())
{
QString key = iterator.next();

const QImage *original = doc->dataContainer()->image(key);
QImage result = BitmapHelper::crop(original, left, top, right, bottom, BitmapEditorOptions::color2());
doc->dataContainer()->setImage(key, &result);
}

doc->endChanges(false);
}
}
Operations::DocumentOperator docOp(this);
Operations::FontMinimizeHeight fontMinimizeHeight(this->mMainWindow->parentWidget(), this);
docOp.apply(this->editor()->document(), fontMinimizeHeight);
}
}
//-----------------------------------------------------------------------------
Oops, something went wrong.

0 comments on commit 29a5a98

Please sign in to comment.