Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
librsvg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
166
Issues
166
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
librsvg
Commits
27b32593
Commit
27b32593
authored
Feb 09, 2005
by
Caleb Michael Moore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gradient transformation fix
parent
e628fa9b
Changes
2
Hide whitespace changes
Inline
Sidebyside
Showing
2 changed files
with
35 additions
and
13 deletions
+35
13
ChangeLog
ChangeLog
+4
0
rsvgpaintserver.c
rsvgpaintserver.c
+31
13
No files found.
ChangeLog
View file @
27b32593
2005

2

9
Caleb
Moore
<
c
.
moore
@
student
.
unsw
.
edu
.
au
>
*
rsvg

paint

server
.
c
:
fixed
jimmac
's gradient problem
200529 Caleb Moore <c.moore@student.unsw.edu.au>
* rsvgstyles.c: fixed spelling mistake in visibility property causing bug 166673
...
...
rsvgpaintserver.c
View file @
27b32593
...
...
@@ 179,7 +179,6 @@ rsvg_paint_server_lin_grad_render (RsvgPaintServer *self, ArtRender *ar,
RsvgLinearGradient
*
rlg
=
z
>
gradient
;
ArtGradientLinear
*
agl
;
double
x1
,
y1
,
x2
,
y2
;
double
fx1
,
fy1
,
fx2
,
fy2
;
double
dx
,
dy
,
scale
;
double
affine
[
6
];
guint32
current_color
;
...
...
@@ 219,22 +218,39 @@ rsvg_paint_server_lin_grad_render (RsvgPaintServer *self, ArtRender *ar,
affine
[
i
]
=
ctx
>
affine
[
i
];
}
fx1
=
rlg
>
x1
*
rlg
>
affine
[
0
]
+
rlg
>
y1
*
rlg
>
affine
[
2
]
+
rlg
>
affine
[
4
];
fy1
=
rlg
>
x1
*
rlg
>
affine
[
1
]
+
rlg
>
y1
*
rlg
>
affine
[
3
]
+
rlg
>
affine
[
5
];
fx2
=
rlg
>
x2
*
rlg
>
affine
[
0
]
+
rlg
>
y2
*
rlg
>
affine
[
2
]
+
rlg
>
affine
[
4
];
fy2
=
rlg
>
x2
*
rlg
>
affine
[
1
]
+
rlg
>
y2
*
rlg
>
affine
[
3
]
+
rlg
>
affine
[
5
];
art_affine_multiply
(
affine
,
affine
,
rlg
>
affine
);
xchange
=
fx2

fx1
;
ychange
=
fy2

fy1
;
/*
in case I am hit by a bus, here is how the following code works:
nx2
=
fx1

ychange
;
ny2
=
fy1
+
xchange
;
in the spec, the various transformations are not applied to the coordinates
that determine the gradient, they are applied to the gradient itself, which
is logical. However after transformation, these things become different.
which is where this code comes in. The effective gradient is two things:
the slope of the lines of the same colour (perpendicular to the gradient
without transform), and the distance between the first and the last of
these strips. What this code figures out, is the slope of the lines of
equal colour, and the distance between them. It transforms them both and
finally spits out a new two point gradient which is basically the original
(x1, y1) point, and the second point which is the point on the line where
(x2, y2) lay that is closest to (x1, y1)
I'm not sure if this is the right solution to the problem, but it works
for now.
***Start explained section***/
/*calculate (nx2, ny2), the point perpendicular to the gradient*/
xchange
=
rlg
>
x2

rlg
>
x1
;
ychange
=
rlg
>
y2

rlg
>
y1
;
nx2
=
rlg
>
x1

ychange
;
ny2
=
rlg
>
y1
+
xchange
;
/* compute [xy][12] in pixel space */
x1
=
fx1
*
affine
[
0
]
+
f
y1
*
affine
[
2
]
+
affine
[
4
];
y1
=
fx1
*
affine
[
1
]
+
f
y1
*
affine
[
3
]
+
affine
[
5
];
x0
=
fx2
*
affine
[
0
]
+
f
y2
*
affine
[
2
]
+
affine
[
4
];
y0
=
fx2
*
affine
[
1
]
+
f
y2
*
affine
[
3
]
+
affine
[
5
];
x1
=
rlg
>
x1
*
affine
[
0
]
+
rlg
>
y1
*
affine
[
2
]
+
affine
[
4
];
y1
=
rlg
>
x1
*
affine
[
1
]
+
rlg
>
y1
*
affine
[
3
]
+
affine
[
5
];
x0
=
rlg
>
x2
*
affine
[
0
]
+
rlg
>
y2
*
affine
[
2
]
+
affine
[
4
];
y0
=
rlg
>
x2
*
affine
[
1
]
+
rlg
>
y2
*
affine
[
3
]
+
affine
[
5
];
x2
=
nx2
*
affine
[
0
]
+
ny2
*
affine
[
2
]
+
affine
[
4
];
y2
=
nx2
*
affine
[
1
]
+
ny2
*
affine
[
3
]
+
affine
[
5
];
...
...
@@ 252,6 +268,8 @@ rsvg_paint_server_lin_grad_render (RsvgPaintServer *self, ArtRender *ar,
y2
=
y1

xchange
/
unitlen
*
pointlen
;
}
/***end explained section***/
/* solve a, b, c so ax1 + by1 + c = 0 and ax2 + by2 + c = 1, maximum
gradient is in x1,y1 to x2,y2 dir */
dx
=
x2

x1
;
...
...
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