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 12:17:43
Lol, not the ones from Poundland! :D Anyway, I've got a nice box of chocolates and a Prosecco to go in the bucket! ;)

Jackdaw

Today at 11:18:06
@Dabzy I think they will appreciate it. Have you seen how much it can cost for a good mop and bucket set in this day and age.  I can buy a bottle of Blonde chocolate cream liqueur for less at ASDA.

Dabzy

Today at 10:47:41
Well, I'm off out to buy a 60th birthday pressie... A mam of one of me mates... Gonna get her a mop and bucket, and wrap it up, even wrap the noodly mop bits individually... All in Christmas wrapping paper... Should go down well! :D

Dabzy

2025-10-17, 17:36:22
Well, just have to keep an eyes, even though they said they sorted it like

Jackdaw

2025-10-17, 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

2025-10-17, 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

2025-10-17, 11:22:52
Oh goody. Was getting withdraw symptons!

Jackdaw

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

Dabzy

2025-10-17, 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.

Members
Stats
  • Total Posts: 1,824
  • Total Topics: 226
  • Online today: 19
  • Online ever: 232 (Oct 08, 2025, 09:18 AM)
Users Online
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!