• 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
Re: Transparency in NSButtonCell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparency in NSButtonCell


  • Subject: Re: Transparency in NSButtonCell
  • From: Andreas Mayer <email@hidden>
  • Date: Sun, 17 Jul 2005 01:27:56 +0200


Am 17.07.2005 um 00:55 Uhr schrieb Matt Ball:

Rather than retooling my setup to include [self path] and [self
setPath:], is there any reason this wouldn't work: (because when I use
it, nothing is drawn...)

- (void)drawRect:(NSRect)rect {
    if(!roundRectHasBeenFilled) {
        [self drawRoundRectWithFrame:[self bounds]];
    }
}

Yes, there is. You simply don't draw anything except for the first time drawRect: is called.


Also, drawRect: might be called frequently, so you should try to minimize the work done there. Why create and destroy all those objects (colors, shadows, bezier paths ...) over and over again when they will stay the same as long as the window's size does not change.

        if(rect.origin.y <= 19)
            [[NSColor colorWithCalibratedWhite:0.2 alpha:0.7] set];
        else
            [[NSColor colorWithCalibratedWhite:0.05 alpha:0.7] set];
        NSRectFill(rect);

I don't think this will work in all situations.

What if rect is something like {0, 12, 200, 50}?


Andreas _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Transparency in NSButtonCell
      • From: Matt Ball <email@hidden>
References: 
 >Transparency in NSButtonCell (From: Matt Ball <email@hidden>)
 >Re: Transparency in NSButtonCell (From: glenn andreas <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Matt Ball <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Matt Ball <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Andreas Mayer <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Matt Ball <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Andreas Mayer <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Matt Ball <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Andreas Mayer <email@hidden>)
 >Re: Transparency in NSButtonCell (From: Matt Ball <email@hidden>)

  • Prev by Date: Re: Base Conversion?
  • Next by Date: Re: how to be aware of clicking on dock icon
  • Previous by thread: Re: Transparency in NSButtonCell
  • Next by thread: Re: Transparency in NSButtonCell
  • Index(es):
    • Date
    • Thread