/** Creates a new instance of ShadowPathEffect */ public ShadowPathEffect() { super(); setBrushColor(Color.BLACK); setRenderInsideShape(false); setShouldFillShape(true); setOffset(new Point(3,3)); }
@Test public void testShadowPathEffect() { ShadowPathEffect effect = new ShadowPathEffect(); assertEquals(Color.BLACK, effect.getBrushColor()); assertEquals(10, effect.getBrushSteps()); assertEquals(8, effect.getEffectWidth()); assertEquals(new Point(3,3), effect.getOffset()); assertFalse(effect.isRenderInsideShape()); assertTrue(effect.isShouldFillShape()); } @Test
private void updateDropShadowFromGUI(AreaEffects effects) { ShadowPathEffect dropShadowEffect = null; if (dropShadowPanel.isSelected()) { dropShadowEffect = new ShadowPathEffect(dropShadowPanel.getOpacity()); dropShadowPanel.updateEffectColorAndBrush(dropShadowEffect); dropShadowEffect.setOffset(dropShadowPanel.getOffset()); } effects.setDropShadowEffect(dropShadowEffect); }
private void initDropShadowPanel(AreaEffects effects) { boolean enable = false; Color color = BLACK; int distance = 10; double angle = 0.7; int spread = 10; if (effects != null) { ShadowPathEffect effect = effects.getDropShadowEffect(); if (effect != null) { enable = true; color = effect.getBrushColor(); Point2D offset = effect.getOffset(); double x = offset.getX(); double y = offset.getY(); distance = (int) Math.sqrt(x * x + y * y); angle = Math.atan2(y, x); spread = effect.getEffectWidth(); } } if (dropShadowPanel == null) { // first initialization dropShadowPanel = new DropShadowPanel( enable, color, distance, angle, spread); } else { dropShadowPanel.setTabEnabled(enable); dropShadowPanel.setBrushWidth(spread); dropShadowPanel.setColor(color, false); dropShadowPanel.setAngle(angle); dropShadowPanel.setDistance(distance); } }
int effectWidth = 3 + (int) (dropShadowEffect.getEffectWidth() * safetyFactor); Point2D offset = dropShadowEffect.getOffset();
public static AreaEffects createRandom(Random rand) { AreaEffects ae = new AreaEffects(); float f = rand.nextFloat(); if(f < 0.25f) { ae.setNeonBorderEffect(new NeonBorderEffect()); } else if(f < 0.5f) { ae.setDropShadowEffect(new ShadowPathEffect(1.0f)); } else if(f < 0.75f) { ae.setInnerGlowEffect(new InnerGlowPathEffect(1.0f)); } else { ae.setGlowEffect(new GlowPathEffect(1.0f)); } return ae; }
private static ImageLayer addRasterizedTextLayer(Composition comp, String text, Color textColor, Font font, int translationY, BlendingMode blendingMode, float opacity, boolean dropShadow) { ImageLayer layer = addNewLayer(comp, text); TextFilter textFilter = TextFilter.getInstance(); AreaEffects effects = null; if (dropShadow) { effects = new AreaEffects(); effects.setDropShadowEffect(new ShadowPathEffect(1.0f)); } TextSettings settings = new TextSettings(text, font, textColor, effects, AbstractLayoutPainter.HorizontalAlignment.CENTER, AbstractLayoutPainter.VerticalAlignment.CENTER, false, 0); textFilter.setSettings(settings); textFilter.startOn(layer, FILTER_WITHOUT_DIALOG); layer.startMovement(); layer.moveWhileDragging(0, translationY); layer.endMovement(); layer.enlargeImage(layer.getComp().getCanvasImBounds()); layer.setOpacity(opacity, true, true, true); layer.setBlendingMode(blendingMode, true, true, true); return layer; }
/** Creates a new instance of ShadowPathEffect */ public ShadowPathEffect() { super(); setBrushColor(Color.BLACK); setRenderInsideShape(false); setShouldFillShape(true); setOffset(new Point(3,3)); }
/** * Creates a new instance of ShadowPathEffect */ public ShadowPathEffect(float opacity) { super(); setBrushColor(Color.BLACK); setRenderInsideShape(false); setShouldFillShape(true); setOffset(new Point(3, 3)); setOpacity(opacity); // opacity support added by lbalazscs }
/** Creates a new instance of ShadowPathEffect */ public ShadowPathEffect() { super(); setBrushColor(Color.BLACK); setRenderInsideShape(false); setShouldFillShape(true); setOffset(new Point(3,3)); }
/** Creates a new instance of ShadowPathEffect */ public ShadowPathEffect() { super(); setBrushColor(Color.BLACK); setRenderInsideShape(false); setShouldFillShape(true); setOffset(new Point(3,3)); }