New topic: 

Layering Graphics?

<http://forums.realsoftware.com/viewtopic.php?t=46179>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        tseyfarth          Post subject: Layering Graphics?Posted: Sat 
Dec 08, 2012 3:28 pm                         
Joined: Sat Dec 04, 2010 9:14 pm
Posts: 773                Hello all,

I am new to graphics and have been working with a sample I found in 2011R4.3 - 
NetChart. It has multiple shapes, objects by index, text, backcolor and other 
cool stuff that will give a giant head start.

Starting with this, I need to add a background jpeg image.  The objects that 
are created in the NetChart example, need to be drawn on top of the background.

Can anyone tell or show me how to do this?  I have been messing with this all 
day, without any good results.

Thanks
Tim   
                             Top                charonn0          Post subject: 
Re: Layering Graphics?Posted: Sat Dec 08, 2012 3:48 pm                          
       
Joined: Mon Apr 02, 2007 2:08 am
Posts: 1030
Location: San Francisco, CA, USA                The drawing is done in the 
NetCanvas.Paint event into an offscreen buffer Picture called off.

Sub Paint(g As Graphics)
  dim i as integer
  
  'These three lines draw a backgroud with a solid color onto the 'off' picture 
object
  off.graphics.forecolor=bgcolor
  off.graphics.fillrect 0,0,width,height
  off.graphics.forecolor=nodecolor
  
  for i=1 to ubound(links)
  drawlink i 'Draws the lines onto the 'off' picture object
  next
  
  for i=1 to ubound(nodes)
  drawnode i 'Draws the nodes onto the 'off' picture object
  next
  
  g.DrawPicture off, 0, 0 'Draws the 'off' picture object onto the Canvas
End Sub



To show a background image, you can replace the code that draws the grey 
background with code that draws a Picture into the background:

Sub Paint(g As Graphics)
  dim i as integer
  
  off.graphics.DrawPicture(MyBackgroundPic, 0, 0) 'Draw the background Picture 
onto the 'off' Picture object
  
  for i=1 to ubound(links)
  drawlink i 'Draws the lines onto the 'off' picture object
  next
  
  for i=1 to ubound(nodes)
  drawnode i 'Draws the nodes onto the 'off' picture object
  next
  
  g.DrawPicture off, 0, 0 'Draws the 'off' picture object onto the Canvas
End Sub
      
_________________
Boredom Software  
                             Top                jakuno          Post subject: 
Re: Layering Graphics?Posted: Sat Dec 08, 2012 3:51 pm                         
Joined: Fri Aug 31, 2012 3:56 pm
Posts: 26                Look at this sample: 
https://dl.dropbox.com/u/103694210/NetChart2.rbp.zip   
                             Top                tseyfarth          Post 
subject: Re: Layering Graphics?Posted: Sat Dec 08, 2012 3:59 pm                 
        
Joined: Sat Dec 04, 2010 9:14 pm
Posts: 773                Way COOL! 

Thank you both so very much!  I figured it was simple, and it was/is.  Just 
have to undestand what all is going on first.

Thank you again!
Tim   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to