diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintCanvas.java b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintCanvas.java index 333bb02..8027d98 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintCanvas.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintCanvas.java @@ -28,7 +28,7 @@ //----------------------------------------------------------------- // 描画キャンバスの本体 -public class PaintCanvas extends View { +public class PaintCanvas extends View { private Path path; private Path clonepath; @@ -36,10 +36,10 @@ private Paint paint; private Paint clonepaint; private Paint latestpaint; - private ArrayList paints= new ArrayList<>(); - private ArrayList paths= new ArrayList<>(); - private ArrayList clonepaints= new ArrayList<>(); - private ArrayList clonepaths= new ArrayList<>(); + private ArrayList paints = new ArrayList<>(); + private ArrayList paths = new ArrayList<>(); + private ArrayList clonepaints = new ArrayList<>(); + private ArrayList clonepaths = new ArrayList<>(); private PaintViewModel paintViewModel; private ScheduledThreadPoolExecutor thread = new ScheduledThreadPoolExecutor(1); private Canvas curCanvas; @@ -56,7 +56,7 @@ public PaintCanvas(Context context, @Nullable AttributeSet attrs) { super(context, attrs); - pen = new Pen(255,0,0,0,20); + pen = new Pen(255, 0, 0, 0, 20); //pen =new Pen(Color.BLACK,20);//新しくPenクラスを作り色と幅の値を設定 path = new Path(); // 図形描画 paths.add(path); @@ -68,7 +68,7 @@ /// clonepaint = new Paint();//筆の種類 latestpaint = new Paint();//筆の種類 - paint.setColor(Color.argb(pen.getAlpha(),pen.getRed(),pen.getGreen(),pen.getBlue()));//色の指定 + paint.setColor(Color.argb(pen.getAlpha(), pen.getRed(), pen.getGreen(), pen.getBlue()));//色の指定 paint.setStyle(Paint.Style.STROKE);//線をひく paint.setStrokeWidth(pen.getThickness());//幅 clonepaint.setColor(Color.RED);//色の指定 @@ -90,7 +90,9 @@ return curCanvas; } - public Pen getPen(){return pen;} + public Pen getPen() { + return pen; + } //----------------------------------------------------------------- // setter @@ -105,21 +107,25 @@ protected void onDraw(Canvas canvas) { super.onDraw(curCanvas); canvas.drawColor(0xFFFFFFFF); - paint.setColor(Color.argb(pen.getAlpha(),pen.getRed(),pen.getGreen(),pen.getBlue())); + paint.setColor(Color.argb(pen.getAlpha(), pen.getRed(), pen.getGreen(), pen.getBlue())); paint.setStrokeWidth(pen.getThickness()); - for(int i=0; i< paths.toArray().length ; i++){ - if(paths.toArray().length