user1145533
user1145533

Reputation: 697

Android multiple canvas layers

I am trying to learn android and have written some simple graph plotting functions, I managed to get pinch zoom working but unfortunatly when it zooms the whole canvas zooms including the axis. What I would actually like is to still display the axis when it zooms, is there an easy way to acheive this in android using sme layering technique?

Upvotes: 1

Views: 2474

Answers (1)

Demian Hwang
Demian Hwang

Reputation: 180

Canvas has save() and restore() function for preserving and restoring the canvas matrix.

  1. Draw Axis at normal scale
  2. Call canvas.save() to push current state.
  3. Scale and draw plot.
  4. Call canvas.restore() to return to previous state.

Upvotes: 2

Related Questions