Added providers
This commit is contained in:
83
src/com/flaremicro/visualforecast/icons/impl/SunIcon.java
Normal file
83
src/com/flaremicro/visualforecast/icons/impl/SunIcon.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package com.flaremicro.visualforecast.icons.impl;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Path2D;
|
||||
|
||||
import com.flaremicro.visualforecast.icons.Icon;
|
||||
|
||||
public class SunIcon extends Icon {
|
||||
Path2D.Float sunPath = new Path2D.Float();
|
||||
Ellipse2D.Float sunCircle1 = new Ellipse2D.Float(0.2F, 0.2F, 0.6F, 0.6F);
|
||||
Ellipse2D.Float sunInternalCircle1 = new Ellipse2D.Float(0.28F, 0.22F, 0.5F, 0.5F);
|
||||
Ellipse2D.Float sunInternalCircle2 = new Ellipse2D.Float(0.34F, 0.22F, 0.4F, 0.4F);
|
||||
Color[] animationColours = new Color[]{
|
||||
new Color(255, 100, 0),
|
||||
new Color(255, 120, 0),
|
||||
new Color(255, 140, 0),
|
||||
new Color(255, 160, 0),
|
||||
new Color(255, 180, 0),
|
||||
new Color(255, 200, 0),
|
||||
new Color(255, 220, 0),
|
||||
new Color(255, 200, 0),
|
||||
new Color(255, 180, 0),
|
||||
new Color(255, 160, 0),
|
||||
new Color(255, 140, 0),
|
||||
new Color(255, 120, 0),
|
||||
};
|
||||
public SunIcon(int id)
|
||||
{
|
||||
super(id);
|
||||
sunPath.moveTo(0.5F, 0.0F);
|
||||
sunPath.lineTo(0.605F, 0.106F);
|
||||
sunPath.lineTo(0.750F, 0.067F);
|
||||
sunPath.lineTo(0.789F, 0.211F);
|
||||
sunPath.lineTo(0.933F, 0.250F);
|
||||
sunPath.lineTo(0.894F, 0.394F);
|
||||
sunPath.lineTo(1.0F, 0.5F);
|
||||
sunPath.lineTo(0.894F, 0.606F);
|
||||
sunPath.lineTo(0.933F, 0.750F);
|
||||
sunPath.lineTo(0.789F, 0.789F);
|
||||
sunPath.lineTo(0.750F, 0.933F);
|
||||
sunPath.lineTo(0.605F, 0.894F);
|
||||
sunPath.lineTo(0.5F, 1.0F);
|
||||
sunPath.lineTo(0.394F, 0.894F);
|
||||
sunPath.lineTo(0.250F, 0.933F);
|
||||
sunPath.lineTo(0.211F, 0.789F);
|
||||
sunPath.lineTo(0.067F, 0.750F);
|
||||
sunPath.lineTo(0.106F, 0.606F);
|
||||
sunPath.lineTo(0.0F, 0.5F);
|
||||
sunPath.lineTo(0.106F, 0.394F);
|
||||
sunPath.lineTo(0.067F, 0.250F);
|
||||
sunPath.lineTo(0.211F, 0.211F);
|
||||
sunPath.lineTo(0.250F, 0.067F);
|
||||
sunPath.lineTo(0.394F, 0.106F);
|
||||
sunPath.closePath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, float scale, int animationStep) {
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.setStroke(new BasicStroke(4/scale));
|
||||
g2d.draw(sunPath);
|
||||
g2d.setColor(animationColours[animationStep % animationColours.length]);
|
||||
g2d.fill(sunPath);
|
||||
g2d.setColor(new Color(0xFFEE00));
|
||||
g2d.fill(sunCircle1);
|
||||
g2d.setColor(new Color(0xFFFF88));
|
||||
g2d.fill(sunInternalCircle1);
|
||||
g2d.setColor(new Color(0xFFFFDD));
|
||||
g2d.fill(sunInternalCircle2);
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.setStroke(new BasicStroke(2/scale));
|
||||
g2d.draw(sunCircle1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnimated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user