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
Transparent image
-
- User
- Posts: 93
- Joined: Tue Jan 13, 2004 5:11 am
- Location: Midlands , UK
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
-
- Enthusiast
- Posts: 613
- Joined: Tue May 06, 2003 2:50 pm
- Location: Germany
- Contact:
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.