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
d63aa5dc
Commit
d63aa5dc
authored
Oct 25, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sane.ds: Add helper function to set/get the scan area.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b263ff26
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
143 deletions
+78
-143
capability.c
dlls/sane.ds/capability.c
+13
-58
ds_image.c
dlls/sane.ds/ds_image.c
+12
-43
options.c
dlls/sane.ds/options.c
+49
-38
sane_i.h
dlls/sane.ds/sane_i.h
+4
-4
No files found.
dlls/sane.ds/capability.c
View file @
d63aa5dc
...
@@ -641,25 +641,14 @@ static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action
...
@@ -641,25 +641,14 @@ static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action
{
{
TW_UINT16
twCC
;
TW_UINT16
twCC
;
TW_FIX32
res
;
TW_FIX32
res
;
char
option_name
[
64
];
int
tlx
,
tly
,
brx
,
bry
;
SANE_Fixed
lower
,
upper
;
SANE_Unit
lowerunit
,
upperunit
;
TRACE
(
"ICAP_PHYSICAL%s
\n
"
,
cap
==
ICAP_PHYSICALHEIGHT
?
"HEIGHT"
:
"WIDTH"
);
TRACE
(
"ICAP_PHYSICAL%s
\n
"
,
cap
==
ICAP_PHYSICALHEIGHT
?
"HEIGHT"
:
"WIDTH"
);
sprintf
(
option_name
,
"tl-%c"
,
cap
==
ICAP_PHYSICALHEIGHT
?
'y'
:
'x'
);
twCC
=
sane_option_get_max_scan_area
(
&
tlx
,
&
tly
,
&
brx
,
&
bry
);
twCC
=
sane_option_probe_scan_area
(
option_name
,
NULL
,
&
lowerunit
,
&
lower
,
NULL
,
NULL
);
if
(
twCC
!=
TWCC_SUCCESS
)
return
twCC
;
if
(
twCC
!=
TWCC_SUCCESS
)
return
twCC
;
sprintf
(
option_name
,
"br-%c"
,
cap
==
ICAP_PHYSICALHEIGHT
?
'y'
:
'x'
);
res
=
convert_sane_res_to_twain
(
(
cap
==
ICAP_PHYSICALHEIGHT
)
?
bry
-
tly
:
brx
-
tlx
);
twCC
=
sane_option_probe_scan_area
(
option_name
,
NULL
,
&
upperunit
,
NULL
,
&
upper
,
NULL
);
if
(
twCC
!=
TWCC_SUCCESS
)
return
twCC
;
if
(
upperunit
!=
lowerunit
)
return
TWCC_BADCAP
;
if
(
!
convert_sane_res_to_twain
(
SANE_UNFIX
(
upper
)
-
SANE_UNFIX
(
lower
),
upperunit
,
&
res
,
TWUN_INCHES
))
return
TWCC_BADCAP
;
switch
(
action
)
switch
(
action
)
{
{
...
@@ -727,56 +716,22 @@ static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 act
...
@@ -727,56 +716,22 @@ static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 act
static
TW_UINT16
get_width_height
(
double
*
width
,
double
*
height
,
BOOL
max
)
static
TW_UINT16
get_width_height
(
double
*
width
,
double
*
height
,
BOOL
max
)
{
{
TW_UINT16
rc
;
TW_UINT16
rc
;
SANE_Fixed
tlx_current
,
tlx_min
,
tlx_max
;
int
tlx
,
tly
,
brx
,
bry
;
SANE_Fixed
tly_current
,
tly_min
,
tly_max
;
SANE_Fixed
brx_current
,
brx_min
,
brx_max
;
SANE_Fixed
bry_current
,
bry_min
,
bry_max
;
rc
=
sane_option_probe_scan_area
(
"tl-x"
,
&
tlx_current
,
NULL
,
&
tlx_min
,
&
tlx_max
,
NULL
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
rc
=
sane_option_probe_scan_area
(
"tl-y"
,
&
tly_current
,
NULL
,
&
tly_min
,
&
tly_max
,
NULL
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
rc
=
sane_option_probe_scan_area
(
"br-x"
,
&
brx_current
,
NULL
,
&
brx_min
,
&
brx_max
,
NULL
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
rc
=
sane_option_probe_scan_area
(
"br-y"
,
&
bry_current
,
NULL
,
&
bry_min
,
&
bry_max
,
NULL
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
if
(
max
)
*
width
=
SANE_UNFIX
(
brx_max
)
-
SANE_UNFIX
(
tlx_min
);
else
*
width
=
SANE_UNFIX
(
brx_current
)
-
SANE_UNFIX
(
tlx_current
);
if
(
max
)
if
(
max
)
rc
=
sane_option_get_max_scan_area
(
&
tlx
,
&
tly
,
&
brx
,
&
bry
);
*
height
=
SANE_UNFIX
(
bry_max
)
-
SANE_UNFIX
(
tly_min
);
else
rc
=
sane_option_get_scan_area
(
&
tlx
,
&
tly
,
&
brx
,
&
bry
);
else
*
height
=
SANE_UNFIX
(
bry_current
)
-
SANE_UNFIX
(
tly_current
);
return
(
TWCC_SUCCESS
);
if
(
rc
==
TWCC_SUCCESS
)
}
{
*
width
=
(
brx
-
tlx
)
/
65536
.
0
;
static
TW_UINT16
set_one_coord
(
const
char
*
name
,
double
coord
)
*
height
=
(
bry
-
tly
)
/
65536
.
0
;
{
}
return
sane_option_set_fixed
(
name
,
coord
*
65536
,
NULL
)
;
return
rc
;
}
}
static
TW_UINT16
set_width_height
(
double
width
,
double
height
)
static
TW_UINT16
set_width_height
(
double
width
,
double
height
)
{
{
TW_UINT16
rc
=
TWCC_SUCCESS
;
return
sane_option_set_scan_area
(
0
,
0
,
width
*
65536
,
height
*
65536
,
NULL
);
rc
=
set_one_coord
(
"tl-x"
,
0
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
rc
=
set_one_coord
(
"br-x"
,
width
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
rc
=
set_one_coord
(
"tl-y"
,
0
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
rc
=
set_one_coord
(
"br-y"
,
height
);
return
rc
;
}
}
typedef
struct
typedef
struct
...
...
dlls/sane.ds/ds_image.c
View file @
d63aa5dc
...
@@ -113,35 +113,22 @@ TW_UINT16 SANE_ImageLayoutGet (pTW_IDENTITY pOrigin,
...
@@ -113,35 +113,22 @@ TW_UINT16 SANE_ImageLayoutGet (pTW_IDENTITY pOrigin,
TW_MEMREF
pData
)
TW_MEMREF
pData
)
{
{
TW_IMAGELAYOUT
*
img
=
(
TW_IMAGELAYOUT
*
)
pData
;
TW_IMAGELAYOUT
*
img
=
(
TW_IMAGELAYOUT
*
)
pData
;
SANE_Fixed
tlx_current
;
int
tlx
,
tly
,
brx
,
bry
;
SANE_Fixed
tly_current
;
SANE_Fixed
brx_current
;
SANE_Fixed
bry_current
;
TW_UINT16
rc
;
TW_UINT16
rc
;
TRACE
(
"DG_IMAGE/DAT_IMAGELAYOUT/MSG_GET
\n
"
);
TRACE
(
"DG_IMAGE/DAT_IMAGELAYOUT/MSG_GET
\n
"
);
rc
=
sane_option_probe_scan_area
(
"tl-x"
,
&
tlx_current
,
NULL
,
NULL
,
NULL
,
NULL
);
rc
=
sane_option_get_scan_area
(
&
tlx
,
&
tly
,
&
brx
,
&
bry
);
if
(
rc
==
TWCC_SUCCESS
)
rc
=
sane_option_probe_scan_area
(
"tl-y"
,
&
tly_current
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
TWCC_SUCCESS
)
rc
=
sane_option_probe_scan_area
(
"br-x"
,
&
brx_current
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
TWCC_SUCCESS
)
rc
=
sane_option_probe_scan_area
(
"br-y"
,
&
bry_current
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
!=
TWCC_SUCCESS
)
if
(
rc
!=
TWCC_SUCCESS
)
{
{
activeDS
.
twCC
=
rc
;
activeDS
.
twCC
=
rc
;
return
TWRC_FAILURE
;
return
TWRC_FAILURE
;
}
}
convert_sane_res_to_twain
(
SANE_UNFIX
(
tlx_current
),
SANE_UNIT_MM
,
&
img
->
Frame
.
Left
,
TWUN_INCHES
);
img
->
Frame
.
Left
=
convert_sane_res_to_twain
(
tlx
);
convert_sane_res_to_twain
(
SANE_UNFIX
(
tly_current
),
SANE_UNIT_MM
,
&
img
->
Frame
.
Top
,
TWUN_INCHES
);
img
->
Frame
.
Top
=
convert_sane_res_to_twain
(
tly
);
convert_sane_res_to_twain
(
SANE_UNFIX
(
brx_current
),
SANE_UNIT_MM
,
&
img
->
Frame
.
Right
,
TWUN_INCHES
);
img
->
Frame
.
Right
=
convert_sane_res_to_twain
(
brx
);
convert_sane_res_to_twain
(
SANE_UNFIX
(
bry_current
),
SANE_UNIT_MM
,
&
img
->
Frame
.
Bottom
,
TWUN_INCHES
);
img
->
Frame
.
Bottom
=
convert_sane_res_to_twain
(
bry
);
img
->
DocumentNumber
=
1
;
img
->
DocumentNumber
=
1
;
img
->
PageNumber
=
1
;
img
->
PageNumber
=
1
;
img
->
FrameNumber
=
1
;
img
->
FrameNumber
=
1
;
...
@@ -168,18 +155,6 @@ TW_UINT16 SANE_ImageLayoutReset (pTW_IDENTITY pOrigin,
...
@@ -168,18 +155,6 @@ TW_UINT16 SANE_ImageLayoutReset (pTW_IDENTITY pOrigin,
return
TWRC_FAILURE
;
return
TWRC_FAILURE
;
}
}
static
TW_UINT16
set_one_imagecoord
(
const
char
*
option_name
,
TW_FIX32
val
,
BOOL
*
changed
)
{
int
v
=
val
.
Whole
*
65536
+
val
.
Frac
;
TW_UINT16
rc
=
sane_option_set_fixed
(
option_name
,
MulDiv
(
v
,
254
,
10
),
changed
);
if
(
rc
!=
TWCC_SUCCESS
)
{
activeDS
.
twCC
=
rc
;
return
TWRC_FAILURE
;
}
return
TWRC_SUCCESS
;
}
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_SET */
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_SET */
TW_UINT16
SANE_ImageLayoutSet
(
pTW_IDENTITY
pOrigin
,
TW_UINT16
SANE_ImageLayoutSet
(
pTW_IDENTITY
pOrigin
,
TW_MEMREF
pData
)
TW_MEMREF
pData
)
...
@@ -187,6 +162,7 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
...
@@ -187,6 +162,7 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
TW_IMAGELAYOUT
*
img
=
(
TW_IMAGELAYOUT
*
)
pData
;
TW_IMAGELAYOUT
*
img
=
(
TW_IMAGELAYOUT
*
)
pData
;
BOOL
changed
=
FALSE
;
BOOL
changed
=
FALSE
;
TW_UINT16
twrc
;
TW_UINT16
twrc
;
int
tlx
,
tly
,
brx
,
bry
;
TRACE
(
"DG_IMAGE/DAT_IMAGELAYOUT/MSG_SET
\n
"
);
TRACE
(
"DG_IMAGE/DAT_IMAGELAYOUT/MSG_SET
\n
"
);
TRACE
(
"Frame: [Left %x.%x|Top %x.%x|Right %x.%x|Bottom %x.%x]
\n
"
,
TRACE
(
"Frame: [Left %x.%x|Top %x.%x|Right %x.%x|Bottom %x.%x]
\n
"
,
...
@@ -195,19 +171,12 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
...
@@ -195,19 +171,12 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
img
->
Frame
.
Right
.
Whole
,
img
->
Frame
.
Right
.
Frac
,
img
->
Frame
.
Right
.
Whole
,
img
->
Frame
.
Right
.
Frac
,
img
->
Frame
.
Bottom
.
Whole
,
img
->
Frame
.
Bottom
.
Frac
);
img
->
Frame
.
Bottom
.
Whole
,
img
->
Frame
.
Bottom
.
Frac
);
twrc
=
set_one_imagecoord
(
"tl-x"
,
img
->
Frame
.
Left
,
&
changed
);
tlx
=
img
->
Frame
.
Left
.
Whole
*
65536
+
img
->
Frame
.
Left
.
Frac
;
if
(
twrc
!=
TWRC_SUCCESS
)
tly
=
img
->
Frame
.
Top
.
Whole
*
65536
+
img
->
Frame
.
Top
.
Frac
;
return
(
twrc
);
brx
=
img
->
Frame
.
Right
.
Whole
*
65536
+
img
->
Frame
.
Right
.
Frac
;
bry
=
img
->
Frame
.
Bottom
.
Whole
*
65536
+
img
->
Frame
.
Bottom
.
Frac
;
twrc
=
set_one_imagecoord
(
"tl-y"
,
img
->
Frame
.
Top
,
&
changed
);
if
(
twrc
!=
TWRC_SUCCESS
)
return
(
twrc
);
twrc
=
set_one_imagecoord
(
"br-x"
,
img
->
Frame
.
Right
,
&
changed
);
if
(
twrc
!=
TWRC_SUCCESS
)
return
(
twrc
);
twrc
=
s
et_one_imagecoord
(
"br-y"
,
img
->
Frame
.
Bottom
,
&
changed
);
twrc
=
s
ane_option_set_scan_area
(
tlx
,
tly
,
brx
,
bry
,
&
changed
);
if
(
twrc
!=
TWRC_SUCCESS
)
if
(
twrc
!=
TWRC_SUCCESS
)
return
(
twrc
);
return
(
twrc
);
...
...
dlls/sane.ds/options.c
View file @
d63aa5dc
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include "sane_i.h"
#include "sane_i.h"
#include "wine/debug.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
twain
);
static
TW_UINT16
sane_status_to_twcc
(
SANE_Status
rc
)
static
TW_UINT16
sane_status_to_twcc
(
SANE_Status
rc
)
{
{
switch
(
rc
)
switch
(
rc
)
...
@@ -137,16 +139,6 @@ TW_UINT16 sane_option_set_bool(const char *option_name, int val )
...
@@ -137,16 +139,6 @@ TW_UINT16 sane_option_set_bool(const char *option_name, int val )
return
rc
;
return
rc
;
}
}
TW_UINT16
sane_option_set_fixed
(
const
char
*
option_name
,
int
val
,
BOOL
*
needs_reload
)
{
int
optno
;
const
SANE_Option_Descriptor
*
opt
;
TW_UINT16
rc
=
sane_find_option
(
option_name
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
);
if
(
rc
==
TWCC_SUCCESS
)
rc
=
sane_option_set_value
(
optno
,
&
val
,
needs_reload
);
return
rc
;
}
TW_UINT16
sane_option_get_str
(
const
char
*
option_name
,
char
*
val
,
int
len
)
TW_UINT16
sane_option_get_str
(
const
char
*
option_name
,
char
*
val
,
int
len
)
{
{
int
optno
;
int
optno
;
...
@@ -207,45 +199,64 @@ TW_UINT16 sane_option_probe_mode(const char * const **choices, char *current, in
...
@@ -207,45 +199,64 @@ TW_UINT16 sane_option_probe_mode(const char * const **choices, char *current, in
}
}
TW_UINT16
sane_option_probe_scan_area
(
const
char
*
option_name
,
SANE_Fixed
*
val
,
TW_UINT16
sane_option_get_scan_area
(
int
*
tlx
,
int
*
tly
,
int
*
brx
,
int
*
bry
)
SANE_Unit
*
unit
,
SANE_Fixed
*
min
,
SANE_Fixed
*
max
,
SANE_Fixed
*
quant
)
{
{
TW_UINT16
rc
;
int
optno
;
int
optno
;
const
SANE_Option_Descriptor
*
opt
;
const
SANE_Option_Descriptor
*
opt
;
TW_UINT16
rc
=
sane_find_option
(
option_name
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
);
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
if
(
unit
)
*
unit
=
opt
->
unit
;
if
(
min
)
*
min
=
opt
->
constraint
.
range
->
min
;
if
(
max
)
*
max
=
opt
->
constraint
.
range
->
max
;
if
(
quant
)
*
quant
=
opt
->
constraint
.
range
->
quant
;
if
(
val
)
rc
=
sane_option_get_value
(
optno
,
val
);
if
((
rc
=
sane_find_option
(
"tl-x"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_get_value
(
optno
,
tlx
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_find_option
(
"tl-y"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_get_value
(
optno
,
tly
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_find_option
(
"br-x"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_get_value
(
optno
,
brx
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_find_option
(
"br-y"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_get_value
(
optno
,
bry
))
!=
TWCC_SUCCESS
)
return
rc
;
if
(
opt
->
unit
!=
SANE_UNIT_MM
)
FIXME
(
"unsupported unit %u
\n
"
,
opt
->
unit
);
return
rc
;
return
rc
;
}
}
static
void
convert_double_fix32
(
double
d
,
TW_FIX32
*
fix32
)
TW_UINT16
sane_option_get_max_scan_area
(
int
*
tlx
,
int
*
tly
,
int
*
brx
,
int
*
bry
)
{
{
TW_INT32
value
=
(
TW_INT32
)
(
d
*
65536
.
0
+
0
.
5
);
TW_UINT16
rc
;
fix32
->
Whole
=
value
>>
16
;
int
optno
;
fix32
->
Frac
=
value
&
0x0000ffffL
;
const
SANE_Option_Descriptor
*
opt
;
if
((
rc
=
sane_find_option
(
"tl-x"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
*
tlx
=
opt
->
constraint
.
range
->
min
;
if
((
rc
=
sane_find_option
(
"tl-y"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
*
tly
=
opt
->
constraint
.
range
->
min
;
if
((
rc
=
sane_find_option
(
"br-x"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
*
brx
=
opt
->
constraint
.
range
->
max
;
if
((
rc
=
sane_find_option
(
"br-y"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
*
bry
=
opt
->
constraint
.
range
->
max
;
if
(
opt
->
unit
!=
SANE_UNIT_MM
)
FIXME
(
"unsupported unit %u
\n
"
,
opt
->
unit
);
return
rc
;
}
}
BOOL
convert_sane_res_to_twain
(
double
sane_res
,
SANE_Unit
unit
,
TW_FIX32
*
twain_res
,
TW_UINT16
twtype
)
TW_UINT16
sane_option_set_scan_area
(
int
tlx
,
int
tly
,
int
brx
,
int
bry
,
BOOL
*
reload
)
{
{
if
(
unit
!=
SANE_UNIT_MM
)
TW_UINT16
rc
;
return
FALSE
;
int
optno
;
const
SANE_Option_Descriptor
*
opt
;
if
(
twtype
!=
TWUN_INCHES
)
return
FALSE
;
convert_double_fix32
((
sane_res
/
10
.
0
)
/
2
.
54
,
twain_res
);
if
((
rc
=
sane_find_option
(
"tl-x"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_set_value
(
optno
,
&
tlx
,
reload
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_find_option
(
"tl-y"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_set_value
(
optno
,
&
tly
,
reload
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_find_option
(
"br-x"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_set_value
(
optno
,
&
brx
,
reload
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_find_option
(
"br-y"
,
&
opt
,
&
optno
,
SANE_TYPE_FIXED
))
!=
TWCC_SUCCESS
)
return
rc
;
if
((
rc
=
sane_option_set_value
(
optno
,
&
bry
,
reload
))
!=
TWCC_SUCCESS
)
return
rc
;
return
rc
;
}
return
TRUE
;
TW_FIX32
convert_sane_res_to_twain
(
int
res
)
{
TW_FIX32
value
;
res
=
MulDiv
(
res
,
10
,
254
);
/* mm -> inch */
value
.
Whole
=
res
/
65536
;
value
.
Frac
=
res
&
0xffff
;
return
value
;
}
}
dlls/sane.ds/sane_i.h
View file @
d63aa5dc
...
@@ -214,11 +214,11 @@ TW_UINT16 sane_option_get_str( const char *option_name, char *val, int len ) DEC
...
@@ -214,11 +214,11 @@ TW_UINT16 sane_option_get_str( const char *option_name, char *val, int len ) DEC
TW_UINT16
sane_option_set_str
(
const
char
*
option_name
,
char
*
val
,
BOOL
*
reload
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_set_str
(
const
char
*
option_name
,
char
*
val
,
BOOL
*
reload
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_probe_resolution
(
const
char
*
option_name
,
int
*
minval
,
int
*
maxval
,
int
*
quant
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_probe_resolution
(
const
char
*
option_name
,
int
*
minval
,
int
*
maxval
,
int
*
quant
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_probe_mode
(
const
char
*
const
**
choices
,
char
*
current
,
int
current_size
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_probe_mode
(
const
char
*
const
**
choices
,
char
*
current
,
int
current_size
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_probe_scan_area
(
const
char
*
option_name
,
SANE_Fixed
*
val
,
SANE_Unit
*
unit
,
SANE_Fixed
*
min
,
SANE_Fixed
*
max
,
SANE_Fixed
*
quant
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_get_bool
(
const
char
*
option_name
,
BOOL
*
val
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_get_bool
(
const
char
*
option_name
,
BOOL
*
val
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_set_bool
(
const
char
*
option_name
,
BOOL
val
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_set_bool
(
const
char
*
option_name
,
BOOL
val
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_set_fixed
(
const
char
*
option_name
,
int
val
,
BOOL
*
reload
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_get_scan_area
(
int
*
tlx
,
int
*
tly
,
int
*
brx
,
int
*
bry
)
DECLSPEC_HIDDEN
;
BOOL
convert_sane_res_to_twain
(
double
sane_res
,
SANE_Unit
unit
,
TW_FIX32
*
twain_res
,
TW_UINT16
twtype
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_get_max_scan_area
(
int
*
tlx
,
int
*
tly
,
int
*
brx
,
int
*
bry
)
DECLSPEC_HIDDEN
;
TW_UINT16
sane_option_set_scan_area
(
int
tlx
,
int
tly
,
int
brx
,
int
bry
,
BOOL
*
reload
)
DECLSPEC_HIDDEN
;
TW_FIX32
convert_sane_res_to_twain
(
int
res
)
DECLSPEC_HIDDEN
;
#endif
#endif
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