Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
0c17a0b5
Commit
0c17a0b5
authored
14 years ago
by
Esme Povirk
Committed by
Alexandre Julliard
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gdiplus: Add a software implementation of line gradient brushes.
parent
b7e664bc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/gdiplus/graphics.c
+70
-0
70 additions, 0 deletions
dlls/gdiplus/graphics.c
with
70 additions
and
0 deletions
dlls/gdiplus/graphics.c
+
70
−
0
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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment