| •1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
package com.github.weisj.jsvg.paint; |
| 23 |
|
| 24 |
import java.awt.*; |
| 25 |
import java.awt.geom.Rectangle2D; |
| 26 |
|
| 27 |
import org.jetbrains.annotations.NotNull; |
| 28 |
import org.jetbrains.annotations.Nullable; |
| 29 |
|
| 30 |
import com.github.weisj.jsvg.animation.value.AnimatedColor; |
| 31 |
import com.github.weisj.jsvg.animation.value.AnimatedPaint; |
| 32 |
import com.github.weisj.jsvg.paint.impl.PredefinedPaints; |
| 33 |
import com.github.weisj.jsvg.renderer.RenderContext; |
| 34 |
import com.github.weisj.jsvg.renderer.output.Output; |
| 35 |
|
| 36 |
public interface SVGPaint { |
| 37 |
static @Nullable SVGPaint derive(@Nullable SVGPaint current, @Nullable SVGPaint other) { |
| 38 |
if (other == null) return current; |
| 39 |
if (current == null) return other; |
| 40 |
if (other instanceof AnimatedPaint) { |
| 41 |
return ((AnimatedPaint) other).derive(current); |
| 42 |
} |
| 43 |
if (other instanceof AnimatedColor) { |
| 44 |
return ((AnimatedColor) other).derive(current); |
| 45 |
} |
| 46 |
return other; |
| 47 |
} |
| 48 |
|
| 49 |
void fillShape(@NotNull Output output, @NotNull RenderContext context, @NotNull Shape shape, |
| 50 |
@Nullable Rectangle2D bounds); |
| 51 |
|
| 52 |
void drawShape(@NotNull Output output, @NotNull RenderContext context, @NotNull Shape shape, |
| 53 |
@Nullable Rectangle2D bounds); |
| 54 |
|
| 55 |
default boolean isVisible(@NotNull RenderContext context) { |
| 56 |
return this != PredefinedPaints.NONE; |
| 57 |
} |
| 58 |
} |