• 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
pattern fills -- can they be origined differently?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pattern fills -- can they be origined differently?


  • Subject: pattern fills -- can they be origined differently?
  • From: Kirk Kerekes <email@hidden>
  • Date: Sun, 14 Jul 2002 21:01:45 -0500

I found this and similar questions several places in mamasam, but no useful answers. So, to start off the week:

1. How can one use NSColor patterns as a background/ornament, when they are locked to the _bottom_ of the _window_ frame, and so drift around disconcertingly when the window is resized?

2. How does Apple do it? Are the window frames/backgrounds being drawn in Carbon/QuickDraw? Composited as NSImages somewhere?

3. Why, when the pattern shifts with the window resize, does it jerk in 8-pixel chunks, instead of moving smoothly?

3a. And why does it _not_ jerk sometimes, possibly depending on the pattern?

Anyone who wants to explore this, create a window in IB, embed a custom NSView class called, say "PatternFilledView", and set the size-springs so that it is vertically resized by window resizing.

Then create a PatternFilledView class in PB with the following methods:

--------------------------------------------------------

static NSColor * pattern; // a shared instance.

- (void) awakeFromNib
{
if(!pattern)
{
NSImage * patImage = [NSApp applicationIconImage];
pattern = [NSColor colorWithPatternImage:patImage];
[pattern retain];
}
}

- (void)drawRect:(NSRect)rect
{
[pattern set];
[NSBezierPath fillRect:rect];
}

// and optionally:

- (BOOL) isOpaque
{
return NO;
}

---------------------------------------------------------

Compile, run, resize the window.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: OpenStep for Enterprises
  • Next by Date: Instantly Releasing Window Controller...
  • Previous by thread: Re: OpenStep for Enterprises
  • Next by thread: Instantly Releasing Window Controller...
  • Index(es):
    • Date
    • Thread