App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mhr.appandroid.views.ProjectiveTransformPicker Class Reference
Inheritance diagram for mhr.appandroid.views.ProjectiveTransformPicker:

## Classes
interface | ProjectiveTransformPickerEventListener
class | ProjTransformData
class | Quadrilateral

## Public Member Functions
| ProjectiveTransformPicker (Context context)
| ProjectiveTransformPicker (Context context, AttributeSet attrs)
| ProjectiveTransformPicker (Context context, AttributeSet attrs, int defStyle)
ProjTransformData | getTransformationData ()
void | setListener (ProjectiveTransformPickerEventListener l)
void | onMeasure (int widthMeasureSpec, int heightMeasureSpec)
boolean | onTouchEvent (MotionEvent ev)
| Zpracovává vstup od uživatele, zpracovává pouze jeden hlavní dotek.

## Protected Member Functions
void | init ()
void | onSizeChanged (int w, int h, int oldw, int oldh)
| Voláno v okamžiku, kdy view dostane rozměry.
void | onDraw (Canvas canvas)
| Provádí vykreslení dle stavu.

## Protected Attributes
Bitmap | cPressed
Bitmap | cNormal
Paint | bgPaint
Paint | lnPaint
Paint | origPaint
Rect[] | origCurs
Rect[] | movedCurs
Rect | selCur = null
RectF | origRect
float | lastX
float | lastY
int | cWidth
int | cHeight
int | cXCenter
int | cYCenter
ProjectiveTransformPickerEventListener | listener = null

## Detailed Description

Definition at line 18 of file ProjectiveTransformPicker.java.

## Constructor & Destructor Documentation

mhr.appandroid.views.ProjectiveTransformPicker.ProjectiveTransformPicker | ( | Context | context | ) |
| inline

Definition at line 115 of file ProjectiveTransformPicker.java.

{
super(context);
init();
}

mhr.appandroid.views.ProjectiveTransformPicker.ProjectiveTransformPicker | ( | Context | context,
|  | AttributeSet | attrs
| ) |  |
| inline

Definition at line 120 of file ProjectiveTransformPicker.java.

{
super(context, attrs);
init();
}

mhr.appandroid.views.ProjectiveTransformPicker.ProjectiveTransformPicker | ( | Context | context,
|  | AttributeSet | attrs,
|  | int | defStyle
| ) |  |
| inline

Definition at line 125 of file ProjectiveTransformPicker.java.

{
super(context, attrs, defStyle);
init();
}

## Member Function Documentation

ProjTransformData mhr.appandroid.views.ProjectiveTransformPicker.getTransformationData | ( |  | ) |
| inline

Definition at line 133 of file ProjectiveTransformPicker.java.

{
ProjTransformData d = new ProjTransformData();
d.oldQuad = new Quadrilateral(
origCurs[0].left + cXCenter,
origCurs[0].top + cYCenter,
origCurs[1].left + cXCenter,
origCurs[1].top + cYCenter,
origCurs[2].left + cXCenter,
origCurs[2].top + cYCenter,
origCurs[3].left + cXCenter,
origCurs[3].top + cYCenter
);
d.newQuad = new Quadrilateral(
movedCurs[0].left + cXCenter,
movedCurs[0].top + cYCenter,
movedCurs[1].left + cXCenter,
movedCurs[1].top + cYCenter,
movedCurs[2].left + cXCenter,
movedCurs[2].top + cYCenter,
movedCurs[3].left + cXCenter,
movedCurs[3].top + cYCenter
);
// d.origRect = new RectF(origRect);
//
// d.x = new int[] {
// movedCurs[0].left + cXCenter,
// movedCurs[1].left + cXCenter,
// movedCurs[2].left + cXCenter,
// movedCurs[3].left + cXCenter
// };
//
// d.y = new int[] {
// movedCurs[0].top + cYCenter,
// movedCurs[1].top + cYCenter,
// movedCurs[2].top + cYCenter,
// movedCurs[3].top + cYCenter
// };
return d;
}

void mhr.appandroid.views.ProjectiveTransformPicker.init | ( |  | ) |
| inlineprotected

Definition at line 85 of file ProjectiveTransformPicker.java.

