• 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: NSTextView drawing over super problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView drawing over super problem


  • Subject: Re: NSTextView drawing over super problem
  • From: Antonio Nunes <email@hidden>
  • Date: Mon, 10 Jul 2006 05:20:37 +0100


On 10 Jul 2006, at 04:50, John Cassington wrote:

I would like to overlay an image of a circle to show page
numbers, but it must be over the text. This (i presume) means that i have to
call [super drawRect...] before i draw the image. I have tried this but it
is still not working


Here is my sample code...

-(void)drawRect:(NSRect)rect {
      NSRect wholeRect = [self bounds];
      [...]
         [circleImage drawAtPoint:NSMakePoint(0,0) fromRect:wholeRect
operation:NSCompositeSourceOver fraction:1.0];
}

Check the documentation on drawAtPoint:fromRect:operation:fraction

Specifically:
srcRect
The source rectangle specifying the portion of the image you want to draw. The coordinates of this rectangle are specified in the image's own coordinate system.

You are passing the rectangle of your view's bounds in fromRect, not the rectangle of your image, which would be something like NSMakeRect (0, 0, [circleImage size].width, [circleImage size].height) to show the whole image


-António

-----------------------------------------------------------
And you would accept the seasons of your
heart, even as you have always accepted
the seasons that pass over your field.

--Kahlil Gibran
-----------------------------------------------------------



_______________________________________________
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


References: 
 >NSTextView drawing over super problem (From: "John Cassington" <email@hidden>)

  • Prev by Date: NSTextView drawing over super problem
  • Next by Date: Re: Objects as keys NSMutableDictionary
  • Previous by thread: NSTextView drawing over super problem
  • Next by thread: Creating Transparent Window on Dock Icon
  • Index(es):
    • Date
    • Thread