[Kde-imaging] KDE/kdegraphics/libs
Kåre Särs
kare.sars at iki.fi
Wed Jul 15 23:29:51 CEST 2009
SVN commit 997486 by sars:
Add a TWAIN wrapper (from the work branch).
If SANE is not found on Windows, the Twain wrapper is used.
The ksane widget is only a button to launch the built-in scan dialogs of the twain enabled devices. It makes it possible to use libksane on windows, but the result is not elegant :(
My itch is not strong enough to do a generic twain interface, so if there is somebody with that kind of itch, I would be happy to integrate it and look over the API if changes are needed.
OSX: The code uses LoadLibraryA() to loads the "TWAIN_32.DLL", so I'm not sure how it would work on OSX...
CCMAIL: kde-imaging at kde.org
M +3 -3 CMakeLists.txt
M +10 -3 libksane/CMakeLists.txt
A libksane/ksanetwain (directory)
A libksane/ksanetwain/CMakeLists.txt
A libksane/ksanetwain/ktwain_widget.cpp [License: LGPL]
A libksane/ksanetwain/twain.h [License: UNKNOWN] [UTF-8 ENCODING PROBLEMS]
A libksane/ksanetwain/twainiface.cpp [License: GPL (v2+)]
A libksane/ksanetwain/twainiface.h [License: GPL (v2+)]
M +1 -0 libksane/libksane/ksane.h
M +15 -14 libksane/libksane/ksane_widget_private.cpp
--- trunk/KDE/kdegraphics/libs/CMakeLists.txt #997485:997486
@@ -1,7 +1,7 @@
add_subdirectory(libkipi)
add_subdirectory(libkdcraw)
add_subdirectory(libkexiv2)
-if (SANE_FOUND)
- add_subdirectory(libksane)
-endif (SANE_FOUND)
+if (WIN32 OR SANE_FOUND)
+ add_subdirectory(libksane)
+endif ()
add_subdirectory(mobipocket)
--- trunk/KDE/kdegraphics/libs/libksane/CMakeLists.txt #997485:997486
@@ -3,7 +3,11 @@
# building separately or as part of kdegraphics ?
if(NOT KDE4_FOUND)
find_package(KDE4 REQUIRED)
- find_package(Sane REQUIRED)
+ if (NOT WIN32)
+ find_package(Sane REQUIRED)
+ else (NOT WIN32)
+ find_package(Sane)
+ endif (NOT WIN32)
include_directories(
${KDE4_INCLUDES}
@@ -51,9 +55,12 @@
# =======================================================
+IF (SANE_FOUND)
+ SUBDIRS(libksane)
+ELSE (SANE_FOUND)
+ SUBDIRS(ksanetwain)
+ENDIF (SANE_FOUND)
-SUBDIRS(libksane)
-
IF(NOT WIN32)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libksane.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libksane.pc)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libksane.lsm.cmake ${CMAKE_CURRENT_BINARY_DIR}/libksane.lsm)
--- trunk/KDE/kdegraphics/libs/libksane/libksane/ksane.h #997485:997486
@@ -63,6 +63,7 @@
FormatRGB_16_C, /**< Every pixel consists of three colors in the order Read,
* Grean and Blue, with two bytes per color(no alpha channel).
* The byte order is the one provided by libsane. */
+ FormatBMP, /**< The image data is returned as a BMP. */
FormatNone = 0xFFFF /**< This enumeration value should never be returned to the user */
} ImageFormat;
--- trunk/KDE/kdegraphics/libs/libksane/libksane/ksane_widget_private.cpp #997485:997486
@@ -140,20 +140,20 @@
default:
return KSaneWidget::FormatNone;
}
- case SANE_FRAME_RGB:
- case SANE_FRAME_RED:
- case SANE_FRAME_GREEN:
- case SANE_FRAME_BLUE:
- switch (params.depth)
- {
- case 8:
- return KSaneWidget::FormatRGB_8_C;
- case 16:
- return KSaneWidget::FormatRGB_16_C;
- default:
- return KSaneWidget::FormatNone;
- }
- }
+ case SANE_FRAME_RGB:
+ case SANE_FRAME_RED:
+ case SANE_FRAME_GREEN:
+ case SANE_FRAME_BLUE:
+ switch (params.depth)
+ {
+ case 8:
+ return KSaneWidget::FormatRGB_8_C;
+ case 16:
+ return KSaneWidget::FormatRGB_16_C;
+ default:
+ return KSaneWidget::FormatNone;
+ }
+}
return KSaneWidget::FormatNone;
}
@@ -173,6 +173,7 @@
return params.pixels_per_line*8;
case KSaneWidget::FormatNone:
+ case KSaneWidget::FormatBMP: // to remove warning (BMP is omly valid in the twain wrapper)
return 0;
}
return 0;
More information about the Kde-imaging
mailing list