ports/graphics/epsonscan2/files/patch-src_Standalone_rotateimage.cpp
Rainer Hurling 27df5bce08 graphics/epsonscan2: Add new port for Epson Scanners
This is a port of the Seiko/Epson Epsonscan2 scanner engine and GUI[1].

It provides a complete alternative to sane/xsane with its own scanner engine and GUI.
It also provides a sane back-end library (libsane-epsonscan2.so) so that it works with the sane package.

There are two parts to this port:
  - graphics/epsonscan2 - the main scanner engine and GUI that
    works with (most) USB scanners
  - graphics/epsonscan2-non-free-plugin - support for Epson's
    Linux binary that adds network access to scanners and
    usb access to some particular scanners

Please read the file %%PREFIX%%/lib/epsonscan2/Read_me.FreeBSD for notes on how to set this up and use it.

[1] https://download.ebz.epson.net/man/linux/epsonscan2_e.html

PR:		261891
Reviewed by:	(partly) Tatsuki Makino <tatsuki_makino@hotmail.com>, diizzy@
2022-04-03 10:44:09 +02:00

47 lines
1.8 KiB
C++

--- src/Standalone/rotateimage.cpp.orig 2021-11-25 00:56:56 UTC
+++ src/Standalone/rotateimage.cpp
@@ -28,34 +28,34 @@ RotateImage::RotateImage(ColorType type)
void RotateImage::Rotate(std::string image_path, int angle, ImageFormat format, bool multiTiffEnabled)
{
std::string file_format;
- if (format == kSDIImageFormatJPEG)
+ if (format == (ImageFormat)kSDIImageFormatJPEG)
{
file_format = "JPG";
- }else if (format == ImageFormatColorJpegMonoRaw)
+ }else if (format == (ImageFormat)ImageFormatColorJpegMonoRaw)
{
if(m_type == ColorTypeMono1){
file_format = "PBM";
}else {
file_format = "JPG";
}
- }else if (format == kSDIImageFormatPNM && !multiTiffEnabled)
+ }else if (format == (ImageFormat)kSDIImageFormatPNM && !multiTiffEnabled)
{
file_format = "PPM";
- }else if (format == kSDIImageFormatTIFF)
+ }else if (format == (ImageFormat)kSDIImageFormatTIFF)
{
file_format = "TIFF";
- }else if (format == kSDIImageFormatPNG)
+ }else if (format == (ImageFormat)kSDIImageFormatPNG)
{
file_format = "PNG";
- }else if (format == kSDIImageFormatPNM && multiTiffEnabled)
+ }else if (format == (ImageFormat)kSDIImageFormatPNM && multiTiffEnabled)
{
file_format = "PPM";
}
QImage srcImg(image_path.c_str());
QPoint center = srcImg.rect().center();
- QMatrix matrix;
- matrix.translate(center.x(), center.y());
- matrix.rotate(angle);
- QImage dstImg = srcImg.transformed(matrix);
+ QTransform transform;
+ transform.translate(center.x(), center.y());
+ transform.rotate(angle);
+ QImage dstImg = srcImg.transformed(transform);
dstImg.save(QString::fromStdString(image_path), file_format.c_str(), -1);
}