Page 1 of 1

Transparent image

Posted: Thu Aug 12, 2004 7:25 am
by alanuk
I am trying to get a transparent image to appear on top of a gadget image to display a grid. But it wont display the grid. Tried everything I can think of but no success. Later I want to switch the grid on and off.

Any ideas most welcomed. The code is below.

Alan

Procedure DrawGrid()
; Draw grid on transparent layer image
CreateImage(5,300,300)
UseImage(5)
StartDrawing(ImageOutput())
For x = 0 To 100 Step 5
For y = 0 To 100 Step 5
Line(89,130+y,100,0,RGB(0,0,155))
Line(89+x,130,0,100,RGB(0,0,155))
Next y
Next x
X2D_DrawTransparentImage(UseImage(5),1,1,0)
StopDrawing()
SetGadgetState(#Gadget_Form1_ImageWork, UseImage(5))
EndProcedure

Posted: Sun Aug 15, 2004 8:02 am
by syntax error
Does this work?

Code: Select all

Procedure DrawGrid() 
 ; Draw grid on transparent layer image 
 CreateImage(5,300,300) 
 UseImage(5) 
 StartDrawing(ImageOutput())
 X2D_DrawTransparentImage(UseImage(5),1,1,0) 
 For g=0 To 300 Step 5
   Line(g,0,g,300,RGB(0,0,155))
   Line(0,g,300,g,RGB(0,0,155))
 Next
 StopDrawing() 
 SetGadgetState(#Gadget_Form1_ImageWork, UseImage(5)) 
EndProcedure

Posted: Sun Aug 15, 2004 11:08 am
by freedimension
syntax error wrote:Does this work?

Code: Select all

Procedure DrawGrid() 
 ; Draw grid on transparent layer image 
 CreateImage(5,300,300) 
 UseImage(5) 
 StartDrawing(ImageOutput())
 X2D_DrawTransparentImage(UseImage(5),1,1,0) 
 For g=0 To 300 Step 5
   Line(g,0,g,300,RGB(0,0,155))
   Line(0,g,300,g,RGB(0,0,155))
 Next
 StopDrawing() 
 SetGadgetState(#Gadget_Form1_ImageWork, UseImage(5)) 
EndProcedure
:?:
I think you don't get the point here ;-)

The Problem btw. is already solved via PM, the solution is, that he's trying to draw an image over itself. Right way would be to first draw the grid on a seperate image and then draw this image on the destination image in another StartDrawing block.