Can an image be used like a stencil?
Posted: Sat Aug 29, 2015 4:03 pm
				
				I thought that if I created a full-screen image and drew transparent text on it, that it could be saved as a .png (with alpha information intact) and used as a stencil. I would then load a patterned image, set GRAPHICS MODE CLEAR, and draw my stencil image onto the pattern. I thought that this would leave me with just some pattern-filled letters, but in fact it left me with a transparent screen. It seems that the transparent portion of the stencil still drew transparency, although I thought it wouldn't. Is there a flaw in my logic?
			Code: Select all
F$="testimage"
ALBUM IMPORT F$                                    ' choose a pattern
GRAPHICS
GRAPHICS CLEAR 0,0,1                               ' make a color background     
GRAPHICS MODE CLEAR
DRAW FONT NAME "ArialMT"
DRAW FONT SIZE 200
DRAW TEXT "Hullabaloo" AT 50,200                   ' draw transparent text
GRAPHICS SAVE 0,0, 1024,768 TO "stencil.png"      ' save image with alpha data
GRAPHICS MODE NORMAL
DRAW IMAGE F$ AT 0,0 SCALE 1                       ' draw the patterned image
GRAPHICS MODE CLEAR
DRAW IMAGE "stencil1.png" AT 0,0 SCALE 1 'ANGLE A  ' draw the stencil
GRAPHICS SAVE 0,0, 1024,768 TO "final.png"
PAUSE 30