bitmap question II

MarkoMylo

Member
Licensed User
Longtime User
i have imageview1 generated in sub Globals of main.
I initialized (loaded) bitmap picture (large photo 2000x2000) and now i want to put one part of that picture (first 100x100) with destrect to show at imageview1 ...

i tried something but wrong...

help...
 

MarkoMylo

Member
Licensed User
Longtime User
If this is a jpeg file then you can use the JPEG library to only load this part.
Otherwise you will need to load the complete image and use Canvas to draw part of it to the ImageView.

ok, i try to use canvas but without result
this is my code

Dim Canvas1 As Canvas
Dim DestRect As Rect
Dim SrcRect As Rect

Activity.LoadLayout("320p")
slika.initialize(File.DirRootExternal, "z.jpg")
DestRect.Initialize(10dip, 10dip, 10dip + 100dip, 10dip + 100dip)
SrcRect.initialize (0,0,30,30)
Canvas1.DrawBitmap(slika, SrcRect, DestRect)
iv1.SetBackgroundImage (Canvas1.Bitmap)

it freezes on canvas1.drawbitmap
???


so... i just need that connection between canvas and imageview because later i want imageview to be "clickable"
 
Upvote 0
Top