schimanski Well-Known Member Licensed User Longtime User Feb 17, 2011 #1 Hello! I draw on an imageview, but it is not possible to clear the image bevor I draw again on it. I thought, that imageview1.Invalidate clears the bitmap??? Code: imageview1.Bitmap=Pfeil PfeilCanvas.Initialize(imageview) DRectPfeil.Initialize(0,0,100,100) Pfeilrotation(45) Code: Sub Pfeilrotation(Kursrichtung) PfeilCanvas.DrawBitmapRotated(Pfeil,Null,DRectPfeil,Kursrichtung) imageview1.Invalidate End Sub
Hello! I draw on an imageview, but it is not possible to clear the image bevor I draw again on it. I thought, that imageview1.Invalidate clears the bitmap??? Code: imageview1.Bitmap=Pfeil PfeilCanvas.Initialize(imageview) DRectPfeil.Initialize(0,0,100,100) Pfeilrotation(45) Code: Sub Pfeilrotation(Kursrichtung) PfeilCanvas.DrawBitmapRotated(Pfeil,Null,DRectPfeil,Kursrichtung) imageview1.Invalidate End Sub
alfcen Well-Known Member Licensed User Longtime User Feb 17, 2011 #2 ImageView.Invalidate refreshes the view. Assuming you are drawing a compass needle on a compass rose, please try and load the compass rose image before drawing the needle rotated with transparent background. Similar to this: Code: Sub Orientation_OrientationChanged (Azimuth As Float, Pitch As Float, Roll As Float) Canvas1.DrawBitmap(bitmapRose,Null,DRect) Canvas1.DrawBitmapRotated(bitmapNeedle,Null,DRect,Azimuth+MDecl) ImageView1.Invalidate End Sub If there is no compass rose image, then try and fill the entire canvas area with an adequate color (Canvas1.DrawColor()) before drawing the needle. Upvote 0
ImageView.Invalidate refreshes the view. Assuming you are drawing a compass needle on a compass rose, please try and load the compass rose image before drawing the needle rotated with transparent background. Similar to this: Code: Sub Orientation_OrientationChanged (Azimuth As Float, Pitch As Float, Roll As Float) Canvas1.DrawBitmap(bitmapRose,Null,DRect) Canvas1.DrawBitmapRotated(bitmapNeedle,Null,DRect,Azimuth+MDecl) ImageView1.Invalidate End Sub If there is no compass rose image, then try and fill the entire canvas area with an adequate color (Canvas1.DrawColor()) before drawing the needle.
schimanski Well-Known Member Licensed User Longtime User Feb 17, 2011 #3 Thanks, that was what i am looking for? Upvote 0
klaus Expert Licensed User Longtime User Feb 18, 2011 #4 Attached you find an example of drawing a needle on an ImageView. With two modes: - turning needle - turning compass rose The difference is that there are two ImageViews: - one for the compass rose - one for the needle The NeedleImageView is transparent. And, in the turning needle mode, to erase the previous needle position I draw a transparent rectangle, needle image size, onto the NeedleImageView. The compass rose is drawn only one time. In the turning compass rose mode, the compass rose is redrawn every tick and the needle is drawn only one time. Best regards. Attachments DrawNeedleImageView1.zip DrawNeedleImageView1.zip 25.3 KB · Views: 830 Upvote 0
Attached you find an example of drawing a needle on an ImageView. With two modes: - turning needle - turning compass rose The difference is that there are two ImageViews: - one for the compass rose - one for the needle The NeedleImageView is transparent. And, in the turning needle mode, to erase the previous needle position I draw a transparent rectangle, needle image size, onto the NeedleImageView. The compass rose is drawn only one time. In the turning compass rose mode, the compass rose is redrawn every tick and the needle is drawn only one time. Best regards.
Z ZJP Active Member Licensed User Longtime User Feb 18, 2011 #5 @Schimanski. I guess it's a function to create a marker for the application "Openstreetmap Tilemapviewer? @Klaus. Thank you for all your responses to various messages. JP Upvote 0
@Schimanski. I guess it's a function to create a marker for the application "Openstreetmap Tilemapviewer? @Klaus. Thank you for all your responses to various messages. JP