Recent

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

Manlio

  • Full Member
  • ***
  • Posts: 164
  • 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: 2301
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

  • Full Member
  • ***
  • Posts: 164
  • 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: 2301
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

  • Full Member
  • ***
  • Posts: 164
  • 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: 2301
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

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: LAMW - creating a temporary BMP or PNG file
« Reply #6 on: September 28, 2019, 11:56:41 pm »

Hi, Manlio!

You can try the new demo: "AppDrawingInBitmap"

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

Manlio

  • Full Member
  • ***
  • Posts: 164
  • Pascal dev
Re: LAMW - creating a temporary BMP or PNG file
« Reply #7 on: September 29, 2019, 11:49:30 pm »
Thank you so much!

I will study the example and try to learn from it.

(And maybe ask some more questions later on... :)

Again thank you so much, very very appreciated!

Manlio
manlio mazzon gmail

 

TinyPortal © 2005-2018