mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-10-12 01:45:18 +02:00
Stroke-Objekt wird in Formen zwischengespeichert
This commit is contained in:
@@ -16,6 +16,8 @@ public abstract class StrokedShape extends Constants implements Drawable {
|
|||||||
|
|
||||||
protected Options.StrokeType strokeType = SOLID;
|
protected Options.StrokeType strokeType = SOLID;
|
||||||
|
|
||||||
|
protected Stroke stroke = null;
|
||||||
|
|
||||||
public Color getStrokeColor() {
|
public Color getStrokeColor() {
|
||||||
return strokeColor;
|
return strokeColor;
|
||||||
}
|
}
|
||||||
@@ -54,6 +56,7 @@ public abstract class StrokedShape extends Constants implements Drawable {
|
|||||||
|
|
||||||
public void setStrokeWeight( double weight ) {
|
public void setStrokeWeight( double weight ) {
|
||||||
this.strokeWeight = weight;
|
this.strokeWeight = weight;
|
||||||
|
this.stroke = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Options.StrokeType getStrokeType() {
|
public Options.StrokeType getStrokeType() {
|
||||||
@@ -67,6 +70,7 @@ public abstract class StrokedShape extends Constants implements Drawable {
|
|||||||
*/
|
*/
|
||||||
public void setStrokeType( Options.StrokeType type ) {
|
public void setStrokeType( Options.StrokeType type ) {
|
||||||
this.strokeType = DASHED;
|
this.strokeType = DASHED;
|
||||||
|
this.stroke = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -77,26 +81,32 @@ public abstract class StrokedShape extends Constants implements Drawable {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected Stroke createStroke() {
|
protected Stroke createStroke() {
|
||||||
switch( strokeType ) {
|
if( stroke == null ) {
|
||||||
case DOTTED:
|
switch( strokeType ) {
|
||||||
return new BasicStroke(
|
case DOTTED:
|
||||||
(float) strokeWeight,
|
stroke = new BasicStroke(
|
||||||
BasicStroke.CAP_ROUND,
|
(float) strokeWeight,
|
||||||
BasicStroke.JOIN_ROUND,
|
BasicStroke.CAP_ROUND,
|
||||||
10.0f, new float[]{1.0f, 5.0f}, 0.0f);
|
BasicStroke.JOIN_ROUND,
|
||||||
case DASHED:
|
10.0f, new float[]{1.0f, 5.0f}, 0.0f);
|
||||||
return new BasicStroke(
|
break;
|
||||||
(float) strokeWeight,
|
case DASHED:
|
||||||
BasicStroke.CAP_ROUND,
|
stroke = new BasicStroke(
|
||||||
BasicStroke.JOIN_ROUND,
|
(float) strokeWeight,
|
||||||
10.0f, new float[]{5.0f}, 0.0f);
|
BasicStroke.CAP_ROUND,
|
||||||
case SOLID:
|
BasicStroke.JOIN_ROUND,
|
||||||
default:
|
10.0f, new float[]{5.0f}, 0.0f);
|
||||||
return new BasicStroke(
|
break;
|
||||||
(float) strokeWeight,
|
case SOLID:
|
||||||
BasicStroke.CAP_ROUND,
|
default:
|
||||||
BasicStroke.JOIN_ROUND);
|
stroke = new BasicStroke(
|
||||||
|
(float) strokeWeight,
|
||||||
|
BasicStroke.CAP_ROUND,
|
||||||
|
BasicStroke.JOIN_ROUND);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return stroke;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetStroke() {
|
public void resetStroke() {
|
||||||
|
|||||||
Reference in New Issue
Block a user