try to clarify gradient docs

This commit is contained in:
Matthew Flatt 2012-08-12 09:38:31 -06:00
parent d38fa91792
commit 5116f51503
2 changed files with 19 additions and 12 deletions

View File

@ -8,10 +8,8 @@
@defclass/title[linear-gradient% object% ()]{
A @deftech{linear gradient} is used with a @racket[brush%] to fill
areas, such as the interior of a rectangle or ellipse, with smooth
color transitions.
Colors transitions are based on a line, where colors are assigned to
areas with smooth color transitions.
Color transitions are based on a line, where colors are assigned to
stop points along the line, and colors for in-between points are
interpolated from the stop-point colors. The color of a point on the
gradient's line is propagated to all points in the drawing context
@ -32,6 +30,13 @@ corresponds to (@racket[x0], @racket[y0]), @racket[1.0] corresponds to
(@racket[x1], @racket[y2]), and numbers in between correspond to
points in between.
Elements in @racket[stops] are implicitly sorted by point (i.e., by
the number between @racket[0.0] and @racket[1.0]). Order is preserved
for multiple elements for the same point, in which case the first
element for a given point is treated infinitesimally before the point,
and additional elements between the first and last for a stop point
are effectively ignored.
@examples[
#:eval class-eval
(define ellipse-brush

View File

@ -7,14 +7,13 @@
@defclass/title[radial-gradient% object% ()]{
A @deftech{radial gradient} is used with a @racket[brush%] to fill
areas, such as the interior of a rectangle or ellipse, with smooth
color transitions.
Colors transitions are based on two circles and the sequence of circles that
``morph'' from the starting circle to the ending circle. Colors are
assigned to stop circles in the sequence, and the colors of
the start and end circles radiate inward and outward to points that
are not on any intermediate circles.
areas with smooth color transitions.
Color transitions are based on two circles and the sequence of
circles that ``morph'' from the starting circle to the ending
circle. Normally, one of the two circles defining a gradient is
nested within the other; in that case, points within the inner circle
get the same color as the inner circle's edge, while points outside
the outer circle get the same color as the outer circle's edge.
@defconstructor[([x0 real?]
[y0 real?]
@ -32,6 +31,9 @@ circles, where @racket[0.0] corresponds to the starting circle,
@racket[1.0] corresponds to the ending circle, and numbers in between
correspond to circles in between.
The order of elements within @racket[stops] and duplicate points are
treated in the same way for as @racket[linear-gradient%].
@examples[
#:eval class-eval
(define ellipse-brush