Android Question Pan/Zoom Using Bitmap Crop

Jim McDougal

Member
Licensed User
A question regarding graphics resolution:

I'm drawing my graphics onto a large master canvas (cvsMaster) and use B4XBitmap.Crop to "window" a portion of the master graphic onto cvsGraph_F (pnlGraph_F) by manipulating the values of X1, Y1, X2 and Y2 (pan/zoom). It works very well but there are certain values of X2, Y2 (window size) that produce poor resolution (a "grainy' appearance). I expect that if I draw directly onto cvsGraphs_F won't have this problem, but I'd like to see if there are any tricks I can use with my existing code before rewriting it.

Presently:

Private pnlMaster As B4XView
Private pnlGraph_F As B4XView
Private cvsMaster As B4XCanvas
Private cvsGraph_F As B4XCanvas
. . .
cvsMaster.Initialize(pnlMaster)
cvsGraph_F.Initialize(pnlGraph_F)
. . .
Dim Rect_F As B4XRect
Rect_F.Initialize(0, 0, pnlGraph_F.Width, pnlGraph_F.Height)
bmpMaster = cvsMaster.CreateBitmap
cvsGraph_F.DrawBitmap(bmpMaster.Crop(X1, Y1, X2, Y2), Rect_F)
cvsGraph_F.Invalidate

Thanks.
 
Top