Skip to content

Commit

Permalink
Merge branch 'master' into parallaxe_movement
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlamhauge committed Nov 20, 2024
2 parents e13884e + d904335 commit 4236dfa
Show file tree
Hide file tree
Showing 50 changed files with 78,933 additions and 33,993 deletions.
10 changes: 1 addition & 9 deletions .github/actions/create-package/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,7 @@ create_package_macos() {
echo "::group::Deploy Qt libraries"
macdeployqt Pencil2D.app
echo "::endgroup::"
echo "::group::Apply macdeployqt fix"
curl -fsSLO https://github.com/aurelien-rainone/macdeployqtfix/archive/master.zip
bsdtar xf master.zip
/Library/Frameworks/Python.framework/Versions/2.7/bin/python macdeployqtfix-master/macdeployqtfix.py \
Pencil2D.app/Contents/MacOS/Pencil2D \
/usr/local/Cellar/qt/5.9.1/
echo "::endgroup::"
echo "Remove files"
rm -rf macdeployqtfix-master master.zip

popd >/dev/null
echo "Create ZIP"
local qtsuffix="-qt${INPUT_QT}"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ jobs:
run: mkdir build; ${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
-o build PREFIX=/usr CONFIG-=debug_and_release CONFIG+=release CONFIG+=GIT
CONFIG+=PENCIL2D_${{github.ref == 'refs/heads/release' && 'RELEASE' || 'NIGHTLY'}}
${{matrix.qt == 6 && 'CONFIG+=c++17 QMAKE_CXX_FLAGS+=-std=c++17' || ''}}

- name: Build Pencil2D
working-directory: build
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ ipch
.vscode

# Build directory
build
build
.qtc_clangd
6 changes: 6 additions & 0 deletions app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RC_LANGS.de = --lang LANG_GERMAN --sublang SUBLANG_NEUTRAL

EXTRA_TRANSLATIONS += \
$$PWD/../translations/pencil_ar.ts \
$$PWD/../translations/pencil_bg.ts \
$$PWD/../translations/pencil_ca.ts \
$$PWD/../translations/pencil_cs.ts \
$$PWD/../translations/pencil_da.ts \
Expand All @@ -29,13 +30,17 @@ EXTRA_TRANSLATIONS += \
$$PWD/../translations/pencil_en.ts \
$$PWD/../translations/pencil_es.ts \
$$PWD/../translations/pencil_et.ts \
$$PWD/../translations/pencil_fa.ts \
$$PWD/../translations/pencil_fr.ts \
$$PWD/../translations/pencil_he.ts \
$$PWD/../translations/pencil_hu_HU.ts \
$$PWD/../translations/pencil_id.ts \
$$PWD/../translations/pencil_it.ts \
$$PWD/../translations/pencil_ja.ts \
$$PWD/../translations/pencil_kab.ts \
$$PWD/../translations/pencil_ko.ts \
$$PWD/../translations/pencil_nb.ts \
$$PWD/../translations/pencil_nl_NL.ts \
$$PWD/../translations/pencil_pl.ts \
$$PWD/../translations/pencil_pt.ts \
$$PWD/../translations/pencil_pt_BR.ts \
Expand All @@ -44,6 +49,7 @@ EXTRA_TRANSLATIONS += \
$$PWD/../translations/pencil_sv.ts \
$$PWD/../translations/pencil_tr.ts \
$$PWD/../translations/pencil_vi.ts \
$$PWD/../translations/pencil_yue.ts \
$$PWD/../translations/pencil_zh_CN.ts \
$$PWD/../translations/pencil_zh_TW.ts

Expand Down
170 changes: 100 additions & 70 deletions app/data/org.pencil2d.Pencil2D.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,113 +10,143 @@ MimeType=application/x-pencil2d-pcl;application/x-pencil2d-pclx;
Categories=Graphics;2DGraphics;VectorGraphics;RasterGraphics;Qt;
Keywords=picture;drawing;vector;bitmap;cartoon;animation;


# Translations



# Translations


# Translations


# Translations


# Translations
Comment[ar]=إنشاء رسوم متحركة كلاسيكية باستخدام الصور النقطية والمتجهة
GenericName[ar]=برنامج رسوم متحركة
Name[ar]=بنسل2دي
GenericName[ar]=برنامج تحريك الرسومات
Comment[ar]=أنشئ رسومات متحركة كلاسيكية بإستخدام الصور النقطية و المتجهة
Name[ca]=Pencil2D
GenericName[ca]=Programari d'animació
Icon[ar]=org.pencil2d.Pencil2D
Comment[bg]=Създайте традиционна ръчно нарисувана анимация, използвайки както растерни, така и векторни графики
GenericName[bg]=Софтуер за анимация
Name[bg]=Pencil2D
Icon[bg]=org.pencil2d.Pencil2D
Comment[ca]=Crea animacions tradicionals a mà utilitzant gràfics de mapa de bits i de vectors
Name[cs]=Pencil2D
GenericName[cs]=Animační program
GenericName[ca]=Programari d'animació
Name[ca]=Pencil2D
Icon[ca]=org.pencil2d.Pencil2D
Comment[cs]=Tvořte tradiční ručně kreslenou animaci pomocí bitmapové i vektorové grafiky
GenericName[cs]=Animační program
Name[cs]=Pencil2D
Icon[cs]=org.pencil2d.Pencil2D
Name[da]=Pencil2D
GenericName[da]=Animationssoftware
Comment[da]=Lav traditionel håndtegnet animation, ved brug af både bitmap og vektorgrafik
GenericName[da]=Animationssoftware
Name[da]=Pencil2D
Icon[da]=org.pencil2d.Pencil2D
Name[de]=Pencil2D
Comment[de]=Erstellen Sie traditionelle, handgezeichnete Animationen, sowohl mit Raster-, als auch mit Vektorgrafik.
GenericName[de]=Animationssoftware
Comment[de]=Traditionelle handgezeichnete Animation sowohl mit Raster- als auch mit Vektorgrafik erstellen
Name[de]=Pencil2D
Icon[de]=org.pencil2d.Pencil2D
Name[el]=Pencil2D
GenericName[el]=Λογισμικό κινουμένων σχεδίων
Comment[el]=Δημιουργήστε παραδοσιακά, ζωγραφισμένα στο χέρι κινούμενα σχέδια χρησιμοποιώντας το bitmap και διανυσματική γραφιστική.
Name[es]=Pencil2D
GenericName[es]=Programa de Animación
GenericName[el]=Λογισμικό κινουμένων σχεδίων
Name[el]=Pencil2D
Icon[el]=org.pencil2d.Pencil2D
Comment[es]=Crea animaciones tradicionales hechas a mano usando mapas de bits o vectores gráficos
GenericName[es]=Programa de Animación
Name[es]=Pencil2D
Icon[es]=org.pencil2d.Pencil2D
Name[et]=Pencil2D
GenericName[et]=Animeerimistarkvara
Comment[et]=Loo traditsioonilisi käsitsijoonistatud animatsioone kasutades nii raster- kui vektorgraafikat.
Name[fr]=Pencil2D
GenericName[et]=Animeerimistarkvara
Name[et]=Pencil2D
Icon[et]=org.pencil2d.Pencil2D
Comment[fa]=با کمک نگاره های برداری و بیتمپ ها ‍پویانمای سنتی و دستی بسازید
GenericName[fa]=نرم افزار پویانمایی
Name[fa]=Pencil2D
Icon[fa]=org.pencil2d.Pencil2D
Comment[fr]=Créez une animation traditionnelle dessinée à la main à l'aide de graphismes bitmap et vectoriels
GenericName[fr]=Logiciel d'Animation
Comment[fr]=Créez une animation traditionnelle dessinée à la main à l'aide de graphiques bitmap et vectoriels
Name[fr]=Pencil2D
Icon[fr]=org.pencil2d.Pencil2D
Name[he]=Pencil2D
GenericName[he]=תוכנת הנפשה
Comment[he]=צרו הנפשה מסורתית מצויירת ביד באמצעות כלי מפת ביטים וכלים וקטוריים
Name[id]=Pensil2d
GenericName[id]=Animasi Perangkat Lunak
GenericName[he]=תוכנת הנפשה
Name[he]=Pencil2D
Icon[he]=org.pencil2d.Pencil2D
Comment[id]=Rangkai animasi khas dengan grafik bitmap maupun vektor
GenericName[id]=Animation Software
Name[id]=Pencil2d
Icon[id]=org.pencil2d.Pencil2D
Name[it]=Pencil2D
GenericName[it]=Software di animazione
Comment[it]=Crea dell'animazione tradizionale disegnata a mano usando sia la grafica bitmap che quella vettoriale
Name[hu_HU]=Pencil2D
GenericName[hu_HU]=Animációs Szoftver
GenericName[it]=Software di animazione
Name[it]=Pencil2D
Icon[it]=org.pencil2d.Pencil2D
Icon[ja]=org.pencil2d.Pencil2D
Comment[ko]=전통적 손그림 애니메이션을 비트맵과 벡터, 모두 사용하여 만드세요.
GenericName[ko]=애니메이션 소프트웨어
Name[ko]=Pencil2D
Icon[ko]=org.pencil2d.Pencil2D
Comment[yue]=以點陣圖跟向量圖兩種方式創作傳統手繪動畫
GenericName[yue]=动画软件
Name[yue]=Pencil2D
Icon[yue]=org.pencil2d.Pencil2D
Comment[uk_UA]=Створення традиційної мальованої анімації з використанням як растрової, так і векторної графіки
GenericName[uk_UA]=Програмне забезпечення для анімації
Name[uk_UA]=Pencil2D
Icon[uk_UA]=org.pencil2d.Pencil2D
Comment[hu_HU]=A Pencil2D egy animáció készítő/rajzoló szoftver Mac OS X, Windows és Linux rendszerekre. Hagyományos, kézzel rajzolt animációk készítésére alkalmas. Bitkép és vagy vektorgrafika használatával.
Icon[ms]=org.pencil2d.Pencil2D
Name[nb]=Pencil2D
GenericName[nb]=Animasjonsprogramvare
GenericName[hu_HU]=Animációs Szoftver
Name[hu_HU]=Pencil2D
Icon[hu_HU]=org.pencil2d.Pencil2D
Comment[nb]=Lag tradisjonell håndtegnet animasjon ved hjelp av både bitmap og vektorgrafikk
GenericName[nb]=Animasjonsprogramvare
Name[nb]=Pencil2D
Icon[nb]=org.pencil2d.Pencil2D
Name[kab]=Pencil2D
GenericName[kab]=Aseɣẓan n usemwwiwel
Comment[kab]=Snulfu-d asemwwiwel amansay yettusunɣen s ufus s wudlifen bitmap akked wudlifen imawayen
GenericName[kab]=Aseɣẓan n usemwwiwel
Name[kab]=Pencil2D
Icon[kab]=org.pencil2d.Pencil2D
Name[pl]=Pencil2D
GenericName[pl]=Oprogramowanie do tworzenia animacji
Comment[pl]=Twórz tradycyjne ręcznie rysowane animacje używając zarówno bitmap, jak i grafiki wektorowej
Name[pt]=Pencil2D
GenericName[pt]=Programa de Animação
GenericName[pl]=Oprogramowanie do tworzenia animacji
Name[pl]=Pencil2D
Icon[pl]=org.pencil2d.Pencil2D
Comment[pt]=Cria animações tradicionais feitas a mão utilizando bitmaps e vectores gráficos
GenericName[pt]=Programa de Animação
Name[pt]=Pencil2D
Icon[pt]=org.pencil2d.Pencil2D
Name[pt_BR]=Pencil2D
GenericName[pt_BR]=Software de animação
Comment[pt_BR]=Crie animações tradicionais feitas à mão usando gráficos de bitmap e vetoriais.
Name[ru]=Pencil2D
GenericName[ru]=Анимационное ПО
GenericName[pt_BR]=Software de animação
Name[pt_BR]=Pencil2D
Icon[pt_BR]=org.pencil2d.Pencil2D
Icon[ro]=org.pencil2d.Pencil2D
Comment[ru]=Создавайте традиционную рисованную анимацию, используя растровую и векторную графики.
Name[nl_NL]=Pencil2D
GenericName[nl_NL]=Animatie software
GenericName[ru]=Анимационное ПО
Name[ru]=Pencil2D
Icon[ru]=org.pencil2d.Pencil2D
Comment[nl_NL]=Maak traditionele handgetekende animaties met Bitmap en Vector afbeeldingen
Name[sl]=Svinčnik2D
GenericName[sl]=Program za animacijo
GenericName[nl_NL]=Animatie software
Name[nl_NL]=Pencil2D
Icon[nl_NL]=org.pencil2d.Pencil2D
Comment[si]=බිට්මැප් සහ දෛශික ග්‍රැෆික් යන දෙකෙන්ම සාම්ප්‍රදායික අතින් ඇද ගත් සජීවිකරණයක් සාදන්න
GenericName[si]=සජීවීකරණ මෘදුකාංගය
Name[si]=Pencil2D
Icon[si]=org.pencil2d.Pencil2D
Comment[sl]=Ustvarite tradicionalno ročno risano animacijo s pomočjo bitne in vektorske grafike
Name[sv]=Pencil2D
GenericName[sv]=Animeringsprogram
GenericName[sl]=Program za animacijo
Name[sl]=Svinčnik2D
Icon[sl]=org.pencil2d.Pencil2D
Comment[sv]=Skapa traditionellt handritade animationer, med både bitmap- och vektorgrafik
GenericName[sv]=Animeringsprogram
Name[sv]=Pencil2D
Icon[sv]=org.pencil2d.Pencil2D
Name[hi_IN]=कोयला कलम २ डी
GenericName[hi_IN]=एनीमेशन सॉफ्टवेयर
Icon[ta]=org.pencil2d.Pencil2D
Comment[hi_IN]=बिटमैप और वेक्टर दृश्यों दोनों को हाथ के चित्रवर्णन से चलचित्र बनाइए
GenericName[hi_IN]=एनीमेशन सॉफ्टवेयर
Name[hi_IN]=कोयला कलम २ डी
Icon[hi_IN]=org.pencil2d.Pencil2D
Name[tr]=Pencil2D
GenericName[tr]=Animasyon Yazılımı
Comment[tr]=Hem bitmap hem de vektör grafikleri kullanarak geleneksel elle çizilmiş animasyonlar oluşturun
GenericName[tr]=Animasyon Yazılımı
Name[tr]=Pencil2D
Icon[tr]=org.pencil2d.Pencil2D
Name[vi]=Pencil 2D
GenericName[vi]=Phần mềm làm phim hoạt hình
Comment[vi]=Tạo nên các chuyển Động hoạt hình vẽ tay truyền thống bằng các hình ảnh Bitmap và Vector
Name[zh_CN]=Pencil2D
GenericName[zh_CN]=动画软件
Comment[vi]=Tạo nên hoạt hình vẽ tay truyền thống bằng các đồ họa bitmap và vector
GenericName[vi]=Phần mềm Hoạt hình
Name[vi]=Pencil2D
Icon[vi]=org.pencil2d.Pencil2D
Comment[zh_CN]=用位图和矢量两种图像技术创作传统手绘动画
Name[zh_TW]=Pencil2D
GenericName[zh_TW]=動畫軟體
GenericName[zh_CN]=动画软件
Name[zh_CN]=Pencil2D
Icon[zh_CN]=org.pencil2d.Pencil2D
Comment[zh_TW]=以點陣圖跟向量圖兩種方式創作傳統手繪動畫
GenericName[zh_TW]=動畫軟體
Name[zh_TW]=Pencil2D
Icon[zh_TW]=org.pencil2d.Pencil2D
Comment[fil]=Gumawa nang tradisyonal na mano-manong animasyon gamit ang parehong bitmap at vector graphics
GenericName[fil]=Animation Software
Name[fil]=Lapis2D
Icon[fil]=org.pencil2d.Pencil2D
6 changes: 6 additions & 0 deletions app/src/generalpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ GeneralPage::GeneralPage() : ui(new Ui::GeneralPage)
{
// translatable string, endonym, locale code
{ tr("Arabic"), QStringLiteral("العربية"), "ar" },
{ tr("Bulgarian"), QStringLiteral("Български"), "bg" },
{ tr("Catalan"), QStringLiteral("Català"), "ca" },
{ tr("Czech"), QStringLiteral("Čeština"), "cs" },
{ tr("Danish"), QStringLiteral("Dansk"), "da" },
Expand All @@ -43,13 +44,17 @@ GeneralPage::GeneralPage() : ui(new Ui::GeneralPage)
{ tr("English"), QStringLiteral("English"), "en" },
{ tr("Spanish"), QStringLiteral("Español"), "es" },
{ tr("Estonian"), QStringLiteral("Eesti"), "et" },
{ tr("Persian"), QStringLiteral("فارسی"), "fa" },
{ tr("French"), QStringLiteral("Français"), "fr" },
{ tr("Hebrew"), QStringLiteral("עברית"), "he" },
{ tr("Hungarian"), QStringLiteral("Magyar"), "hu_HU" },
{ tr("Indonesian"), QStringLiteral("Bahasa Indonesia"), "id" },
{ tr("Italian"), QStringLiteral("Italiano"), "it" },
{ tr("Japanese"), QStringLiteral("日本語"), "ja" },
{ tr("Kabyle"), QStringLiteral("Taqbaylit"), "kab" },
{ tr("Korean"), QStringLiteral("한국어"), "ko" },
{ tr("Norwegian Bokmål"), QStringLiteral("Norsk bokmål"), "nb" },
{ tr("Dutch \u2013 Netherlands"), QStringLiteral("Nederlands \u2013 Nederland"), "nl_NL" },
{ tr("Polish"), QStringLiteral("Polski"), "pl" },
{ tr("Portuguese \u2013 Portugal"), QStringLiteral("Português \u2013 Portugal"), "pt_PT" },
{ tr("Portuguese \u2013 Brazil"), QStringLiteral("Português \u2013 Brasil"), "pt_BR" },
Expand All @@ -58,6 +63,7 @@ GeneralPage::GeneralPage() : ui(new Ui::GeneralPage)
{ tr("Swedish"), QStringLiteral("Svenska"), "sv" },
{ tr("Turkish"), QStringLiteral("Türkçe"), "tr" },
{ tr("Vietnamese"), QStringLiteral("Tiếng Việt"), "vi" },
{ tr("Cantonese"), QStringLiteral("粵语"), "yue" },
{ tr("Chinese \u2013 China"), QStringLiteral("简体中文"), "zh_CN" },
{ tr("Chinese \u2013 Taiwan"), QStringLiteral("繁體中文"), "zh_TW" },
};
Expand Down
26 changes: 22 additions & 4 deletions core_lib/src/graphics/bitmap/tiledbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ Tile* TiledBuffer::getTileFromIndex(const TileIndex& tileIndex)
return selectedTile;
}

void TiledBuffer::drawBrush(const QPointF& point, int brushWidth, QPen pen, QBrush brush, QPainter::CompositionMode cm, bool antialiasing) {
const QRectF brushRect(point.x() - 0.5 * brushWidth, point.y() - 0.5 * brushWidth, brushWidth, brushWidth);
void TiledBuffer::drawBrush(QPointF point, qreal brushWidth, QPen pen, QBrush brush, QPainter::CompositionMode cm, bool antialiasing) {
const float tileSize = UNIFORM_TILE_SIZE;

// Gather the number of tiles that fits the size of the brush width
Expand All @@ -58,6 +57,21 @@ void TiledBuffer::drawBrush(const QPointF& point, int brushWidth, QPen pen, QBru
const int yTop = qFloor(qFloor(point.y() - brushWidth) / tileSize);
const int yBottom = qFloor(qFloor(point.y() + brushWidth) / tileSize);

// If we are not using antialiasing, make sure at least one pixel is within the brush's circle
bool drawPoint = false;
if (!antialiasing && brushWidth < 1.42) { // Overestimated approximation of 2*sqrt(2), which is the maximum distance a point can be from the center of a pixel
// Measure the actual distance to the center of the nearest pixel
const QPointF nearestPixelCenter(qRound(point.x()+0.5)-0.5, qRound(point.y()+0.5)-0.5);
const qreal distanceToNearest = QLineF(point, nearestPixelCenter).length();
if (distanceToNearest >= brushWidth/2) {
// Nothing will be drawn with drawEllipse, so prepare to draw the nearest pixel with drawPoint
drawPoint = true;
point = QPointF(nearestPixelCenter.x() - 0.5, nearestPixelCenter.y() - 0.5);
pen = QPen(brush, 1);
}
}
const QRectF brushRect(point.x() - 0.5 * brushWidth, point.y() - 0.5 * brushWidth, brushWidth, brushWidth);

for (int tileY = yTop; tileY <= yBottom; tileY++) {
for (int tileX = xLeft; tileX <= xRight; tileX++) {

Expand All @@ -70,7 +84,11 @@ void TiledBuffer::drawBrush(const QPointF& point, int brushWidth, QPen pen, QBru
painter.setPen(pen);
painter.setBrush(brush);
painter.setCompositionMode(cm);
painter.drawEllipse(brushRect);
if (drawPoint) {
painter.drawPoint(point);
} else {
painter.drawEllipse(brushRect);
}
painter.end();

mTileBounds.extend(tile->bounds());
Expand Down Expand Up @@ -110,7 +128,7 @@ void TiledBuffer::drawImage(const QImage& image, const QRect& imageBounds, QPain
void TiledBuffer::drawPath(QPainterPath path, QPen pen, QBrush brush,
QPainter::CompositionMode cm, bool antialiasing)
{
const int width = pen.width();;
const qreal width = pen.widthF();
const float tileSize = UNIFORM_TILE_SIZE;
const QRectF pathRect = path.boundingRect();

Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/graphics/bitmap/tiledbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TiledBuffer: public QObject
bool isValid() const { return !mTiles.isEmpty(); }

/** Draws a brush with the specified parameters to the tiled buffer */
void drawBrush(const QPointF& point, int brushWidth, QPen pen, QBrush brush, QPainter::CompositionMode cm, bool antialiasing);
void drawBrush(QPointF point, qreal brushWidth, QPen pen, QBrush brush, QPainter::CompositionMode cm, bool antialiasing);
/** Draws a path with the specified parameters to the tiled buffer */
void drawPath(QPainterPath path, QPen pen, QBrush brush,
QPainter::CompositionMode cm, bool antialiasing);
Expand Down
4 changes: 2 additions & 2 deletions core_lib/src/graphics/vector/vectorimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void VectorImage::checkCurveExtremity(BezierCurve& newCurve, qreal tolerance)
if (dist1 + dist2 <= 3 * tol3) // pre-selection, to speed up
{
QPointF nearestPoint = Q;
qreal t = -1.0;;
qreal t = -1.0;
qreal distance = BezierCurve::findDistance(mCurves[i], j, Q, nearestPoint, t);
if (distance < tolerance)
{
Expand Down Expand Up @@ -521,7 +521,7 @@ void VectorImage::checkCurveIntersections(BezierCurve& newCurve, qreal tolerance
{
// TO DO: find a better intersection point
QPointF nearestPoint = Q;
qreal t = -1.0;;
qreal t = -1.0;
qreal distance = BezierCurve::findDistance(newCurve, k, Q, nearestPoint, t);
//qDebug() << "OK2" << t;
if (distance < tolerance)
Expand Down
Loading

0 comments on commit 4236dfa

Please sign in to comment.