SetMaskColor in Canvas

BlitzMax Forums/BlitzMax Beginners Area/SetMaskColor in Canvas

GameScrubs(Posted 2006) [#1]
For some reason the SetMaskColor is not making the color i choose transparent on a MaxGui Canvas. Is this possible?


Diablo(Posted 2006) [#2]
i did have this problem And got around it by doing a Graphics setup.. somthing like:
     SetGraphics CanvasGraphics(mainRenderView)
     SetMaskColor 255, 0, 255

i think you CAN only do this once so i opt todo it when you create the canvas.

i would have a look a the sample programs tho. have a look out at the rockout_gui one and your see what i mean

edit: search for the line that says SetGraphics CanvasGraphics (canvas) most of whats after this is all graphics setup just like you would normally do.


GameScrubs(Posted 2006) [#3]
hmm I tried that and it's not working for me. The thing is that I'm using the same images and code for another program that is not gui and it works fine.


GameScrubs(Posted 2006) [#4]
Global gOpen:TImage = LoadImage("incbin::images/StringOpen.png",MASKEDIMAGE|MIPMAPPEDIMAGE)
Global gWin:TGadget=CreateWindow("Recorder", 50,50,800,600, Null, WINDOW_TITLEBAR | WINDOW_STATUS | WINDOW_CLIENTCOORDS)
Local canvas_Buttons:TGadget	= CreateCanvas(0,0,496,430,pnl_Canvas)

Local tmr_Paint:TTimer			= CreateTimer(60)

SetGraphics CanvasGraphics(canvas_Buttons)				
SetBlend ALPHABLEND 
SetClsColor 0,0,0
SetMaskColor 255, 0, 255

Repeat

	WaitEvent()
	
	'---[ Process Event ]---
	Select EventID()	   			
		'---[ Timer ]---
		Case EVENT_TIMERTICK
			RedrawGadget(canvas_Buttons)
		
		'---[ Paint Gadgets ]---
		Case EVENT_GADGETPAINT
			
			'---[ Button Canvas ]---
			If EventSource () = canvas_Buttons
			
				
				
				'---[ Display Button GFX ]---	    			
				Cls
				   	SetColor  0,255,0							
		                       DrawImage gOpen,15,15
	    		Flip
			EndIf
          End Select

Forever	



assari(Posted 2006) [#5]
I think you need to move your loadimage statement to after the SetMaskColor line like so
SetGraphics CanvasGraphics(canvas_Buttons)
SetBlend ALPHABLEND 
SetClsColor 0,0,0
SetMaskColor 255, 0, 255
Global gOpen:TImage = LoadImage("incbin::images/StringOpen.png",MASKEDIMAGE|MIPMAPPEDIMAGE)

by the way, I see that you've grouped your canvas to pnl_canvas. I can't see where this was defined


GameScrubs(Posted 2006) [#6]
yeah I cut the code out, there was too much of it. I'll try your suggestion later on today.

Thx

RAFF


GameScrubs(Posted 2006) [#7]
Oddly enough that worked assari thx for the help