source: trunk/src/org/expeditee/core/GradientFill.java@ 1097

Last change on this file since 1097 was 1097, checked in by davidb, 6 years ago

Newly structured files from Corey's work on logic/graphics separation

File size: 2.5 KB
Line 
1package org.expeditee.core;
2
3/**
4 * Represents a fill where the colour is blended from one colour at one point
5 * to another colour at another point.
6 *
7 * @author cts16
8 */
9public class GradientFill extends Fill {
10
11 // Fill._colour is treated as the _fromColour (colour at the first point)
12 /** The colour at the second point. */
13 private Colour _toColour;
14 /** The point where the fill should be the first colour. */
15 private Point _fromPoint;
16 /** The point where the fill should be the second colour. */
17 private Point _toPoint;
18 /** Whether the gradient repeats at points not between the two specified points. */
19 private boolean _acyclic;
20
21 /** Standard constructor. */
22 public GradientFill(Colour fromColour, Point fromPoint, Colour toColour, Point toPoint, boolean acyclic)
23 {
24 // Make sure private members are never null
25 if (fromColour == null) fromColour = new Colour();
26 if (fromPoint == null) fromPoint = new Point();
27 if (toColour == null) toColour = new Colour();
28 if (toPoint == null) toPoint = new Point();
29
30 setFromColour(fromColour);
31 setFromPoint(fromPoint);
32 setToColour(toColour);
33 setToPoint(toPoint);
34 setAcyclic(acyclic);
35 }
36
37 /** If acyclic is unspecified, defaults to true. */
38 public GradientFill(Colour fromColour, Point fromPoint, Colour toColour, Point toPoint)
39 {
40 this(fromColour, fromPoint, toColour, toPoint, true);
41 }
42
43 /** Sets the colour to blend away from. */
44 public void setFromColour(Colour colour)
45 {
46 setColour(colour);
47 }
48
49 /** Gets the colour being blended away from. */
50 public Colour getFromColour()
51 {
52 return getColour();
53 }
54
55 /** Sets the point to blend away from. */
56 public void setFromPoint(Point point)
57 {
58 _fromPoint = point;
59 }
60
61 /** Gets the point being blended away from. */
62 public Point getFromPoint()
63 {
64 return _fromPoint;
65 }
66
67 /** Sets the colour to blend towards. */
68 public void setToColour(Colour colour)
69 {
70 _toColour = colour;
71 }
72
73 /** Gets the colour being blended toward. */
74 public Colour getToColour()
75 {
76 return _toColour;
77 }
78
79 /** Sets the point to blend towards. */
80 public void setToPoint(Point point)
81 {
82 _toPoint = point;
83 }
84
85 /** Gets the point being blended toward. */
86 public Point getToPoint()
87 {
88 return _toPoint;
89 }
90
91 /** Sets if this fill should continue blending outside the given two points. */
92 public void setAcyclic(boolean acyclic)
93 {
94 _acyclic = acyclic;
95 }
96
97 /** Gets whether this fill continues blending outside the given two points. */
98 public boolean isAcyclic()
99 {
100 return _acyclic;
101 }
102
103}
Note: See TracBrowser for help on using the repository browser.