{
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
cPressed = BitmapFactory.decodeResource(getResources(), R.drawable.scrubber_control_pressed_bw);
cNormal = BitmapFactory.decodeResource(getResources(), R.drawable.scrubber_control_normal_bw);
bgPaint = new Paint();
bgPaint.setColor(0xFF545454);
lnPaint = new Paint();
lnPaint.setColor(0xFFFFFFFF);
lnPaint.setStyle(Style.STROKE);
lnPaint.setStrokeWidth(5);
lnPaint.setAntiAlias(true);
origPaint = new Paint();
origPaint.setColor(0x40FFFFFF);
origPaint.setStyle(Style.STROKE);
origPaint.setStrokeWidth(5);
origPaint.setAntiAlias(true);
origPaint.setStrokeCap(Cap.ROUND);
origPaint.setStrokeJoin(Join.ROUND);
cWidth = cNormal.getWidth();
cHeight = cNormal.getHeight();
cXCenter = cWidth / 2;
cYCenter = cHeight / 2;
}

void mhr.appandroid.views.ProjectiveTransformPicker.onDraw | ( | Canvas | canvas | ) |
| inlineprotected

Provádí vykreslení dle stavu.

Definition at line 214 of file ProjectiveTransformPicker.java.

{
canvas.drawColor(0x00000000);
canvas.drawLines(new float[] {
origCurs[0].left + cXCenter, origCurs[0].top + cYCenter, origCurs[1].left + cXCenter, origCurs[1].top + cYCenter,
origCurs[0].left + cXCenter, origCurs[0].top + cYCenter, origCurs[2].left + cXCenter, origCurs[2].top + cYCenter,
origCurs[1].left + cXCenter, origCurs[1].top + cYCenter, origCurs[3].left + cXCenter, origCurs[3].top + cYCenter,
origCurs[2].left + cXCenter, origCurs[2].top + cYCenter, origCurs[3].left + cXCenter, origCurs[3].top + cYCenter
}, origPaint);
for (Rect r : origCurs) {
canvas.drawBitmap(cNormal, null, r, origPaint);
}
canvas.drawLines(new float[] {
movedCurs[0].left + cXCenter, movedCurs[0].top + cYCenter, movedCurs[1].left + cXCenter, movedCurs[1].top + cYCenter,
movedCurs[0].left + cXCenter, movedCurs[0].top + cYCenter, movedCurs[2].left + cXCenter, movedCurs[2].top + cYCenter,
movedCurs[1].left + cXCenter, movedCurs[1].top + cYCenter, movedCurs[3].left + cXCenter, movedCurs[3].top + cYCenter,
movedCurs[2].left + cXCenter, movedCurs[2].top + cYCenter, movedCurs[3].left + cXCenter, movedCurs[3].top + cYCenter
}, lnPaint);
for (Rect r : movedCurs) {
if (r == selCur) {
canvas.drawBitmap(cPressed, null, r, null);
} else {
canvas.drawBitmap(cNormal, null, r, null);
}
}
}

void mhr.appandroid.views.ProjectiveTransformPicker.onMeasure | ( | int | widthMeasureSpec,
|  | int | heightMeasureSpec
| ) |  |
| inline

Definition at line 185 of file ProjectiveTransformPicker.java.

