Main Menu

News:

SyntaxBoom, now with pwetty syntax highlighted code boxes! \o/ 

https://www.syntaxboom.com/forum/index.php?topic=96

Shoutbox

Dabzy

Today at 17:36:22
Well, just have to keep an eyes, even though they said they sorted it like

Jackdaw

Today at 17:22:26
When I saw it. It was in the very early hours when normal people are fast asleep. Lasted for around half an hour before back to normal.

Dabzy

Today at 15:02:27
First time I seen it, having me cuppa at work and had a browse... Saw it and I was like "WTF is that!?!", so got on the blower!

Baggey

Today at 11:22:52
Oh goody. Was getting withdraw symptons!

Jackdaw

Today at 10:38:44
I saw that the other week, and forgot to query it. Redirects to sedo.parking.

Dabzy

Today at 10:33:24
Seems we lost the site for a bit there, sorted, basically htaccess went a bit screwy and it was diverting to one of them stupid default search pages... Been on to ionos the host provider and they fixered it! \o/ Had meself a bit of a sweat on there!  ;D

Jackdaw

2025-10-16, 20:00:40
Going to have to try bourbon and beans. That should be an explosive combination.

Baggey

2025-10-16, 13:15:42
I sometimes mix a chicken vindaloo and a Tika Masala together. Awesome  :P

Dabzy

2025-10-16, 05:49:34
And doing the act was the realisation I went for an indian when out... 20mins I was in the thunderbox waiting for me back chaff to cool down!

Dabzy

2025-10-16, 05:48:11
When I was on my "Year On The Blur", aka drinking after getting divorced, I was minging one night, couldnt remember getting home. Anyway, next day, went to work, and needed a poo...

Members
Stats
  • Total Posts: 1,816
  • Total Topics: 226
  • Online today: 29
  • Online ever: 232 (Oct 08, 2025, 09:18 AM)
Users Online
  • Users: 0
  • Guests: 13
  • Total: 13
Welcome to SyntaxBoom. Please login or sign up.

Recent

RenderImage() together with MaxGui

Started by Midimaster, Aug 30, 2025, 09:11 AM

Previous topic - Next topic

Midimaster

I asked myself if it is possible to render Draw... commands direct to an image instead of the screen. Therefore we have SetRenderImage() which redirects all drawing command to an TImage. But does this also work with MaxGui and Canvases?

Yes it works. Here is an example code:

SuperStrict

Import MaxGui.Drivers
Global Window:TGadget = CreateWindow( "SetRenderImage Demo", 100, 100, 900, 600, Null )
Global Canvas:TGadget = CreateCanvas(100,5,775,590, Window)
Global Render:TRenderImage = CreateRenderImage(320, 200, False)
Global i:Int
ManipulateImage
CreateTimer 60
Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End 
		Case EVENT_TIMERTICK
			DrawAll
			If i Mod 60 =0 Then ManipulateImage
	End Select
Forever

Function DrawAll()
	I:+1
	SetGraphics CanvasGraphics(Canvas)
	SetClsColor 111,111,231
	Cls
    DrawImage Render, i, 100
	Flip 
End Function 


Function ManipulateImage()
	SetGraphics CanvasGraphics(Canvas)
	SetClsColor 200,255,200
	SetRenderImage Render
	Cls
	SetColor 1,1,1
	DrawText Rand(12345,23456),100,100
	SetRenderImage Null
	SetColor 255,255,255
End Function 

Of course this will also work without MaxGui. Here is a minimalistic example:

SuperStrict
Graphics 800,600
Global Render:TRenderImage = CreateRenderImage(320, 200, False)
Global i:Int
ManipulateImage

Repeat
	I:+1
	SetClsColor 111,111,231
	Cls
    DrawImage Render, i, 100
	Flip 1

	If i Mod 60 =0 Then ManipulateImage

Until AppTerminate()

Function ManipulateImage()
	SetClsColor 200,255,200
	SetRenderImage Render
	Cls
	SetColor 1,1,1
	DrawText Rand(12345,23456),100,100
	SetRenderImage Null
	SetColor 255,255,255
End Function


Dabzy

Yep, render targets are really handy things, which is what I liked about Blitz's old school "image buffers", you could just swap the drawing buffer from the back buffer to an image buffer and bingo.

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!