|
|
|
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
namespace Unity.UIWidgets.ui { |
|
|
|
public class uiRecorderCanvas : PoolItem, Canvas { |
|
|
|
public class uiRecorderCanvas : PoolItem { |
|
|
|
public uiRecorderCanvas(uiPictureRecorder recorder) { |
|
|
|
this._recorder = recorder; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public void save() { |
|
|
|
this._saveCount++; |
|
|
|
this._recorder.addDrawCmd(new uiDrawSave { |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawSave.create()); |
|
|
|
this._recorder.addDrawCmd(new uiDrawSaveLayer { |
|
|
|
rect = rect, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawSaveLayer.create( |
|
|
|
rect : uiRectHelper.fromRect(rect), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawRestore { |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawRestore.create()); |
|
|
|
} |
|
|
|
|
|
|
|
public int getSaveCount() { |
|
|
|
|
|
|
public void translate(float dx, float dy) { |
|
|
|
this._recorder.addDrawCmd(new uiDrawTranslate { |
|
|
|
dx = dx, |
|
|
|
dy = dy, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawTranslate.create( |
|
|
|
dx : dx, |
|
|
|
dy : dy |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawScale { |
|
|
|
sx = sx, |
|
|
|
sy = sy, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawScale.create( |
|
|
|
sx : sx, |
|
|
|
sy : sy |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawRotate { |
|
|
|
radians = radians, |
|
|
|
offset = offset, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawRotate.create( |
|
|
|
radians : radians, |
|
|
|
offset : uiOffset.fromOffset(offset) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawSkew { |
|
|
|
sx = sx, |
|
|
|
sy = sy, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawSkew.create( |
|
|
|
sx : sx, |
|
|
|
sy : sy |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawConcat { |
|
|
|
matrix = matrix, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawConcat.create( |
|
|
|
matrix : uiMatrix3.fromMatrix3(matrix) |
|
|
|
)); |
|
|
|
public Matrix3 getTotalMatrix() { |
|
|
|
public uiMatrix3 getTotalMatrix() { |
|
|
|
this._recorder.addDrawCmd(new uiDrawResetMatrix { |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawResetMatrix.create( |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawSetMatrix { |
|
|
|
matrix = matrix, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawSetMatrix.create( |
|
|
|
matrix : uiMatrix3.fromMatrix3(matrix) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual float getDevicePixelRatio() { |
|
|
|
|
|
|
public void clipRect(Rect rect) { |
|
|
|
this._recorder.addDrawCmd(new uiDrawClipRect { |
|
|
|
rect = rect, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawClipRect.create( |
|
|
|
rect : uiRectHelper.fromRect(rect) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawClipRRect { |
|
|
|
rrect = rrect, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawClipRRect.create( |
|
|
|
rrect : rrect |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawClipPath { |
|
|
|
path = path, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawClipPath.create( |
|
|
|
path : uiPath.fromPath(path) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public void drawLine(Offset from, Offset to, Paint paint) { |
|
|
|
|
|
|
|
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public void drawShadow(Path path, Color color, float elevation, bool transparentOccluder) { |
|
|
|
|
|
|
var path = new Path(); |
|
|
|
path.addRect(rect); |
|
|
|
|
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public void drawDRRect(RRect outer, RRect inner, Paint paint) { |
|
|
|
|
|
|
path.winding(PathWinding.clockwise); |
|
|
|
|
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public void drawOval(Rect rect, Paint paint) { |
|
|
|
|
|
|
path.addEllipse(rect.left + w, rect.top + h, w, h); |
|
|
|
|
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public void drawCircle(Offset c, float radius, Paint paint) { |
|
|
|
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public void drawArc(Rect rect, float startAngle, float sweepAngle, bool useCenter, Paint paint) { |
|
|
|
|
|
|
path.close(); |
|
|
|
} |
|
|
|
|
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawPath { |
|
|
|
path = path, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPath.create( |
|
|
|
path : uiPath.fromPath(path), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawImage { |
|
|
|
image = image, |
|
|
|
offset = offset, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawImage.create( |
|
|
|
image : image, |
|
|
|
offset : uiOffset.fromOffset(offset), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawImageRect { |
|
|
|
image = image, |
|
|
|
dst = dst, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawImageRect.create( |
|
|
|
image : image, |
|
|
|
src : null, |
|
|
|
dst : uiRectHelper.fromRect(dst), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawImageRect { |
|
|
|
image = image, |
|
|
|
src = src, |
|
|
|
dst = dst, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawImageRect.create( |
|
|
|
image : image, |
|
|
|
src : uiRectHelper.fromRect(src), |
|
|
|
dst : uiRectHelper.fromRect(dst), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawImageNine { |
|
|
|
image = image, |
|
|
|
center = center, |
|
|
|
dst = dst, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawImageNine.create( |
|
|
|
image : image, |
|
|
|
src : null, |
|
|
|
center : uiRectHelper.fromRect(center), |
|
|
|
dst : uiRectHelper.fromRect(dst), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawImageNine { |
|
|
|
image = image, |
|
|
|
src = src, |
|
|
|
center = center, |
|
|
|
dst = dst, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawImageNine.create( |
|
|
|
image : image, |
|
|
|
src : uiRectHelper.fromRect(src), |
|
|
|
center : uiRectHelper.fromRect(center), |
|
|
|
dst : uiRectHelper.fromRect(dst), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawPicture { |
|
|
|
picture = picture, |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawPicture.create( |
|
|
|
picture : picture |
|
|
|
)); |
|
|
|
this._recorder.addDrawCmd(new uiDrawTextBlob { |
|
|
|
textBlob = textBlob, |
|
|
|
offset = offset, |
|
|
|
paint = new Paint(paint), |
|
|
|
}); |
|
|
|
this._recorder.addDrawCmd(uiDrawTextBlob.create( |
|
|
|
textBlob : textBlob, |
|
|
|
offset : uiOffset.fromOffset(offset), |
|
|
|
paint : new Paint(paint) |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public void drawParagraph(Paragraph paragraph, Offset offset) { |
|
|
|