{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

void mhr.appandroid.views.ProjectiveTransformPicker.onSizeChanged | ( | int | w,
|  | int | h,
|  | int | oldw,
|  | int | oldh
| ) |  |
| inlineprotected

Voláno v okamžiku, kdy view dostane rozměry.

Definition at line 191 of file ProjectiveTransformPicker.java.

{
super.onSizeChanged(w, h, oldw, oldh);
origRect = new RectF(w / 4.0f, h / 4.0f, 3 * w / 4.0f, 3 * h / 4.0f);
movedCurs = new Rect[] {
new Rect(w / 4 - cXCenter, h / 4 - cYCenter, w / 4 + cWidth - cXCenter, h / 4 + cHeight - cYCenter),
new Rect(3 * w / 4 - cXCenter, h / 4 - cYCenter, 3 * w / 4 + cWidth - cXCenter, h / 4 + cHeight - cYCenter),
new Rect(w / 4 - cXCenter, 3 * h / 4 - cYCenter, w / 4 + cWidth - cXCenter, 3 * h / 4 + cHeight - cYCenter),
new Rect(3 * w / 4 - cXCenter, 3 * h / 4 - cYCenter, 3 * w / 4 + cWidth - cXCenter, 3 * h / 4 + cHeight - cYCenter),
};
origCurs = new Rect[] {
new Rect(movedCurs[0]),
new Rect(movedCurs[1]),
new Rect(movedCurs[2]),
new Rect(movedCurs[3])
};
}

boolean mhr.appandroid.views.ProjectiveTransformPicker.onTouchEvent | ( | MotionEvent | ev | ) |
| inline

Zpracovává vstup od uživatele, zpracovává pouze jeden hlavní dotek.

Definition at line 248 of file ProjectiveTransformPicker.java.

{
float x = ev.getX();
float y = ev.getY();
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
for (Rect r : movedCurs) {
if (r.contains((int) x, (int) y)) {
selCur = r;
break;
}
}
if (selCur != null) {
lastX = x;
lastY = y;
if (listener != null) {
listener.onStartTrackingTransformation(this);
}
}
break;
case MotionEvent.ACTION_MOVE:
if (selCur != null) {
selCur.offset((int) (x - lastX), (int) (y - lastY));
lastX = x;
lastY = y;
if (listener != null) {
listener.onTransformationChanged(this);
}
invalidate();
}
break;
case MotionEvent.ACTION_UP:
if (selCur != null) {
selCur = null;
if (listener != null) {
listener.onStopTrackingTransformation(this);
}
invalidate();
}
break;
}
return true;
}

void mhr.appandroid.views.ProjectiveTransformPicker.setListener | ( | ProjectiveTransformPickerEventListener | l | ) |
| inline

Definition at line 178 of file ProjectiveTransformPicker.java.

{
listener = l;
}

## Member Data Documentation

Paint mhr.appandroid.views.ProjectiveTransformPicker.bgPaint
| protected

Definition at line 61 of file ProjectiveTransformPicker.java.

int mhr.appandroid.views.ProjectiveTransformPicker.cHeight
| protected

Definition at line 75 of file ProjectiveTransformPicker.java.

Bitmap mhr.appandroid.views.ProjectiveTransformPicker.cNormal
| protected

Definition at line 59 of file ProjectiveTransformPicker.java.

Bitmap mhr.appandroid.views.ProjectiveTransformPicker.cPressed
| protected

Definition at line 58 of file ProjectiveTransformPicker.java.

int mhr.appandroid.views.ProjectiveTransformPicker.cWidth
| protected

Definition at line 74 of file ProjectiveTransformPicker.java.

int mhr.appandroid.views.ProjectiveTransformPicker.cXCenter
| protected

Definition at line 76 of file ProjectiveTransformPicker.java.

int mhr.appandroid.views.ProjectiveTransformPicker.cYCenter
| protected

Definition at line 77 of file ProjectiveTransformPicker.java.

float mhr.appandroid.views.ProjectiveTransformPicker.lastX
| protected

Definition at line 71 of file ProjectiveTransformPicker.java.

float mhr.appandroid.views.ProjectiveTransformPicker.lastY
| protected

Definition at line 72 of file ProjectiveTransformPicker.java.

ProjectiveTransformPickerEventListener mhr.appandroid.views.ProjectiveTransformPicker.listener = null
| protected

Definition at line 79 of file ProjectiveTransformPicker.java.

Paint mhr.appandroid.views.ProjectiveTransformPicker.lnPaint
| protected

Definition at line 62 of file ProjectiveTransformPicker.java.

Rect [] mhr.appandroid.views.ProjectiveTransformPicker.movedCurs
| protected

Definition at line 66 of file ProjectiveTransformPicker.java.

Rect [] mhr.appandroid.views.ProjectiveTransformPicker.origCurs
| protected

Definition at line 65 of file ProjectiveTransformPicker.java.

Paint mhr.appandroid.views.ProjectiveTransformPicker.origPaint
| protected

Definition at line 63 of file ProjectiveTransformPicker.java.

RectF mhr.appandroid.views.ProjectiveTransformPicker.origRect
| protected

Definition at line 69 of file ProjectiveTransformPicker.java.

Rect mhr.appandroid.views.ProjectiveTransformPicker.selCur = null
| protected

Definition at line 67 of file ProjectiveTransformPicker.java.

The documentation for this class was generated from the following file:

- /home/xxx/eclipse_workspaces/app/appandroid/src/mhr/appandroid/views/ProjectiveTransformPicker.java