New topic: 

Saving a canvas as a jpeg file

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

       Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic         Author  
Message       BigCarl           Post subject: Saving a canvas as a jpeg 
filePosted: Wed Jan 27, 2010 1:39 pm                        
Joined: Tue Sep 19, 2006 10:30 am
Posts: 41
Location: Xalapa, Veracruz, Mexico              I am trying to save what i have 
drawn on a canvas as a jpeg file.  i tried the code below and it causes a break 
on exception at the  f.SaveAsPicture p, 0 line.

what do i change?  thx

  dim p as picture
  dim g as Graphics
  Dim f as FolderItem
  Dim intWidth, intHeight As Integer
  
  '  Create a new picture of the same dimensions.
  intWidth = Canvas.Width
  intHeight = Canvas.Height
  p = newpicture(intWidth,intHeight,32)
  
  ' Use .drawinto to get the window to draw itself onto your picture.
  Canvas.DrawInto  p.Graphics,0,0
  
  f.SaveAsPicture p, 0  '151 was tried also.  either one resulted in a break on 
exception.   
                            Top               timhare           Post subject: 
Re: Saving a canvas as a jpeg filePosted: Wed Jan 27, 2010 1:44 pm              
          
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 7173
Location: Portland, OR  USA              As posted, f is nil.  You need to get 
a folderitem to save to, either with GetFolderItem or by prompting the user 
with GetSaveFolderItem.   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 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