New topic: 

Clear PictureCanvas?

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

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        tseyfarth          Post subject: Clear PictureCanvas?Posted: Sun 
Oct 16, 2011 6:28 pm                         
Joined: Sat Dec 04, 2010 9:14 pm
Posts: 376                Hello all,

Can anyone tell me a fast method to clear the picture canvas?

Thank you
Tim   
                             Top                 Jason_Adams          Post 
subject: Re: Clear PictureCanvas?Posted: Sun Oct 16, 2011 8:40 pm               
                  
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 958
Location: Michigan, USA                Not sure what's you're asking here...

Do you have a canvas that you want to have the picture removed from?

Do you have a Picture object, the graphics of which you want cleared?

Or something else?     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2011r3

"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top                 tseyfarth          Post 
subject: Re: Clear PictureCanvas?Posted: Sun Oct 16, 2011 9:08 pm               
          
Joined: Sat Dec 04, 2010 9:14 pm
Posts: 376                I am using a monkeybread Network screenshot sample.
I want to clear the Picture Canvas, before the new image is placed on it.

This code is executed in the 
Code:ReceivedMessage Sub
  p=JPEGStringToPictureMBS(data,true)
  'd=new date
  'info.text=Format(lenb(data)/1024,"0")+" Kilobytes, received "+d.longtime
  if p<>nil then
  out.zeige p
  pic=p
  buf=data
  end if
  out.Refresh



This code is in the Canvas Object (called PictureCanvas)
Code:Sub Paint (g As Graphics)
  dim ph,pw as Integer
  dim f as Double
  dim x,y as Integer
  
  
  
  if pic<>nil then
  pw=pic.Width
  ph=pic.Height
  
  f=min(g.width/pw,g.Height/ph)
  
  pw=f*pw
  ph=f*ph
  
  x=(g.Width-pw)/2
  y=(g.height-ph)/2
  
  g.DrawPicture pic,x,y,pw,ph,0,0,pic.Width,pic.Height
  end if
End sub



Sub Zeige(p as picture)
  
  pic=p
  Refresh
End sub


I tried several methods, but nothing seems to work, including clear rectangle.

Any ideas?

Thanks
Tim   
                             Top                 kermit          Post subject: 
Re: Clear PictureCanvas?Posted: Sun Oct 16, 2011 11:59 pm                       
  
Joined: Mon May 30, 2011 12:56 am
Posts: 215                I gave up using clear  some years ago, as it was 
unpredictable for me

try this:

g.forecolor = &cffffff
g.fillrect 0,0,g.width,g.height
g.DrawPicture pic,x,y,pw,ph,0,0,pic.Width,pic.Height   
                             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