1 package mhr.appandroid.displayer;
3 import mhr.appandroid.adapters.APDBitmap;
4 import mhr.appcore.bitmap.BitmapInfo;
5 import mhr.appcore.interfaces.PDBitmap;
6 import mhr.appcore.interfaces.PDDisplayer;
7 import android.graphics.Bitmap;
8 import android.graphics.Canvas;
9 import android.graphics.Paint;
10 import android.graphics.Rect;
11 import android.view.SurfaceHolder;
12 import android.view.SurfaceView;
13 import android.view.View;
48 private SurfaceView
sv = null;
51 private Bitmap
data = null;
70 sv.getHolder().addCallback(
this);
88 synchronized (this.
lock) {
99 synchronized (this.
lock) {
122 if (bitmap == null) {
return; }
123 synchronized (this.
lock) {
127 this.
lock.notifyAll();
134 throw new IllegalArgumentException(
"Unsupported bitmap type");
136 setInput(((APDBitmap)bitmap).getBitmap());
141 synchronized (this.
lock) {
143 this.
lock.notifyAll();
155 synchronized (this.
lock) {
172 synchronized (this.
lock) {
186 if (zoom <= 0) {
return; }
187 synchronized (this.
lock) {
203 public void adjustZoom(
double factor,
float focusX,
float focusY) {
204 if (factor <= 0) {
return; }
205 synchronized (this.
lock) {
229 synchronized (this.
lock) {
243 synchronized (this.
lock) {
271 public void surfaceChanged(SurfaceHolder holder,
int format,
int width,
int height) {
275 synchronized (this.
lock) {
277 this.
thread =
new Thread(
this);
286 synchronized (this.
lock) {
289 this.
lock.notifyAll();
293 }
catch (InterruptedException e) {
304 SurfaceHolder sh = this.
sv.getHolder();
306 Paint p =
new Paint();
307 p.setFlags(Paint.DITHER_FLAG);
308 p.setFilterBitmap(
true);
313 synchronized (this.
lock) {
328 double st, sl, sb, sr;
329 double dt, dl, db, dr;
353 dst =
new Rect((
int)dl, (
int)dt, (
int)dr, (
int)db);
354 src =
new Rect((
int)sl, (
int)st, (
int)sr, (
int)sb);
357 if (this.
lock.
REDRAW_FLAG &&
this.lock.OUTPUT_READY_FLAG &&
this.lock.INPUT_READY_FLAG) {
363 }
catch (InterruptedException e) {
371 if (!sh.getSurface().isValid()) {
375 c.drawColor(0xFF000000);
376 c.drawBitmap(
data, src, dst, p);
377 sh.unlockCanvasAndPost(c);