| 22 | private Page page; //the page it is rendering or accessing for input (through getRegionAt()) |
| 23 | |
| 24 | public PageCanvas( |
| 25 | final int width, final int height, final int orientation) { |
| 26 | |
| 27 | this.orientation = orientation; |
| 28 | |
| 29 | if (orientation != BookCanvas.ORIENTATION_0) { |
| 30 | /* |
| 31 | * Rotation will be necessary |
| 32 | */ |
| 33 | if (orientation == BookCanvas.ORIENTATION_180) { |
| 34 | if (BUFFER == null |
| 35 | || BUFFER.getWidth() != width |
| 36 | || BUFFER.getHeight() != height) { |
| 37 | BUFFER = Image.createImage(width, height); |
| 38 | } |
| 39 | } else { |
| 40 | if (BUFFER == null |
| 41 | || BUFFER.getWidth() != height |
| 42 | || BUFFER.getHeight() != width) { |
| 43 | BUFFER = Image.createImage(height, width); |
| 44 | } |
| 45 | } |
| 46 | } else { |
| 47 | /* |
| 48 | * No rotation needed. Better clear the buffer. |
| 49 | */ |
| 50 | BUFFER = null; |
| 51 | } |
| 52 | |
| 53 | canvas = Image.createImage(width, height); |
| 54 | page = null; |
| 55 | } |
| 56 | |
| 57 | public final void renderPage(final ColorScheme cp) { |
| 58 | |