Commit ffc94b88 authored by Thomas Krex's avatar Thomas Krex

-highlightAnnotations hinzugefügt + paint methode angepasst

parent 358443b9
eclipse.preferences.version=1
encoding//src/tttclient/connections/TTTConnection.java=UTF-8
encoding//src/tttclient/messages/HighlightAnnotation.java=UTF-8
encoding//src/tttclient/ttt/Constants.java=ISO-8859-1
......@@ -50,11 +50,6 @@ public class HighlightAnnotation extends SimpleAnnotation {
.readUnsignedShort());
}
// MODMSG
/**
* creates HighlightAnnotation from corresponding XML Element. (used by
* messaging)
*/
public HighlightAnnotation(org.w3c.dom.Element xmlNode) {
super(xmlNode);
}
......@@ -64,6 +59,7 @@ public class HighlightAnnotation extends SimpleAnnotation {
return Constants.AnnotationHighlight;
}
// TODO benötigt?
@Override
void computeShape() {
// calculate x,y,width,height from startx/y and endx/y
......@@ -95,14 +91,14 @@ public class HighlightAnnotation extends SimpleAnnotation {
height = starty - endy;
}
}
shape = thumbshape = new Rect(x, y, x + width, y + height);
// TODO shape gibts nicht, überhaupt benötigt?
// shape = thumbshape = new Rect(x, y, x + width, y + height);
}
public void paintToThumbnail(Bitmap bitmap) {
// TODO: fix color - don't use table for new protocol
// TODO: due to some java bug fill and draw use different coordinates if
// scaled
int highlightColor = annotationColors[color];
// create canvas to draw on Bitmap thumbnail
Canvas canvas = new Canvas(bitmap);
......@@ -111,13 +107,16 @@ public class HighlightAnnotation extends SimpleAnnotation {
highlightPaint.setColor(highlightColor);
highlightPaint.setStrokeWidth(1);
highlightPaint.setStyle(Paint.Style.FILL);
Rect highlightRect = getBounds();
Rect scaledHighlightRect = new Rect((int)(highlightRect.left*Index.THUMBNAIL_SCALE_FACTOR),
(int)(highlightRect.top*Index.THUMBNAIL_SCALE_FACTOR),
(int)(highlightRect.right*Index.THUMBNAIL_SCALE_FACTOR),
(int)(highlightRect.left*Index.THUMBNAIL_SCALE_FACTOR);
Rect bounds = getBounds();
canvas.drawRect(getBounds(), highlightPaint);
// scale Rect for thumbnail
Rect scaledBounds = new Rect(
(int) (bounds.left * Index.THUMBNAIL_SCALE_FACTOR),
(int) (bounds.top * Index.THUMBNAIL_SCALE_FACTOR),
(int) (bounds.right * Index.THUMBNAIL_SCALE_FACTOR),
(int) (bounds.left * Index.THUMBNAIL_SCALE_FACTOR));
canvas.drawRect(scaledBounds, highlightPaint);
// border highlighted area
......@@ -132,9 +131,7 @@ public class HighlightAnnotation extends SimpleAnnotation {
@Override
public void paint(Canvas canvas) {
// TODO: fix color - don't use table for new protocol
// TODO: due to some java bug fill and draw use different coordinates if
// scaled
int highlightColor = annotationColors[color];
// highlight area
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment