Created
April 27, 2011 06:39
-
-
Save agiletalk/943812 to your computer and use it in GitHub Desktop.
[예제] Paint 속성들
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onDraw(Canvas canvas) { | |
Paint Pnt = new Paint(); | |
canvas.drawColor(Color.WHITE); | |
// 캡 모양 테스트 | |
Pnt.setColor(Color.BLUE); | |
Pnt.setStrokeWidth(4); | |
canvas.drawLine(10,10,200,10,Pnt); | |
Pnt.setStrokeCap(Paint.Cap.ROUND); | |
canvas.drawLine(10,30,200,30,Pnt); | |
Pnt.setStrokeCap(Paint.Cap.SQUARE); | |
canvas.drawLine(10,50,200,50,Pnt); | |
// 조인 모양 테스트 | |
Pnt.setColor(Color.BLACK); | |
Pnt.setStrokeWidth(15); | |
Pnt.setStyle(Paint.Style.STROKE); | |
Pnt.setStrokeJoin(Paint.Join.MITER); | |
canvas.drawRect(10,80,60,130,Pnt); | |
Pnt.setStrokeJoin(Paint.Join.BEVEL); | |
canvas.drawRect(80,80,130,130,Pnt); | |
Pnt.setStrokeJoin(Paint.Join.ROUND); | |
canvas.drawRect(150,80,200,130,Pnt); | |
// 스타일 테스트 | |
Pnt.setStrokeWidth(5); | |
Pnt.setColor(Color.RED); | |
Pnt.setStyle(Paint.Style.FILL); | |
canvas.drawCircle(30,180,20,Pnt); | |
Pnt.setStyle(Paint.Style.STROKE); | |
canvas.drawCircle(80,180,20,Pnt); | |
Pnt.setStyle(Paint.Style.FILL_AND_STROKE); | |
canvas.drawCircle(130,180,20,Pnt); | |
Pnt.setColor(Color.BLUE); | |
Pnt.setStyle(Paint.Style.FILL); | |
canvas.drawCircle(180,180,20,Pnt); | |
Pnt.setColor(Color.RED); | |
Pnt.setStyle(Paint.Style.STROKE); | |
canvas.drawCircle(180,180,20,Pnt); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment