Okay I had re-written some of  this

onDraw  just handles  drawing  and canvas operations,  ONLY
lines  is a Vector   Vector<line>    lines;

@Override
protected void onDraw(Canvas  canvas) {
   canvas.drawBitmap(mBitmap , matrix , mPaint);
   String result;
                
   if (lines != null) {
      for (int count = 0; count < lines.size(); count++ ) {
        mPaint.setColor(Color.BLUE);
        canvas.drawLine( lines.get(count).getStart().x , 
lines.get(count).getStart().y , lines.get(count).getStop().x , 
lines.get(count).getStop().y , mPaint);
        result = "";
        result  = String.format("%4.3f mm", lines.get(count).getDistance() / 
factor );   
        canvas.drawText( result , lines.get(count).getMidPt().x , 
lines.get(count).getMidPt().y , mPaint);
      }
   }

}

Now the TOUCH_UP  calls touch_end  so say I have finished finding the point.

private void touch_end(float x, float y) {
   ((ViewGroup) super.getParent()).removeView(pointer);
   if (touch_counter == 1) {
        pointA   = new PointF();
        pointA.x = ((x - 32.0f));
        pointA.y = ((y - 70.0f));
        
   } else if (touch_counter == 2) {
        pointB   = new PointF();
        pointB.x = ((x - 32.0f));
        pointB.y = ((y - 70.0f));
                        
   }
                
                
   if (touch_counter == 2 ) {
        line newLine = new line();
        newLine.setStart(pointA);
        newLine.setStop(pointB);
        lines.add(newLine);
                        
        invalidate();
                        
        pointA     = null;              pointB     = null;
        pointC     = null;              newLine    = null;
        touch_counter = 0;
   }
}
        
Progress ! !    that is now draws the line and writes the measurement.  

But when I   zoom in the line stays where it was  and  does not zoom with the 
whole image ??

how can I make the line adjust with the zoom of the image ??

Thanks in advance


On Jun 27, 2011, at 10:11 PM, Miguel Morales wrote:

> Hmm, doesn't look like you are.
> 
> Try drawing on the bitmap itself and then set that for the ImageView.
> See: 
> http://developer.android.com/reference/android/graphics/Canvas.html#Canvas(android.graphics.Bitmap)
> 
> On Mon, Jun 27, 2011 at 6:00 PM, New Developer <[email protected]> wrote:
>> within the function that has the drawline
>> I first call  super.draw()
>>  super.onDraw(canvas);
>>  layers[0] = new BitmapDrawable( mBitmap );
>> //canvas.save();
>> mPaint.setColor(Color.BLUE);
>> canvas.drawLine(pointA.x, pointA.y, pointB.x, pointB.y, mPaint);
>> canvas.drawText( result, ((newline.getDistance() * line.PX_TO_MM) / 3.0f),
>> -6.0f, mPaint);
>> //canvas.restore();
>> super.setImageDrawable(layers[0]);
>> 
>> So I "Think" I am drawing first  is there anyway to check or verify this ??
>> Thanks again
>> 
>> 
>> On Jun 27, 2011, at 4:03 PM, Miguel Morales wrote:
>> 
>> Make sure you are drawing your line after you draw your image
>> 
>> On Mon, Jun 27, 2011 at 12:57 PM, New Developer <[email protected]> wrote:
>> 
>> I'm using the following  type of code to  do panning and zooming  on my own
>> 
>> extension of an  ImageView
>> 
>>     setBackgroundColor(Color.BLACK);
>> 
>> matrix.postScale(newfactor , newfactor , mid.x , mid.y);
>> 
>> setImageMatrix(matrix);
>> 
>> Now I want to be able to draw lines on top of this image = = matrix
>> 
>> currently I'm using
>> 
>> mPaint.setColor(Color.BLUE);
>> 
>> canvas.drawLine(pointA.x, pointA.y, pointB.x, pointB.y, mPaint);
>> 
>> However this won't show  up,
>> 
>> so my question is   How can I draw a line to the matrix  variable used for
>> 
>> zooming and panning ?
>> 
>> Also I'm looking for  tutorials on  LayerDrawable if you know of any
>> 
>> Thanks in advance
>> 
>> 
>> 
>> 
>> --
>> 
>> You received this message because you are subscribed to the Google
>> 
>> Groups "Android Developers" group.
>> 
>> To post to this group, send email to [email protected]
>> 
>> To unsubscribe from this group, send email to
>> 
>> [email protected]
>> 
>> For more options, visit this group at
>> 
>> http://groups.google.com/group/android-developers?hl=en
>> 
>> 
>> 
>> --
>> ~ Jeremiah:9:23-24
>> Android 2D MMORPG:
>> http://solrpg.com/, http://www.youtube.com/user/revoltingx
>> 
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>> 
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
> 
> 
> 
> -- 
> ~ Jeremiah:9:23-24
> Android 2D MMORPG: http://solrpg.com/, http://www.youtube.com/user/revoltingx
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to