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
2fb0c7e6
Commit
2fb0c7e6
authored
Aug 03, 2008
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Move some Beziers helpers to gdiplus.c to use them for graphicspath.
parent
2583975e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
29 deletions
+32
-29
gdiplus.c
dlls/gdiplus/gdiplus.c
+26
-0
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+6
-0
graphics.c
dlls/gdiplus/graphics.c
+0
-29
No files found.
dlls/gdiplus/gdiplus.c
View file @
2fb0c7e6
...
...
@@ -285,3 +285,29 @@ REAL convert_unit(HDC hdc, GpUnit unit)
return
1
.
0
;
}
}
/* Calculates Bezier points from cardinal spline points. */
void
calc_curve_bezier
(
CONST
GpPointF
*
pts
,
REAL
tension
,
REAL
*
x1
,
REAL
*
y1
,
REAL
*
x2
,
REAL
*
y2
)
{
REAL
xdiff
,
ydiff
;
/* calculate tangent */
xdiff
=
pts
[
2
].
X
-
pts
[
0
].
X
;
ydiff
=
pts
[
2
].
Y
-
pts
[
0
].
Y
;
/* apply tangent to get control points */
*
x1
=
pts
[
1
].
X
-
tension
*
xdiff
;
*
y1
=
pts
[
1
].
Y
-
tension
*
ydiff
;
*
x2
=
pts
[
1
].
X
+
tension
*
xdiff
;
*
y2
=
pts
[
1
].
Y
+
tension
*
ydiff
;
}
/* Calculates Bezier points from cardinal spline endpoints. */
void
calc_curve_bezier_endp
(
REAL
xend
,
REAL
yend
,
REAL
xadj
,
REAL
yadj
,
REAL
tension
,
REAL
*
x
,
REAL
*
y
)
{
/* tangent at endpoints is the line from the endpoint to the adjacent point */
*
x
=
roundr
(
tension
*
(
xadj
-
xend
)
+
xend
);
*
y
=
roundr
(
tension
*
(
yadj
-
yend
)
+
yend
);
}
dlls/gdiplus/gdiplus_private.h
View file @
2fb0c7e6
...
...
@@ -38,6 +38,7 @@
#define INCH_HIMETRIC (2540)
#define VERSION_MAGIC 0xdbc01001
#define TENSION_CONST (0.3)
COLORREF
ARGB2COLORREF
(
ARGB
color
);
extern
INT
arc2polybezier
(
GpPointF
*
points
,
REAL
x1
,
REAL
y1
,
REAL
x2
,
REAL
y2
,
...
...
@@ -46,6 +47,11 @@ extern REAL gdiplus_atan2(REAL dy, REAL dx);
extern
GpStatus
hresult_to_status
(
HRESULT
res
);
extern
REAL
convert_unit
(
HDC
hdc
,
GpUnit
unit
);
extern
void
calc_curve_bezier
(
CONST
GpPointF
*
pts
,
REAL
tension
,
REAL
*
x1
,
REAL
*
y1
,
REAL
*
x2
,
REAL
*
y2
);
extern
void
calc_curve_bezier_endp
(
REAL
xend
,
REAL
yend
,
REAL
xadj
,
REAL
yadj
,
REAL
tension
,
REAL
*
x
,
REAL
*
y
);
static
inline
INT
roundr
(
REAL
x
)
{
return
(
INT
)
floorf
(
x
+
0
.
5
);
...
...
dlls/gdiplus/graphics.c
View file @
2fb0c7e6
...
...
@@ -42,7 +42,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
gdiplus
);
/* looks-right constants */
#define TENSION_CONST (0.3)
#define ANCHOR_WIDTH (2.0)
#define MAX_ITERS (50)
...
...
@@ -194,34 +193,6 @@ static void draw_pie(GpGraphics *graphics, REAL x, REAL y, REAL width,
pti
[
2
].
y
,
pti
[
3
].
x
,
pti
[
3
].
y
);
}
/* GdipDrawCurve helper function.
* Calculates Bezier points from cardinal spline points. */
static
void
calc_curve_bezier
(
CONST
GpPointF
*
pts
,
REAL
tension
,
REAL
*
x1
,
REAL
*
y1
,
REAL
*
x2
,
REAL
*
y2
)
{
REAL
xdiff
,
ydiff
;
/* calculate tangent */
xdiff
=
pts
[
2
].
X
-
pts
[
0
].
X
;
ydiff
=
pts
[
2
].
Y
-
pts
[
0
].
Y
;
/* apply tangent to get control points */
*
x1
=
pts
[
1
].
X
-
tension
*
xdiff
;
*
y1
=
pts
[
1
].
Y
-
tension
*
ydiff
;
*
x2
=
pts
[
1
].
X
+
tension
*
xdiff
;
*
y2
=
pts
[
1
].
Y
+
tension
*
ydiff
;
}
/* GdipDrawCurve helper function.
* Calculates Bezier points from cardinal spline endpoints. */
static
void
calc_curve_bezier_endp
(
REAL
xend
,
REAL
yend
,
REAL
xadj
,
REAL
yadj
,
REAL
tension
,
REAL
*
x
,
REAL
*
y
)
{
/* tangent at endpoints is the line from the endpoint to the adjacent point */
*
x
=
roundr
(
tension
*
(
xadj
-
xend
)
+
xend
);
*
y
=
roundr
(
tension
*
(
yadj
-
yend
)
+
yend
);
}
/* Draws the linecap the specified color and size on the hdc. The linecap is in
* direction of the line from x1, y1 to x2, y2 and is anchored on x2, y2. Probably
* should not be called on an hdc that has a path you care about. */
...
...
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