Recent

Author Topic: LAMW - creating a temporary BMP or PNG file  (Read 271 times)

Manlio

  • New Member
  • *
  • Posts: 44
  • Pascal dev
LAMW - creating a temporary BMP or PNG file
« 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!
manlio mazzon gmail

jmpessoa

  • Hero Member
  • *****
  • Posts: 1435
Re: LAMW - creating a temporary BMP or PNG file
« Reply #1 on: September 11, 2019, 03:31:50 pm »


You can try the demo "AppDrawingViewDemo1"
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Manlio

  • New Member
  • *
  • Posts: 44
  • Pascal dev
Re: LAMW - creating a temporary BMP or PNG file
« Reply #2 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!

manlio mazzon gmail

jmpessoa

  • Hero Member
  • *****
  • Posts: 1435
Re: LAMW - creating a temporary BMP or PNG file
« Reply #3 on: September 13, 2019, 06:25:52 pm »

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

maybe I didn't understand....

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Manlio

  • New Member
  • *
  • Posts: 44
  • Pascal dev
Re: LAMW - creating a temporary BMP or PNG file
« Reply #4 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!
« Last Edit: September 14, 2019, 11:11:06 am by Manlio »
manlio mazzon gmail

jmpessoa

  • Hero Member
  • *****
  • Posts: 1435
Re: LAMW - creating a temporary BMP or PNG file
« Reply #5 on: September 13, 2019, 08:55:40 pm »

Ok!

I will try implement some demo!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard