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
0c17a0b5
Commit
0c17a0b5
authored
Jan 21, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Jan 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add a software implementation of line gradient brushes.
parent
b7e664bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
graphics.c
dlls/gdiplus/graphics.c
+70
-0
No files found.
dlls/gdiplus/graphics.c
View file @
0c17a0b5
...
...
@@ -256,6 +256,15 @@ static ARGB blend_colors(ARGB start, ARGB end, REAL position)
{
ARGB
result
=
0
;
ARGB
i
;
INT
a1
,
a2
,
a3
;
a1
=
(
start
>>
24
)
&
0xff
;
a2
=
(
end
>>
24
)
&
0xff
;
a3
=
(
int
)(
a1
*
(
1
.
0
f
-
position
)
+
a2
*
(
position
));
result
|=
a3
<<
24
;
for
(
i
=
0xff
;
i
<=
0xff0000
;
i
=
i
<<
8
)
result
|=
(
int
)((
start
&
i
)
*
(
1
.
0
f
-
position
)
+
(
end
&
i
)
*
(
position
))
&
i
;
return
result
;
...
...
@@ -493,6 +502,7 @@ static INT brush_can_fill_pixels(GpBrush *brush)
{
case
BrushTypeSolidColor
:
case
BrushTypeHatchFill
:
case
BrushTypeLinearGradient
:
return
1
;
default:
return
0
;
...
...
@@ -539,6 +549,66 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
return
Ok
;
}
case
BrushTypeLinearGradient
:
{
GpLineGradient
*
fill
=
(
GpLineGradient
*
)
brush
;
GpPointF
draw_points
[
3
],
line_points
[
3
];
GpStatus
stat
;
static
const
GpRectF
box_1
=
{
0
.
0
,
0
.
0
,
1
.
0
,
1
.
0
};
GpMatrix
*
world_to_gradient
;
/* FIXME: Store this in the brush? */
int
x
,
y
;
draw_points
[
0
].
X
=
fill_area
->
X
;
draw_points
[
0
].
Y
=
fill_area
->
Y
;
draw_points
[
1
].
X
=
fill_area
->
X
+
1
;
draw_points
[
1
].
Y
=
fill_area
->
Y
;
draw_points
[
2
].
X
=
fill_area
->
X
;
draw_points
[
2
].
Y
=
fill_area
->
Y
+
1
;
/* Transform the points to a co-ordinate space where X is the point's
* position in the gradient, 0.0 being the start point and 1.0 the
* end point. */
stat
=
GdipTransformPoints
(
graphics
,
CoordinateSpaceWorld
,
CoordinateSpaceDevice
,
draw_points
,
3
);
if
(
stat
==
Ok
)
{
line_points
[
0
]
=
fill
->
startpoint
;
line_points
[
1
]
=
fill
->
endpoint
;
line_points
[
2
].
X
=
fill
->
startpoint
.
X
+
(
fill
->
startpoint
.
Y
-
fill
->
endpoint
.
Y
);
line_points
[
2
].
Y
=
fill
->
startpoint
.
Y
+
(
fill
->
endpoint
.
X
-
fill
->
startpoint
.
X
);
stat
=
GdipCreateMatrix3
(
&
box_1
,
line_points
,
&
world_to_gradient
);
}
if
(
stat
==
Ok
)
{
stat
=
GdipInvertMatrix
(
world_to_gradient
);
if
(
stat
==
Ok
)
stat
=
GdipTransformMatrixPoints
(
world_to_gradient
,
draw_points
,
3
);
GdipDeleteMatrix
(
world_to_gradient
);
}
if
(
stat
==
Ok
)
{
REAL
x_delta
=
draw_points
[
1
].
X
-
draw_points
[
0
].
X
;
REAL
y_delta
=
draw_points
[
2
].
X
-
draw_points
[
0
].
X
;
for
(
y
=
0
;
y
<
fill_area
->
Height
;
y
++
)
{
for
(
x
=
0
;
x
<
fill_area
->
Width
;
x
++
)
{
REAL
pos
=
draw_points
[
0
].
X
+
x
*
x_delta
+
y
*
y_delta
;
argb_pixels
[
x
+
y
*
cdwStride
]
=
blend_line_gradient
(
fill
,
pos
);
}
}
}
return
stat
;
}
default:
return
NotImplemented
;
}
...
...
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