Image from disc

wolfgang

Member
Licensed User
Hi,
is it possible to display only a part of an image which is stored on disk and not loaded to memory? Or much easier, this code should work:
B4X:
.
.
.
drawer.DrawImage1("myimage",rectSrc.Value,rectDest.Value,false) ' -> error message
 

Erel

Administrator
Staff member
Licensed User
Your code should work. You should change it to:
drawer.DrawImage1(AppPath & "\myimage",...)
External libraries do not use the default folder.

It will however first load the image to memory.
 

wolfgang

Member
Licensed User
Hi Erel,
this is the code and the error message
B4X:
Sub Globals
   'Declare the global variables here.
End Sub

Sub App_Start
   Form1.Show
   draw.New1("Form1",false)
   rsrc.New1(100,100,238,268)
   rdst.New1(0,0,238,268)
   draw.DrawImage1(AppPath & "\stein50.bmp",rsrc.Value,rdst.Value,false)
   Form1.Refresh
End Sub
The image exits, 100%.

Error description:
"Value may not be ZERO"
 

Erel

Administrator
Staff member
Licensed User
:signOops:
Drawer.DrawImage1 expects a loaded image.
You should add a bitmap object and use it to first load the image:
B4X:
bitmap.New1(AppPath & "\yourfile.bmp")
draw.DrawImage1(bitmap.Value,rsrc.Value,rdst.Value,false)
 

wolfgang

Member
Licensed User
Hi Erel,
thank you. That’s what I did up to now. But I was looking for a possibility to display a small part of a big (20 MB) image(map) on ppc to save memory. So I have to think about of an “automatic” map changing?!
 
Top