-2

A clear example would help. I am confused by why I can't just use translate every time?

zoro12
  • 1
  • 1

1 Answers1

2

A clip rectangle is the drawing portion of your canvas - anything you draw outside this rectangle doesn't count - ie. doen't get finally rendered onto the display. Think of it as the boundaries of your canvas.

A canvas also has a coordinate system which starts at 0,0 A.K.A the origin and x increases from left to right, and y increases from top to down. When you use any of the drawing commands that need coodinates (e.g drawLine, drawRect), the coordinates are relative to the this coordinate system.

You can move this coordinate system by using canvas.translate. Think of it as a frame of reference which can be moved around

tomrozb
  • 25,773
  • 31
  • 101
  • 122
numan salati
  • 19,394
  • 9
  • 63
  • 66