Changeset 1102 for trunk/src/org/apollo/items/FramePlaybackLauncher.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/items/FramePlaybackLauncher.java
r489 r1102 1 1 package org.apollo.items; 2 3 import java.awt.Color;4 import java.awt.GradientPaint;5 import java.awt.Graphics2D;6 import java.awt.Paint;7 import java.awt.Polygon;8 import java.awt.Stroke;9 2 10 3 import org.apollo.ApolloSystem; … … 24 17 import org.apollo.util.ODFrameHeirarchyFetcher.ODFrameReceiver; 25 18 import org.apollo.widgets.FramePlayer; 19 import org.expeditee.core.Colour; 20 import org.expeditee.core.Dimension; 21 import org.expeditee.core.Fill; 22 import org.expeditee.core.GradientFill; 23 import org.expeditee.core.Point; 24 import org.expeditee.core.Stroke; 25 import org.expeditee.core.bounds.AxisAlignedBoxBounds; 26 import org.expeditee.core.bounds.Bounds; 27 import org.expeditee.gio.EcosystemManager; 28 import org.expeditee.gio.GraphicsManager; 26 29 import org.expeditee.gui.Browser; 27 import org.expeditee.gui.Display IO;30 import org.expeditee.gui.DisplayController; 28 31 import org.expeditee.gui.Frame; 29 32 import org.expeditee.gui.FrameIO; … … 43 46 private static int WIDTH = 80; 44 47 private static int HEIGHT = 80; 45 private static Stroke BORDER_ST OKE = Strokes.SOLID_1;46 47 private static final Colo r BASE_COLOR = new Color(60, 148, 255);48 private static final Colo r HIGHLIGHT_COLOR = new Color(253, 255, 201);48 private static Stroke BORDER_STROKE = Strokes.SOLID_1; 49 50 private static final Colour BASE_COLOR = Colour.FromRGB255(60, 148, 255); 51 private static final Colour HIGHLIGHT_COLOR = Colour.FromRGB255(253, 255, 201); 49 52 50 53 private String frameToPlay = null; … … 74 77 75 78 @Override 76 public void paint(Graphics2D g) { 79 public void paint() 80 { 77 81 if (Browser._theBrowser == null) return; 78 82 79 Paint restore = g.getPaint(); 80 83 GraphicsManager g = EcosystemManager.getGraphicsManager(); 84 85 Fill fill = null; 81 86 if (ApolloSystem.useQualityGraphics) { 82 GradientPaint gp = new GradientPaint( 83 _x + (WIDTH / 2), _y, HIGHLIGHT_COLOR, 84 _x + (WIDTH / 2), _y + HEIGHT - (HEIGHT / 5), BASE_COLOR); 85 g.setPaint(gp); 87 Point fromPoint = new Point(_x + (WIDTH / 2), _y); 88 Point toPoint = new Point(_x + (WIDTH / 2), _y + HEIGHT - (HEIGHT / 5)); 89 fill = new GradientFill(HIGHLIGHT_COLOR, fromPoint, BASE_COLOR, toPoint); 86 90 } else { 87 g.setColor(BASE_COLOR); 88 } 89 90 g.fillRect((int)_x, (int)_y, WIDTH, HEIGHT); 91 92 g.setPaint(restore); 93 94 g.setColor(Color.BLACK); 95 g.setStroke(BORDER_STOKE); 96 g.drawRect((int)_x, (int)_y, WIDTH, HEIGHT); 97 98 IconRepository.getIcon("frameplay.png").paintIcon( 99 Browser._theBrowser.getContentPane(), g, getX() + 25, getY() + 25); 91 fill = new Fill(BASE_COLOR); 92 } 93 94 Point topLeft = new Point((int)_x, (int)_y); 95 Dimension size = new Dimension(WIDTH, HEIGHT); 96 g.drawRectangle(topLeft, size, 0.0, fill, Colour.BLACK, BORDER_STROKE, null); 97 98 /*IconRepository.getIcon("frameplay.png").paintIcon( 99 Browser._theBrowser.getContentPane(), g, getX() + 25, getY() + 25);*/ 100 101 g.drawImage(IconRepository.getIcon("frameplay.png"), new Point(getX() + 25, getY() + 25)); 100 102 101 103 } … … 117 119 118 120 @Override 119 public void updatePolygon() { 120 121 _poly = new Polygon(); 122 123 int x = (int)_x; 124 int y = (int)_y; 125 126 _poly.addPoint(x, y); 127 _poly.addPoint(x + WIDTH, y); 128 _poly.addPoint(x + WIDTH, y + HEIGHT); 129 _poly.addPoint(x, y + HEIGHT); 130 121 public Bounds updateBounds() 122 { 123 return new AxisAlignedBoxBounds((int) _x, (int) _y, WIDTH, HEIGHT); 131 124 } 132 125 … … 148 141 } 149 142 150 private void selfDestruct() {151 143 private void selfDestruct() 144 { 152 145 Frame parent = getParent(); 153 146 parent.removeItem(this); 154 147 155 if (Display IO.getCurrentFrame() == null) return;148 if (DisplayController.getCurrentFrame() == null) return; 156 149 157 150 Frame audioFrame = null; 158 151 159 152 // Flag as null if frame to play is actually current frame 160 if (frameToPlay != null && frameToPlay.equals(Display IO.getCurrentFrame().getName()))153 if (frameToPlay != null && frameToPlay.equals(DisplayController.getCurrentFrame().getName())) 161 154 frameToPlay = null; 162 155 163 156 if (frameToPlay == null) { 164 audioFrame = Display IO.getCurrentFrame();157 audioFrame = DisplayController.getCurrentFrame(); 165 158 } else { 166 159 audioFrame = FrameIO.LoadFrame(frameToPlay); … … 199 192 } else { 200 193 // Fetch the audio graph for the frame 201 GraphReceiver receiver = new GraphReceiver(Display IO.getCurrentFrame());194 GraphReceiver receiver = new GraphReceiver(DisplayController.getCurrentFrame()); 202 195 ODFrameHeirarchyFetcher.getInstance().doFetch(audioFrame.getName(), receiver); 203 196 // The callback will later begin playback … … 257 250 // Thus the start frame will be hence taken as a percentage of the whole frame 258 251 259 float percent = _x / Browser._theBrowser.getContentPane().getWidth();252 float percent = _x / EcosystemManager.getGraphicsManager().getWindowSize().getWidth(); 260 253 if (percent < 0) percent = 0; 261 254 if (percent > 1) percent = 1;
Note:
See TracChangeset
for help on using the changeset viewer.