• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

libs/libksane/libksane

  • sources
  • kde-4.14
  • kdegraphics
  • libs
  • libksane
  • libksane
ksane_preview_thread.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is part of the KDE project
4  *
5  * Date : 2009-11-13
6  * Description : Sane interface for KDE
7  *
8  * Copyright (C) 2009 by Kare Sars <kare dot sars at iki dot fi>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) version 3, or any
14  * later version accepted by the membership of KDE e.V. (or its
15  * successor approved by the membership of KDE e.V.), which shall
16  * act as a proxy defined in Section 6 of version 3 of the license.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  * ============================================================ */
27 
28 #ifndef KSANE_PREVIEW_THREAD_H
29 #define KSANE_PREVIEW_THREAD_H
30 
31 // Sane includes
32 extern "C"
33 {
34  #include <sane/saneopts.h>
35  #include <sane/sane.h>
36 }
37 
38 #include <QThread>
39 #include <QMutex>
40 #include <QImage>
41 
42 #define PREVIEW_READ_CHUNK_SIZE 100000
43 
44 namespace KSaneIface
45 {
46  class KSanePreviewThread: public QThread
47  {
48  Q_OBJECT
49  public:
50  typedef enum
51  {
52  READ_ON_GOING,
53  READ_ERROR,
54  READ_CANCEL,
55  READ_READY
56  } ReadStatus;
57 
58  KSanePreviewThread(SANE_Handle handle, QImage *img);
59  void run();
60  void setPreviewInverted(bool);
61  void cancelScan();
62  int scanProgress();
63  bool saneStartDone();
64  bool imageResized();
65 
66  SANE_Status status;
67  QMutex imgMutex;
68 
69  private:
70  void readData();
71  void copyToPreviewImg(int readBytes);
72 
73  SANE_Byte m_readData[PREVIEW_READ_CHUNK_SIZE];
74  int m_frameSize;
75  int m_frameRead;
76  int m_dataSize;
77  int m_frame_t_count;
78  int m_pixel_x;
79  int m_pixel_y;
80  int m_px_colors[3];
81  int m_px_c_index;
82  SANE_Parameters m_params;
83  QImage *m_img;
84  SANE_Handle m_saneHandle;
85  bool m_invertColors;
86  ReadStatus m_readStatus;
87 // int m_scanProgress;
88  bool m_saneStartDone;
89  bool m_imageResized;
90  };
91 }
92 
93 
94 #endif
QMutex
KSaneIface::KSanePreviewThread::ReadStatus
ReadStatus
Definition: ksane_preview_thread.h:50
KSaneIface::KSanePreviewThread::cancelScan
void cancelScan()
Definition: ksane_preview_thread.cpp:65
KSaneIface::KSanePreviewThread::status
SANE_Status status
Definition: ksane_preview_thread.h:66
KSaneIface::KSanePreviewThread
Definition: ksane_preview_thread.h:46
KSaneIface::KSanePreviewThread::imageResized
bool imageResized()
Definition: ksane_preview_thread.cpp:463
KSaneIface::KSanePreviewThread::READ_ERROR
Definition: ksane_preview_thread.h:53
KSaneIface::KSanePreviewThread::run
void run()
Definition: ksane_preview_thread.cpp:70
KSaneIface::KSanePreviewThread::KSanePreviewThread
KSanePreviewThread(SANE_Handle handle, QImage *img)
Definition: ksane_preview_thread.cpp:37
KSaneIface::KSanePreviewThread::saneStartDone
bool saneStartDone()
Definition: ksane_preview_thread.cpp:458
PREVIEW_READ_CHUNK_SIZE
#define PREVIEW_READ_CHUNK_SIZE
Definition: ksane_preview_thread.h:42
KSaneIface::KSanePreviewThread::READ_READY
Definition: ksane_preview_thread.h:55
KSaneIface::KSanePreviewThread::imgMutex
QMutex imgMutex
Definition: ksane_preview_thread.h:67
KSaneIface::KSanePreviewThread::scanProgress
int scanProgress()
Definition: ksane_preview_thread.cpp:138
KSaneIface::KSanePreviewThread::READ_ON_GOING
Definition: ksane_preview_thread.h:52
QImage
KSaneIface::KSanePreviewThread::READ_CANCEL
Definition: ksane_preview_thread.h:54
KSaneIface::KSanePreviewThread::setPreviewInverted
void setPreviewInverted(bool)
Definition: ksane_preview_thread.cpp:60
QThread
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libs/libksane/libksane

Skip menu "libs/libksane/libksane"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal