Lazarus

Programming => Operating Systems => Android => Topic started by: Manlio on September 08, 2019, 12:13:40 am

Title: LAMW - creating a temporary BMP or PNG file
Post by: Manlio on September 08, 2019, 12:13:40 am
In my app I need to create from scratch an image file, BMP or PNG, and save it into a temporary folder.

What object can I use to create a new image, assign it a width and height, draw some colors and lines in it, and save it to a file in a temporary folder?

I tried with TBitmap, but it crashes. I guess that doesn't work on Android...

With jBitmap, I see how it can open existing files, but not draw and save to a file...

I could really use a tip or two, please...

Thanks!
Title: Re: LAMW - creating a temporary BMP or PNG file
Post by: jmpessoa on September 11, 2019, 03:31:50 pm


You can try the demo "AppDrawingViewDemo1"
Title: Re: LAMW - creating a temporary BMP or PNG file
Post by: Manlio on September 13, 2019, 11:32:14 am


You can try the demo "AppDrawingViewDemo1"

I see that jDrawingView has a method "SaveToFile", but jDrawingView is a visual component...

So you are (indirectly) suggesting that I should add a jDrawingView component to the form, make it invisible, and use it to create the image files?

I guess that it could be a solution... I'll try it

Thanks!

Title: Re: LAMW - creating a temporary BMP or PNG file
Post by: jmpessoa on September 13, 2019, 06:25:52 pm

How do you will create a image "from scratch"?

maybe I didn't understand....

Title: Re: LAMW - creating a temporary BMP or PNG file
Post by: Manlio on September 13, 2019, 08:31:10 pm

How do you will create a image "from scratch"?


For example, I use jWebView.LoadFromString() and in the HTML page I want to include some images, for example some statistics. So, I want to generate an image with statistics, where I draw all the things I want to show, and save that image in a temporary file. And I link to that file with an <IMG > tag inside the HTML code that I send to that jWebView.

If I was in Windows, I would create a TBitmap object, set width and height, paint on the canvas, and then save it to a file.

In other words, a non-visual component  (or library) that allows me to create an image file, set width and height, draw text and images on it, and then save it to a file.

Thanks!
Title: Re: LAMW - creating a temporary BMP or PNG file
Post by: jmpessoa on September 13, 2019, 08:55:40 pm

Ok!

I will try implement some demo!