Hi all,

for some weird reason, I wanted to draw a balloon (like in Comic Strips) on top of another image in the _SAME_ Canvas... an without getting white background where I want it to be transparent...

REALbasic 2005r4 Pro
Mac OS X 10.3.9

This is very easy, you could say, but it ain't really so easy...

I fall into all kinds of traps until I get right...

Here I go:

Put a Canvas on a Window,
Drag a Balloon image (a non rect image; round, star, whatever, but not round!) from the disk onto the project tab,
Add drag and drop (drop) feature to the Canvas,

In Canvas1.MouseDown, put the following code:


Function MouseDown(X As Integer, Y As Integer) As Boolean
  // Work-around Picture Object Instance
  Dim BHPict As Picture // A Balloon Picture Holder...

  // Create a Picture
  BHPict = New Picture(250,238,32) // That's the size of my Balloon

  // Draw BalloonLeft in BHPict
  BHPict.Graphics.DrawPicture BalloonLeft,0,0

  // Set the Picture as Transparent
  BHPict.Transparent = 1 // 1 = Transparent

  // Draw the Picture (centered below the X,Y Click Point)
  Me.Graphics.DrawPicture BHPict,X - (BHPict.Width \ 2),Y-(BHPict.Height \ 2)
End Function


now, when you click, you 'paste' a non rect balloon help and no weird white is draw on the external of the balloon help !


The most important part is to draw the Ballon (which is in the project tab) into another Picture, else that is the rectangle that holds the Balloon that is draw (including white on the external of the Balloon...)...

HTH,

Emile


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to