Main Menu

News:

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

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

Shoutbox

GfK

Today at 17:45:33
My mop and bucket was £30. 🤨 It's a Vileda one and you stick it in the bucket and press a pedal with your foot and it spins round and dries the mop out AND IT'S BRILLIANT! 👌

Dabzy

Today at 16:19:35
Oh, I can give you a tip right now, no need to wait... Ahem... Pay someone a fiver to do it, even the bucket was a chew! :D ;)

Jackdaw

Today at 16:04:05
Well if the occasion should ever arise, where I need to gift wrap a mop and bucket. I know where to get tips from ;)

Dabzy

Today at 14:24:38
Has anyone ever tried to wrap up a mop? Never again! :D

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!

Members
Stats
  • Total Posts: 1,826
  • Total Topics: 226
  • Online today: 23
  • 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!