mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
AZTEC: fix bit-stuffing; AZTECRUNE: fix >= 128; DATAMATRIX: eod shift -> 0 pad; Qt6
This commit is contained in:
@ -1,22 +1,32 @@
|
||||
# (c) 2008 by BogDan Vatra < bogdan@licentia.eu >
|
||||
# vim: set ts=4 sw=4 et :
|
||||
|
||||
project(QZint)
|
||||
|
||||
include_directories(BEFORE "${CMAKE_SOURCE_DIR}/backend" )
|
||||
|
||||
set(QZint_SRCS qzint.cpp)
|
||||
QT5_WRAP_CPP(QZint_SRCS qzint.h)
|
||||
|
||||
if(USE_QT6)
|
||||
qt6_wrap_cpp(QZint_SRCS qzint.h)
|
||||
else()
|
||||
qt5_wrap_cpp(QZint_SRCS qzint.h)
|
||||
endif()
|
||||
|
||||
add_library(QZint SHARED ${QZint_SRCS})
|
||||
|
||||
set_target_properties(QZint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
||||
set_target_properties(QZint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
||||
VERSION ${ZINT_VERSION})
|
||||
|
||||
add_dependencies(QZint zint)
|
||||
|
||||
link_directories( "${CMAKE_BINARY_DIR}/backend" )
|
||||
|
||||
target_link_libraries(QZint zint Qt5::Widgets Qt5::Gui )
|
||||
if(USE_QT6)
|
||||
target_link_libraries(QZint zint Qt6::Widgets Qt6::Gui)
|
||||
else()
|
||||
target_link_libraries(QZint zint Qt5::Widgets Qt5::Gui)
|
||||
endif()
|
||||
|
||||
install(TARGETS QZint ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||
install(FILES qzint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
|
||||
|
@ -411,7 +411,6 @@ namespace Zint {
|
||||
struct zint_vector_hexagon *hex;
|
||||
struct zint_vector_circle *circle;
|
||||
struct zint_vector_string *string;
|
||||
qreal radius;
|
||||
|
||||
(void)mode; /* Not currently used */
|
||||
|
||||
@ -454,9 +453,6 @@ namespace Zint {
|
||||
xtr += (qreal) (paintRect.width() - gwidth * scale) / 2.0;
|
||||
ytr += (qreal) (paintRect.height() - gheight * scale) / 2.0;
|
||||
|
||||
painter.setBackground(QBrush(m_bgColor));
|
||||
painter.fillRect(paintRect, QBrush(m_bgColor));
|
||||
|
||||
if (m_rotate_angle) {
|
||||
painter.translate(paintRect.width() / 2.0, paintRect.height() / 2.0); // Need to rotate around centre
|
||||
painter.rotate(m_rotate_angle);
|
||||
@ -466,6 +462,9 @@ namespace Zint {
|
||||
painter.translate(xtr, ytr);
|
||||
painter.scale(scale, scale);
|
||||
|
||||
QBrush bgBrush(m_bgColor);
|
||||
painter.fillRect(QRectF(0, 0, gwidth, gheight), bgBrush);
|
||||
|
||||
//Red square for diagnostics
|
||||
//painter.fillRect(QRect(0, 0, m_zintSymbol->vector->width, m_zintSymbol->vector->height), QBrush(QColor(255,0,0,255)));
|
||||
|
||||
@ -488,19 +487,25 @@ namespace Zint {
|
||||
hex = m_zintSymbol->vector->hexagons;
|
||||
if (hex) {
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
QBrush brush(m_fgColor);
|
||||
QBrush fgBrush(m_fgColor);
|
||||
qreal previous_diameter = 0.0, radius = 0.0, half_radius = 0.0, half_sqrt3_radius = 0.0;
|
||||
while (hex) {
|
||||
radius = hex->diameter / 2.0;
|
||||
if (previous_diameter != hex->diameter) {
|
||||
previous_diameter = hex->diameter;
|
||||
radius = 0.5 * previous_diameter;
|
||||
half_radius = 0.25 * previous_diameter;
|
||||
half_sqrt3_radius = 0.43301270189221932338 * previous_diameter;
|
||||
}
|
||||
|
||||
QPainterPath pt;
|
||||
pt.moveTo(hex->x, hex->y + (1.0 * radius));
|
||||
pt.lineTo(hex->x + (0.86 * radius), hex->y + (0.5 * radius));
|
||||
pt.lineTo(hex->x + (0.86 * radius), hex->y - (0.5 * radius));
|
||||
pt.lineTo(hex->x, hex->y - (1.0 * radius));
|
||||
pt.lineTo(hex->x - (0.86 * radius), hex->y - (0.5 * radius));
|
||||
pt.lineTo(hex->x - (0.86 * radius), hex->y + (0.5 * radius));
|
||||
pt.lineTo(hex->x, hex->y + (1.0 * radius));
|
||||
painter.fillPath(pt, brush);
|
||||
pt.moveTo(hex->x, hex->y + radius);
|
||||
pt.lineTo(hex->x + half_sqrt3_radius, hex->y + half_radius);
|
||||
pt.lineTo(hex->x + half_sqrt3_radius, hex->y - half_radius);
|
||||
pt.lineTo(hex->x, hex->y - radius);
|
||||
pt.lineTo(hex->x - half_sqrt3_radius, hex->y - half_radius);
|
||||
pt.lineTo(hex->x - half_sqrt3_radius, hex->y + half_radius);
|
||||
pt.lineTo(hex->x, hex->y + radius);
|
||||
painter.fillPath(pt, fgBrush);
|
||||
|
||||
hex = hex->next;
|
||||
}
|
||||
@ -511,19 +516,25 @@ namespace Zint {
|
||||
if (circle) {
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
QPen p;
|
||||
QBrush fgBrush(m_fgColor);
|
||||
qreal previous_diameter = 0.0, radius = 0.0;
|
||||
while (circle) {
|
||||
if (previous_diameter != circle->diameter) {
|
||||
previous_diameter = circle->diameter;
|
||||
radius = 0.5 * previous_diameter;
|
||||
}
|
||||
if (circle->colour) { // Set means use background colour
|
||||
p.setColor(m_bgColor);
|
||||
p.setWidth(0);
|
||||
painter.setPen(p);
|
||||
painter.setBrush(QBrush(m_bgColor));
|
||||
painter.setBrush(bgBrush);
|
||||
} else {
|
||||
p.setColor(m_fgColor);
|
||||
p.setWidth(0);
|
||||
painter.setPen(p);
|
||||
painter.setBrush(QBrush(m_fgColor));
|
||||
painter.setBrush(fgBrush);
|
||||
}
|
||||
painter.drawEllipse(QPointF(circle->x, circle->y), (double) circle->diameter / 2.0, (double) circle->diameter / 2.0);
|
||||
painter.drawEllipse(QPointF(circle->x, circle->y), radius, radius);
|
||||
circle = circle->next;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user