KSaneCore

imagebuilder.h
1/*
2 * SPDX-FileCopyrightText: 2009 Kare Sars <kare dot sars at iki dot fi>
3 * SPDX-FileCopyrightText: 2018 Alexander Volkov <a.volkov@rusbitech.ru>
4 * SPDX-FileCopyrightText: 2021 Alexander Stippich <a.stippich@gmx.net>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef KSANE_IMAGE_BUILDER_H
10#define KSANE_IMAGE_BUILDER_H
11
12extern "C"
13{
14#include <sane/sane.h>
15}
16
17class QImage;
18
19namespace KSaneCore
20{
21
22/* Constructs a QImage out of the raw scanned data retrieved via libsane */
23class ImageBuilder
24{
25public:
26 ImageBuilder(QImage *image, int *dpi);
27
28 void start(const SANE_Parameters &params);
29 void beginFrame(const SANE_Parameters &params);
30 bool copyToImage(const SANE_Byte readData[], int read_bytes);
31 void setDPI(int dpi);
32 void cropImagetoSize();
33
34private:
35 void renewImage();
36 void incrementPixelData();
37
38 SANE_Parameters m_params;
39 int m_frameRead = 0;
40 int m_pixelX = 0;
41 int m_pixelY = 0;
42 int m_pixelData[6];
43 int m_pixelDataIndex = 0;
44
45 QImage *m_image;
46 int *m_dpi;
47};
48
49} // namespace KSaneCore
50
51#endif // KSANE_IMAGE_BUILDER_H
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:19 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.