• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Setting the clip, double buffering
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the clip, double buffering


  • Subject: Setting the clip, double buffering
  • From: Candide Kemmler <email@hidden>
  • Date: Thu, 5 Jul 2001 11:50:42 +0200

Hi !

I don't find any clip-setting function for graphics, i.e. functions that set a viewing rectangle outside of which all drawings are discarded.

As of double-buffering, until now, I just didn't care, but then now I get this very annoying bug where I see a path drawn a fraction of a second on the screen, then it disappears forever...

Are there any means to draw to an offscreen buffer before copying it to the screen ? I'd like something like the following java snippet:

Image offImage;
Graphics offPort;
Dimension d:

public void update ( Graphics g ) { paint ( g ); }

public void paint ( Graphics g ) {
if ( offImage == null || d.width != getSize ().width || d.height != getSize ().height ) {
d = getSize ();
offImage = createImage ( d.width, d.height );
offPort = offImage.getGraphics ();
}
// drawing is done to the off-screen graphics:
offPort.setColor ( ... );
GeneralPath gpath = new GeneralPath ();
...
// now, we copy the image to the on-screen graphics:
g.drawImage ( offImage, 0, 0, this );
}

BTW, until now, there's no noticeable performance difference between the Java drawing routine and the Objective-C/C drawing routine under Cocoa...

Regards,

Candide


  • Prev by Date: Loading CFM shlb into a cocoa app
  • Next by Date: Re: Using Custom.plist
  • Previous by thread: RE: Loading CFM shlb into a cocoa app
  • Next by thread: Re: Setting the clip, double buffering
  • Index(es):
    • Date
    • Thread