use of limelight.ui.model.Scene in project limelight by slagyr.
the class BackgroundPainter method paint.
public void paint(Graphics2D graphics, PaintablePanel panel) {
Style style = panel.getStyle();
Border border = panel.getBorderShaper();
Shape insideBorder = border.getShapeInsideBorder();
Color backgroundColor = style.getCompiledBackgroundColor().getColor();
if (style.getCompiledGradient().isOn())
GradientPainter.instance.paint(graphics, panel);
else {
if (backgroundColor.getAlpha() > 0) {
graphics.setColor(backgroundColor);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.fill(insideBorder);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
NoneableValue<StringValue> backgroundImageAttribute = style.getCompiledBackgroundImage();
if (!backgroundImageAttribute.isNone()) {
try {
Box borderFrame = panel.getBorderedBounds();
Scene rootPanel = panel.getRoot();
// TODO MDM - getting a NullPointer here. The Panel was removed from the scene in between the start of the paint cycle and here.
if (rootPanel == null)
return;
ImageCache cache = rootPanel.getImageCache();
Image image = cache.getImage(backgroundImageAttribute.getAttribute().getValue());
Graphics2D borderedGraphics = (Graphics2D) graphics.create(borderFrame.x, borderFrame.y, borderFrame.width, borderFrame.height);
style.getCompiledBackgroundImageFillStrategy().fill(borderedGraphics, image, style.getCompiledBackgroundImageX(), style.getCompiledBackgroundImageY());
} catch (IOException e) {
e.printStackTrace();
}
}
}
use of limelight.ui.model.Scene in project limelight by slagyr.
the class JavaProductionTest method loadRealStylesForScene.
@Test
public void loadRealStylesForScene() throws Exception {
fs.createTextFile("/testProduction/aScene/styles.xml", "<styles><high x='0' y='99' float='on'/><far x='99' y='0' float='off'/></styles>");
final Scene scene = production.loadScene("aScene", Opts.with("name", "aScene", "path", "aScene"));
final Map<String, RichStyle> styles = production.loadStyles(scene, new HashMap<String, RichStyle>());
assertEquals(2, styles.size());
final RichStyle high = styles.get("high");
assertEquals("0", high.getX());
assertEquals("99", high.getY());
assertEquals("on", high.getFloat());
final RichStyle far = styles.get("far");
assertEquals("99", far.getX());
assertEquals("0", far.getY());
assertEquals("off", far.getFloat());
}
use of limelight.ui.model.Scene in project limelight by slagyr.
the class JavaProductionTest method loadsScene.
@Test
public void loadsScene() throws Exception {
final Scene result = production.loadScene("aScene", Opts.with("name", "aScene"));
assertEquals(ScenePanel.class, result.getClass());
ScenePanel scene = (ScenePanel) result;
assertEquals(JavaScene.class, scene.getProxy().getClass());
scene.illuminate();
assertEquals("aScene", scene.getName());
}
use of limelight.ui.model.Scene in project limelight by slagyr.
the class ProductionTest method openSceneLoadsStylesExtendingProductionStyles.
@Test
public void openSceneLoadsStylesExtendingProductionStyles() throws Exception {
production.loadProduction();
production.getTheater().add(new MockStage("mock"));
production.getStyles().put("newStyle", new RichStyle());
Scene scene = new FakeScene();
production.stubbedScene = scene;
production.openScene("scenePath", "mock", Util.toMap());
assertEquals(HashMap.class, scene.getStyles().getClass());
assertEquals(true, scene.getStyles().containsKey("limelight_builtin_curtains"));
assertEquals(true, scene.getStyles().containsKey("newStyle"));
}
use of limelight.ui.model.Scene in project limelight by slagyr.
the class ProductionTest method openSceneWithNoActiveStage.
@Test
public void openSceneWithNoActiveStage() throws Exception {
production.loadProduction();
final MockStage stage = (MockStage) production.getTheater().getDefaultStage();
Scene scene = new FakeScene();
production.stubbedScene = scene;
production.openScene("scenePath", Util.toMap());
assertEquals("scenePath", production.loadedScenePath);
assertEquals(scene, stage.getScene());
assertEquals(true, stage.opened);
}
Aggregations