Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2c0fea94
Commit
2c0fea94
authored
Mar 02, 2009
by
Jeremy White
Committed by
Alexandre Julliard
Mar 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sane.ds: Implement grayscale and B&W scanning for native image transfers.
parent
1d58b7e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
11 deletions
+47
-11
capability.c
dlls/sane.ds/capability.c
+7
-4
ds_image.c
dlls/sane.ds/ds_image.c
+40
-7
No files found.
dlls/sane.ds/capability.c
View file @
2c0fea94
...
...
@@ -685,9 +685,11 @@ static TW_UINT16 SANE_ICAPResolution (pTW_CAPABILITY pCapability, TW_UINT16 acti
/* ICAP_PIXELFLAVOR */
static
TW_UINT16
SANE_ICAPPixelFlavor
(
pTW_CAPABILITY
pCapability
,
TW_UINT16
action
)
{
TW_UINT16
twCC
=
TWCC_BADCAP
;
#ifdef SONAME_LIBSANE
static
const
TW_UINT32
possible_values
[]
=
{
TWPF_CHOCOLATE
,
TWPF_VANILLA
};
TW_UINT32
val
;
TW_UINT
16
twCC
=
TWCC_BADCAP
;
TW_UINT
32
flavor
=
activeDS
.
sane_param
.
depth
==
1
?
TWPF_VANILLA
:
TWPF_CHOCOLATE
;
TRACE
(
"ICAP_PIXELFLAVOR
\n
"
);
...
...
@@ -700,7 +702,7 @@ static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 act
case
MSG_GET
:
twCC
=
msg_get_enum
(
pCapability
,
possible_values
,
sizeof
(
possible_values
)
/
sizeof
(
possible_values
[
0
]),
TWTY_UINT16
,
TWPF_CHOCOLATE
,
TWPF_CHOCOLATE
);
TWTY_UINT16
,
flavor
,
flavor
);
break
;
case
MSG_SET
:
...
...
@@ -712,16 +714,17 @@ static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 act
break
;
case
MSG_GETDEFAULT
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_UINT16
,
TWPF_CHOCOLATE
);
twCC
=
set_onevalue
(
pCapability
,
TWTY_UINT16
,
flavor
);
break
;
case
MSG_RESET
:
/* .. fall through intentional .. */
case
MSG_GETCURRENT
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_UINT16
,
TWPF_CHOCOLATE
);
twCC
=
set_onevalue
(
pCapability
,
TWTY_UINT16
,
flavor
);
break
;
}
#endif
return
twCC
;
}
...
...
dlls/sane.ds/ds_image.c
View file @
2c0fea94
...
...
@@ -142,7 +142,10 @@ TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
pImageInfo
->
Planar
=
TRUE
;
pImageInfo
->
SamplesPerPixel
=
1
;
pImageInfo
->
BitsPerSample
[
0
]
=
activeDS
.
sane_param
.
depth
;
pImageInfo
->
PixelType
=
TWPT_GRAY
;
if
(
activeDS
.
sane_param
.
depth
==
1
)
pImageInfo
->
PixelType
=
TWPT_BW
;
else
pImageInfo
->
PixelType
=
TWPT_GRAY
;
}
else
{
...
...
@@ -366,7 +369,10 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
int
dib_bytes
;
int
dib_bytes_per_line
;
BYTE
*
line
;
RGBQUAD
*
colors
;
int
color_size
=
0
;
int
i
;
BYTE
*
p
;
TRACE
(
"DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET
\n
"
);
...
...
@@ -397,9 +403,23 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
return
TWRC_FAILURE
;
}
if
(
activeDS
.
sane_param
.
format
!=
SANE_FRAME_RGB
)
if
(
activeDS
.
sane_param
.
format
==
SANE_FRAME_GRAY
)
{
FIXME
(
"For NATIVE, we support only RGB, not %d
\n
"
,
activeDS
.
sane_param
.
format
);
if
(
activeDS
.
sane_param
.
depth
==
8
)
color_size
=
(
1
<<
8
)
*
sizeof
(
*
colors
);
else
if
(
activeDS
.
sane_param
.
depth
==
1
)
;
else
{
FIXME
(
"For NATIVE, we support only 1 bit monochrome and 8 bit Grayscale, not %d
\n
"
,
activeDS
.
sane_param
.
depth
);
psane_cancel
(
activeDS
.
deviceHandle
);
activeDS
.
twCC
=
TWCC_OPERATIONERROR
;
return
TWRC_FAILURE
;
}
}
else
if
(
activeDS
.
sane_param
.
format
!=
SANE_FRAME_RGB
)
{
FIXME
(
"For NATIVE, we support only GRAY and RGB, not %d
\n
"
,
activeDS
.
sane_param
.
format
);
psane_cancel
(
activeDS
.
deviceHandle
);
activeDS
.
twCC
=
TWCC_OPERATIONERROR
;
return
TWRC_FAILURE
;
...
...
@@ -413,7 +433,7 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
dib_bytes_per_line
=
((
activeDS
.
sane_param
.
bytes_per_line
+
3
)
/
4
)
*
4
;
dib_bytes
=
activeDS
.
sane_param
.
lines
*
dib_bytes_per_line
;
hDIB
=
GlobalAlloc
(
GMEM_ZEROINIT
,
dib_bytes
+
sizeof
(
*
header
));
hDIB
=
GlobalAlloc
(
GMEM_ZEROINIT
,
dib_bytes
+
sizeof
(
*
header
)
+
color_size
);
if
(
hDIB
)
header
=
GlobalLock
(
hDIB
);
...
...
@@ -430,18 +450,31 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
header
->
biWidth
=
activeDS
.
sane_param
.
pixels_per_line
;
header
->
biHeight
=
activeDS
.
sane_param
.
lines
;
header
->
biPlanes
=
1
;
header
->
biBitCount
=
activeDS
.
sane_param
.
depth
*
3
;
header
->
biCompression
=
BI_RGB
;
if
(
activeDS
.
sane_param
.
format
==
SANE_FRAME_RGB
)
header
->
biBitCount
=
activeDS
.
sane_param
.
depth
*
3
;
if
(
activeDS
.
sane_param
.
format
==
SANE_FRAME_GRAY
)
header
->
biBitCount
=
activeDS
.
sane_param
.
depth
;
header
->
biSizeImage
=
dib_bytes
;
header
->
biXPelsPerMeter
=
0
;
header
->
biYPelsPerMeter
=
0
;
header
->
biClrUsed
=
0
;
header
->
biClrImportant
=
0
;
p
=
(
BYTE
*
)(
header
+
1
);
if
(
color_size
>
0
)
{
colors
=
(
RGBQUAD
*
)
p
;
p
+=
color_size
;
for
(
i
=
0
;
i
<
(
color_size
/
sizeof
(
*
colors
));
i
++
)
colors
[
i
].
rgbBlue
=
colors
[
i
].
rgbRed
=
colors
[
i
].
rgbGreen
=
i
;
}
/* Sane returns data in top down order. Acrobat does best with
a bottom up DIB being returned. */
line
=
(
BYTE
*
)(
header
+
1
)
+
(
activeDS
.
sane_param
.
lines
-
1
)
*
dib_bytes_per_line
;
line
=
p
+
(
activeDS
.
sane_param
.
lines
-
1
)
*
dib_bytes_per_line
;
for
(
i
=
activeDS
.
sane_param
.
lines
-
1
;
i
>=
0
;
i
--
)
{
activeDS
.
progressWnd
=
ScanningDialogBox
(
activeDS
.
progressWnd
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment