Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
0794e5da
Commit
0794e5da
authored
Aug 07, 2007
by
Evan Stade
Committed by
Alexandre Julliard
Aug 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Return width and height of metafiles.
parent
8726f5ad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
26 deletions
+36
-26
gdiplus.c
dlls/gdiplus/gdiplus.c
+23
-0
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+1
-0
graphics.c
dlls/gdiplus/graphics.c
+0
-22
image.c
dlls/gdiplus/image.c
+12
-4
No files found.
dlls/gdiplus/gdiplus.c
View file @
0794e5da
...
...
@@ -263,3 +263,26 @@ GpStatus hresult_to_status(HRESULT res)
return
GenericError
;
}
}
/* converts a given unit to its value in pixels */
REAL
convert_unit
(
HDC
hdc
,
GpUnit
unit
)
{
switch
(
unit
)
{
case
UnitInch
:
return
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
case
UnitPoint
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
72
.
0
;
case
UnitDocument
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
300
.
0
;
case
UnitMillimeter
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
25
.
4
;
case
UnitWorld
:
ERR
(
"cannot convert UnitWorld
\n
"
);
return
0
.
0
;
case
UnitPixel
:
case
UnitDisplay
:
default:
return
1
.
0
;
}
}
dlls/gdiplus/gdiplus_private.h
View file @
0794e5da
...
...
@@ -42,6 +42,7 @@ extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
REAL
startAngle
,
REAL
sweepAngle
);
extern
REAL
gdiplus_atan2
(
REAL
dy
,
REAL
dx
);
extern
GpStatus
hresult_to_status
(
HRESULT
res
);
extern
REAL
convert_unit
(
HDC
hdc
,
GpUnit
unit
);
static
inline
INT
roundr
(
REAL
x
)
{
...
...
dlls/gdiplus/graphics.c
View file @
0794e5da
...
...
@@ -82,28 +82,6 @@ static BYTE convert_path_point_type(BYTE type)
return
ret
;
}
static
REAL
convert_unit
(
HDC
hdc
,
GpUnit
unit
)
{
switch
(
unit
)
{
case
UnitInch
:
return
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
case
UnitPoint
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
72
.
0
;
case
UnitDocument
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
300
.
0
;
case
UnitMillimeter
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
25
.
4
;
case
UnitWorld
:
ERR
(
"cannot convert UnitWorld
\n
"
);
return
0
.
0
;
case
UnitPixel
:
case
UnitDisplay
:
default:
return
1
.
0
;
}
}
static
INT
prepare_dc
(
GpGraphics
*
graphics
,
GpPen
*
pen
)
{
HPEN
gdipen
;
...
...
dlls/gdiplus/image.c
View file @
0794e5da
...
...
@@ -417,8 +417,12 @@ GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
return
InvalidParameter
;
if
(
image
->
type
==
ImageTypeMetafile
){
FIXME
(
"not implemented for metafiles
\n
"
);
return
NotImplemented
;
HDC
hdc
=
GetDC
(
0
);
*
height
=
roundr
(
convert_unit
(
hdc
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Height
);
ReleaseDC
(
0
,
hdc
);
}
else
if
(
image
->
type
==
ImageTypeBitmap
)
*
height
=
((
GpBitmap
*
)
image
)
->
height
;
...
...
@@ -499,8 +503,12 @@ GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
return
InvalidParameter
;
if
(
image
->
type
==
ImageTypeMetafile
){
FIXME
(
"not implemented for metafiles
\n
"
);
return
NotImplemented
;
HDC
hdc
=
GetDC
(
0
);
*
width
=
roundr
(
convert_unit
(
hdc
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Width
);
ReleaseDC
(
0
,
hdc
);
}
else
if
(
image
->
type
==
ImageTypeBitmap
)
*
width
=
((
GpBitmap
*
)
image
)
->
width
;
...
...
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