Bugfix beim setzen des StrokeType

This commit is contained in:
ngb
2022-07-14 19:27:36 +02:00
parent b244a6e094
commit 763d9eff22
2 changed files with 12 additions and 4 deletions

View File

@@ -168,8 +168,7 @@ public abstract class Shape extends FilledShape {
* <p> * <p>
* Unterklassen sollten diese Methode überschreiben, um weitere * Unterklassen sollten diese Methode überschreiben, um weitere
* Eigenschaften zu kopieren (zum Beispiel den Radius eines Kreises). Mit * Eigenschaften zu kopieren (zum Beispiel den Radius eines Kreises). Mit
* dem Aufruf * dem Aufruf {@code super.copyFrom(shape)} sollten die Basiseigenschaften
* {@code super.copyFrom(shape)} sollten die Basiseigenschaften
* kopiert werden. * kopiert werden.
* *
* @param shape * @param shape

View File

@@ -4,8 +4,14 @@ import schule.ngb.zm.Color;
import schule.ngb.zm.Constants; import schule.ngb.zm.Constants;
import schule.ngb.zm.Drawable; import schule.ngb.zm.Drawable;
import schule.ngb.zm.Options; import schule.ngb.zm.Options;
import schule.ngb.zm.util.Noise;
import java.awt.*; import java.awt.*;
import java.awt.Shape;
import java.awt.geom.FlatteningPathIterator;
import java.awt.geom.GeneralPath;
import java.awt.geom.PathIterator;
import java.util.Arrays;
public abstract class StrokedShape extends Constants implements Drawable { public abstract class StrokedShape extends Constants implements Drawable {
@@ -26,7 +32,7 @@ public abstract class StrokedShape extends Constants implements Drawable {
this.strokeColor = color; this.strokeColor = color;
} }
public void setStrokeColor( Color color , int alpha ) { public void setStrokeColor( Color color, int alpha ) {
setStrokeColor(new Color(color, alpha)); setStrokeColor(new Color(color, alpha));
} }
@@ -66,10 +72,11 @@ public abstract class StrokedShape extends Constants implements Drawable {
/** /**
* Setzt den Typ der Kontur. Erlaubte Werte sind {@link #DASHED}, * Setzt den Typ der Kontur. Erlaubte Werte sind {@link #DASHED},
* {@link #DOTTED} und {@link #SOLID}. * {@link #DOTTED} und {@link #SOLID}.
*
* @param type * @param type
*/ */
public void setStrokeType( Options.StrokeType type ) { public void setStrokeType( Options.StrokeType type ) {
this.strokeType = DASHED; this.strokeType = type;
this.stroke = null; this.stroke = null;
} }
@@ -78,9 +85,11 @@ public abstract class StrokedShape extends Constants implements Drawable {
/** /**
* Erstellt ein {@link Stroke} Objekt für den Konturtyp. * Erstellt ein {@link Stroke} Objekt für den Konturtyp.
*
* @return * @return
*/ */
protected Stroke createStroke() { protected Stroke createStroke() {
// TODO: Used global cached Stroke Objects?
if( stroke == null ) { if( stroke == null ) {
switch( strokeType ) { switch( strokeType ) {
case DOTTED: case DOTTED: