Changeset 145 for trunk/src/org/expeditee/items/Item.java
- Timestamp:
- 07/16/08 18:10:56 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Item.java
r143 r145 5 5 import java.awt.Cursor; 6 6 import java.awt.Dimension; 7 import java.awt.GradientPaint; 7 8 import java.awt.Graphics2D; 8 9 import java.awt.Point; … … 157 158 dest.setTag(source.getTag()); 158 159 dest.setFillColor(source.getFillColor()); 160 dest.setGradientColor(source.getGradientColor()); 159 161 dest.setFillPattern(source.getFillPattern()); 160 162 … … 254 256 // A fill color of null represents transparent 255 257 private Color _colorFill = null; 258 259 // A gradient color of null represents NO gradient 260 private Color _colorGradient = null; 256 261 257 262 // A fore color of null represents the default color … … 946 951 if (isFloating()) { 947 952 // TODO experiment with adding alpha when picking up filled 948 // items... 949 // Slows things down quite alot!! 953 // items... Slows things down quite alot!! 950 954 fillColor = new Color(fillColor.getRed(), fillColor.getGreen(), 951 955 fillColor.getBlue()); 952 956 } 953 957 g.setColor(fillColor); 954 // The painting is not efficient enough for gradients... 955 // Polygon s = getEnclosedShape(); 956 // Rectangle b = s.getBounds(); 957 // GradientPaint gp = new GradientPaint((int) (b.x + b.width * 0.3), 958 // b.y, getFillColor(), (int) (b.x + b.width * 1.3), b.y, 959 // Color.white); 960 // g.setPaint(gp); 961 // g.fillPolygon(s); 962 g.fillPolygon(getEnclosedShape()); 958 Color gradientColor = getGradientColor(); 959 if (gradientColor != null) { 960 // The painting is not efficient enough for gradients... 961 Polygon s = getEnclosedShape(); 962 Rectangle b = s.getBounds(); 963 GradientPaint gp = new GradientPaint( 964 (int) (b.x + b.width * 0.3), b.y, fillColor, 965 (int) (b.x + b.width * 1.3), b.y, gradientColor); 966 g.setPaint(gp); 967 g.fillPolygon(s); 968 } else { 969 g.fillPolygon(getEnclosedShape()); 970 } 963 971 } 964 972 } … … 1234 1242 invalidateCommonTrait(ItemAppearence.FillColor); 1235 1243 invalidateFill(); 1244 } 1245 1246 public void setGradientColor(Color c) { 1247 _colorGradient = c; 1248 1249 for (Line line : _lines) { 1250 Item other = line.getOppositeEnd(this); 1251 if (other.getGradientColor() != c) 1252 other.setGradientColor(c); 1253 } 1254 1255 invalidateCommonTrait(ItemAppearence.GradientColor); 1256 invalidateFill(); 1257 } 1258 1259 public Color getGradientColor() { 1260 return _colorGradient; 1236 1261 } 1237 1262 … … 2319 2344 // will ID still 2320 2345 // be -1 when saving a frame? 2321 // assert (i != null);2346 // assert (i != null); 2322 2347 return !isVisible() || getID() < 0 || offScreenTopOrLeft(); 2323 2348 }
Note:
See TracChangeset
for help on using the changeset viewer.