提交 4f7e9e87 编写于 作者: H huangziwei

readme

上级 c10d493d
......@@ -244,6 +244,7 @@ public class GraffitiActivity extends Activity {
findViewById(R.id.btn_hand_write).performClick();
}
});
mGraffitiView.setPaintSize(mGraffitiParams.mPaintSize);
mGraffitiView.setIsDrawableOutside(mGraffitiParams.mIsDrawableOutside);
mFrameLayout.addView(mGraffitiView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mOnClickListener = new GraffitiOnClickListener();
......@@ -429,7 +430,7 @@ public class GraffitiActivity extends Activity {
findViewById(R.id.graffiti_btn_rotate).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mGraffitiView.rotate(mGraffitiView.getRotateDegree()+90);
mGraffitiView.rotate(mGraffitiView.getRotateDegree() + 90);
}
});
}
......@@ -771,6 +772,12 @@ public class GraffitiActivity extends Activity {
*/
public boolean mIsFullScreen = false;
/**
* 初始化的画笔大小
* 默认为30px
*/
public float mPaintSize = 30;
public static final Creator<GraffitiParams> CREATOR = new Creator<GraffitiParams>() {
@Override
public GraffitiParams createFromParcel(Parcel in) {
......@@ -781,6 +788,10 @@ public class GraffitiActivity extends Activity {
params.mEraserPath = in.readString();
params.mEraserImageIsResizeable = in.readInt() == 1;
params.mIsDrawableOutside = in.readInt() == 1;
params.mChangePanelVisibilityDelay = in.readLong();
params.mAmplifierScale = in.readFloat();
params.mIsFullScreen = in.readInt() == 1;
params.mPaintSize = in.readFloat();
return params;
}
......@@ -799,6 +810,10 @@ public class GraffitiActivity extends Activity {
dest.writeString(mEraserPath);
dest.writeInt(mEraserImageIsResizeable ? 1 : 0);
dest.writeInt(mIsDrawableOutside ? 1 : 0);
dest.writeLong(mChangePanelVisibilityDelay);
dest.writeFloat(mAmplifierScale);
dest.writeInt(mIsFullScreen ? 1 : 0);
dest.writeFloat(mPaintSize);
}
@Override
......
......@@ -663,12 +663,12 @@ public class GraffitiView extends View {
public float[] getDxDy(int currentDegree) {
return rotatePointInGrffiti(currentDegree, mRotateDegree, mDx, mDy, mPivotX, mPivotY);
return rotatePointInGriffiti(currentDegree, mRotateDegree, mDx, mDy, mPivotX, mPivotY);
}
public float[] getSxSy(int currentDegree) {
return rotatePointInGrffiti(currentDegree, mRotateDegree, mSx, mSy, mPivotX, mPivotY);
return rotatePointInGriffiti(currentDegree, mRotateDegree, mSx, mSy, mPivotX, mPivotY);
}
public Matrix getMatrix(int currentDegree) {
......@@ -912,17 +912,17 @@ public class GraffitiView extends View {
public void rotatePosition(int originalDegree) {
// 旋转仿制图标的位置
float[] coords = rotatePointInGrffiti(mRotateDegree, originalDegree, this.mX,
float[] coords = rotatePointInGriffiti(mRotateDegree, originalDegree, this.mX,
this.mY, mOriginalPivotX, mOriginalPivotY);
this.mX = coords[0];
this.mY = coords[1];
coords = rotatePointInGrffiti(mRotateDegree, originalDegree, this.mCopyStartX,
coords = rotatePointInGriffiti(mRotateDegree, originalDegree, this.mCopyStartX,
this.mCopyStartY, mOriginalPivotX, mOriginalPivotY);
this.mCopyStartX = coords[0];
this.mCopyStartY = coords[1];
coords = rotatePointInGrffiti(mRotateDegree, originalDegree, this.mTouchStartX,
coords = rotatePointInGriffiti(mRotateDegree, originalDegree, this.mTouchStartX,
this.mTouchStartY, mOriginalPivotX, mOriginalPivotY);
this.mTouchStartX = coords[0];
this.mTouchStartY = coords[1];
......@@ -1236,7 +1236,7 @@ public class GraffitiView extends View {
return mAmplifierScale;
}
private static float[] rotatePointInGrffiti(int nowDegree, int oldDegree, float x, float y, float mOriginalPivotX, float mOriginalPivotY) {
private static float[] rotatePointInGriffiti(int nowDegree, int oldDegree, float x, float y, float mOriginalPivotX, float mOriginalPivotY) {
int degree = nowDegree - oldDegree;
if (degree != 0) {
float px = mOriginalPivotX, py = mOriginalPivotY;
......
......@@ -85,10 +85,10 @@ public static class GraffitiParams implements Parcelable {
*/
public float mAmplifierScale = 2.5f;
/**
* 是否全屏显示,即是否隐藏状态栏
* 默认为false,表示状态栏继承应用样式
* 初始化的画笔大小
* 默认为30px
*/
public boolean mIsFullScreen = false;
public float mPaintSize = 30;
}
```
......@@ -136,4 +136,4 @@ public static class GraffitiParams implements Parcelable {
(2)新增接口:涂鸦时面板自动隐藏.
(3)修复:使用长图,缩放移动时不能自由移动.
\ No newline at end of file
(3)修复:使用长图,缩放移动时不能自由移动.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册