From d7b5486d853e6e51671a3249143ebbf12bb607bd Mon Sep 17 00:00:00 2001 From: gambas Date: Fri, 25 Feb 2022 20:30:55 +0100 Subject: [PATCH] Image.Stretch() now takes a third optional argument to stretch without antialiasing. [GB.GTK] * NEW: Image.Stretch() now takes a third optional argument to stretch without antialiasing. [GB.GTK3] * NEW: Image.Stretch() now takes a third optional argument to stretch without antialiasing. [GB.QT4] * NEW: Image.Stretch() now takes a third optional argument to stretch without antialiasing. [GB.QT5] * NEW: Image.Stretch() now takes a third optional argument to stretch without antialiasing. --- gb.gtk/src/CImage.cpp | 6 +++--- gb.qt4/src/CImage.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gb.gtk/src/CImage.cpp b/gb.gtk/src/CImage.cpp index d65aeb65b..dff1b139b 100644 --- a/gb.gtk/src/CImage.cpp +++ b/gb.gtk/src/CImage.cpp @@ -211,12 +211,12 @@ BEGIN_METHOD(Image_Save, GB_STRING path; GB_INTEGER quality) END_METHOD -BEGIN_METHOD(Image_Stretch, GB_INTEGER width; GB_INTEGER height) +BEGIN_METHOD(Image_Stretch, GB_INTEGER width; GB_INTEGER height; GB_BOOLEAN fast) CIMAGE *img; check_image(THIS); - img = CIMAGE_create(PICTURE->stretch(VARG(width), VARG(height), true)); + img = CIMAGE_create(PICTURE->stretch(VARG(width), VARG(height), !VARGOPT(fast, FALSE))); GB.ReturnObject((void*)img); END_METHOD @@ -276,7 +276,7 @@ GB_DESC CImageDesc[] = GB_STATIC_METHOD("FromString", "Image", Image_FromString, "(Data)s"), GB_METHOD("Save", 0, Image_Save, "(Path)s[(Quality)i]"), - GB_METHOD("Stretch", "Image", Image_Stretch, "(Width)i(Height)i"), + GB_METHOD("Stretch", "Image", Image_Stretch, "(Width)i(Height)i[(Fast)b]"), GB_METHOD("Rotate", "Image", Image_Rotate, "(Angle)f"), GB_METHOD("PaintImage", 0, Image_PaintImage, "(Image)Image;(X)i(Y)i[(Width)i(Height)i(SrcX)i(SrcY)i(SrcWidth)i(SrcHeight)i]"), diff --git a/gb.qt4/src/CImage.cpp b/gb.qt4/src/CImage.cpp index 08f6327f6..d2a205371 100644 --- a/gb.qt4/src/CImage.cpp +++ b/gb.qt4/src/CImage.cpp @@ -217,7 +217,7 @@ BEGIN_METHOD(Image_Save, GB_STRING path; GB_INTEGER quality) END_METHOD -BEGIN_METHOD(Image_Stretch, GB_INTEGER width; GB_INTEGER height) +BEGIN_METHOD(Image_Stretch, GB_INTEGER width; GB_INTEGER height; GB_BOOLEAN fast) //static int count = 0; QImage *stretch; @@ -239,7 +239,7 @@ BEGIN_METHOD(Image_Stretch, GB_INTEGER width; GB_INTEGER height) if (w > 0 && h > 0) { - *stretch = QIMAGE->scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + *stretch = QIMAGE->scaled(w, h, Qt::IgnoreAspectRatio, VARGOPT(fast, FALSE) ? Qt::FastTransformation : Qt::SmoothTransformation); stretch->detach(); } } @@ -333,7 +333,7 @@ GB_DESC CImageDesc[] = GB_STATIC_METHOD("FromString", "Image", Image_FromString, "(Data)s"), GB_METHOD("Save", NULL, Image_Save, "(Path)s[(Quality)i]"), - GB_METHOD("Stretch", "Image", Image_Stretch, "(Width)i(Height)i"), + GB_METHOD("Stretch", "Image", Image_Stretch, "(Width)i(Height)i[(Fast)b]"), GB_METHOD("Rotate", "Image", Image_Rotate, "(Angle)f"), GB_METHOD("PaintImage", NULL, Image_PaintImage, "(Image)Image;(X)i(Y)i[(Width)i(Height)i(SrcX)i(SrcY)i(SrcWidth)i(SrcHeight)i]"),