Android Question Bitmapdrawable problem

grafsoft

Well-Known Member
Licensed User
Longtime User
Hi,

I write something on a bitmap, loaded with a photo, save it and the resolution is down to 10%. I posted this before, but I forgot something: I do not need to see the graphics on the phone, just save it with a text.

Thank you


B4X:
Sub Globals
   Dim bitbg As Bitmap
   Dim bdwBackground As BitmapDrawable
   Dim pnl As Panel
   Dim cvs As Canvas
end sub

Sub Activity_Create(FirstTime As Boolean)
 bitbg.Initialize(File.DirDefaultExternal,"test.png" )
 pnl.Initialize("pnl")
 Activity.AddView(pnl, 0, 0, 100%x, 100%y)Dim rectDest AsRect
 rectDest.Initialize(0, 0, pnl.Width, pnl.Height)
 cvs.Initialize (pnl)
 cvs.DrawBitmap(bitbg, Null, rectDest)
 cvs.DrawText ("test", 120dip, 120dip, Typeface.DEFAULT_BOLD, 50, Colors.Blue, "LEFT")
 Dim out AsOutputStream
 ' test out=File.OpenOutput (Main.outdir,"0test.png",False)
 cvs.Bitmap.WriteToStream (out,100,"PNG")
 out.Close
 

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you.

The png was taken with the camera, 2592 * 1944

I tried the first sugggestion, just for a test:

B4X:
Dim pnl As Panel
pnl.Initialize("pnl")
pnl.width=3000 ' program crashes here
pnl.Height=2000

This does not work.

Sorry for the stupid question, but what is a mutable bitmap and where can I find it?

I appreciate your help very much, on 7 days of the week!
 
Last edited:
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
First suggestion: Works now, but still goes from 1,8 MB to 200 KB.

I will try the initializemutable now.
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you. But the zip file with the photo was too large. What is the maximum size for upload?
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Sorry, max. file size was in plain view, stupid me.

I uploaded it without the jpg. You coupld replace 17.jpg with any other photo.
 

Attachments

  • atest.zip
    6.4 KB · Views: 170
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
I am looking for an example but I do not find one. I need to draw on a photo. Do you have a code snippet somewhere?
 
Upvote 0
Top