Re: NSTextView drawing over super problem
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