[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: WebDrawingArea to Image
[Thread Prev] | [Thread Next]
- Subject: Re: WebDrawingArea to Image
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Tue, 14 Jul 2026 21:04:54 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
There is a javascript function in html canvas API , GetImageData https://www.w3schools.com/jsref/canvas_getimagedata.asp There is nothing like that built in to the WebDrawingArea though but you should be able to use javascript for the canvas api. Respects BruceS On Tue, 14 Jul 2026 at 18:44, Olivier Cruilles <olivier.cruilles@xxxxxxxx> wrote: > In fact I would like to get all the <canvas><script>…</script></canvas> > code produced sent to the Web Browser in the way to inject it into an > <iframe></iframe> balise that will be used by the Web Browser to Print it. > > I’m already doing that for any html page I want to print by the Web > Browser but I don’t find a way to catch the WebDrawingArea html+javascript > code sent to the Browser by Gambas. > > Any idea > > > Olivier > > Le 14 juill. 2026 à 11:21, Olivier Cruilles <olivier.cruilles@xxxxxxxx> a > écrit : > > Hello, > > > I would like to create an Image file from the drawing commands I use into > a WebDrawingArea object, like we can do it for DrawingArea object. > It is possible to do it like that ? > > Public Sub Create_Image() > > Dim hImg As New Image(Paint.Width, Paint.Height, Color.White, > Image.Standard) > > Htmldata = WebDrawingAreaCourbe.ToHTML() > > Paint.Begin(hImg) > Paint.Scale(1, 1) > > 'Exemple of code to draw > Paint.LineWidth = 1 > > Paint.Rectangle(50, 50, 150, 150) > Paint.Stroke(Color.Red, True) > Paint.Fill(Color.SetAlpha(Color.SoftBlue, 192)) > > Paint.Rectangle(80, 80, 150, 150) > Paint.Stroke(Color.SetAlpha(Color.Yellow, 64)) > > Paint.Arc(100, 100, 60) > Paint.Fill(Color.Red) > Paint.Rectangle(20, 20, 120, 70) > Paint.Fill(Color.SetAlpha(Color.Royal, 64)) > > Paint.Ellipse(20, 20, 120, 70, 0, -Pi / 2) > Paint.Stroke(Color.Green) > > Paint.Rectangle(40, 80, 120, 70) > Paint.Brush = Paint.LinearGradient(80, 140, 100, 120, [Color.Red, > Color.Green, Color.Violet], [0, 0.5, 1]) > Paint.Fill() > > Paint.Rectangle(60, 90, 120, 70) > Paint.Brush = Paint.LinearGradient(220, 200, 340, 200, [Color.Red, > Color.Green, Color.Violet], [0, 0.5, 1]) > Paint.Fill() > > Paint.Arc(100, 320, 40) > Paint.Brush = Paint.RadialGradient(100, 320, 2, 100, 320, 40, ["red", > "yellow", "lightblue"], [0, 0.6, 1]) > Paint.Fill() > > Paint.End() > > Try hImg.Save("/tmp/imagecourbe.png") > If Error Then > ModLogs.EcrireLogs("Error during image saving ! - Error: " & > Error.Text) > Endif > > End > > I know it's possible with Cairo library too, but through gb.gui.web > component I not sure. > > Any idea ? > > Thank you > > -- Olivier > > > >
| Re: WebDrawingArea to Image | Bruce Steers <bsteers4@xxxxxxxxx> |
| WebDrawingArea to Image | Olivier Cruilles <olivier.cruilles@xxxxxxxx> |
| Re: WebDrawingArea to Image | Olivier Cruilles <olivier.cruilles@xxxxxxxx> |