Transparent image

Just starting out? Need help? Post your questions and find answers here.
alanuk
User
User
Posts: 68
Joined: Mon Oct 13, 2003 6:38 pm

Transparent image

Post 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
syntax error
User
User
Posts: 93
Joined: Tue Jan 13, 2004 5:11 am
Location: Midlands , UK

Post 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
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post 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.
Post Reply