FROM : Ben Lachman
DATE : Fri Feb 29 20:55:26 2008
Well, I finally was able to get this solved, but not to my
satisfaction. What I'm having to do is this:
if( ! NSContainsRect(rect, [self visibleRect]) && ! NSEqualRects
(rect,[self visibleRect]) ) {
[self setNeedsDisplayInRect:[self bounds]];
[self displayIfNeededIgnoringOpacity];
return;
}
which in my opinion is a really dirt hack and I'd love to find a
better (real?) solution. I'm pretty sure I'm just drawing twice
between flushing the buffer, but I'm not sure how to debug it or
prevent it. Anyone run into something like this?
Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
<email_removed>
740.590.0009
On Feb 21, 2008, at 1:23 AM, Ben Lachman wrote:
> I have a text view that contains a custom view which in turn
> contains an imageview and draws an image and a drop shadow. During
> selection the bits of the view which are not fully opaque (the
> shadow and the image) sometimes draw twice, producing a darker
> shadow than I want. This seems to alternate with normal looking
> drawing, so when I select text the shadow flickers between regular
> and darker along with the other non-opaque bits in the image. My
> method for drawing the shadow looks like this:
>
> - (void)drawRect:(NSRect)rect {
> NSAffineTransform *xform = [NSAffineTransform transform];
>
> [NSGraphicsContext saveGraphicsState];
>
> [xform translateXBy:imageViewOrigin.x yBy:imageViewOrigin.y];
> [xform rotateByDegrees:rotation];
> [xform concat];
>
> NSShadow *imageShadow = [[NSShadow alloc] init];
> [imageShadow setShadowOffset:NSMakeSize(0,-5)];
> [imageShadow setShadowBlurRadius:5];
> [imageShadow setShadowColor:[NSColor blackColor]];
>
> [imageShadow set];
> [[NSColor whiteColor] set];
> [NSBezierPath fillRect:[imageView bounds]];
> [NSGraphicsContext restoreGraphicsState];
>
> [imageShadow release];
> }
>
> I should note that the selection area does not overlap the view
> (custom shaped text container). Anyone have any ideas as to what
> might be going wrong?
DATE : Fri Feb 29 20:55:26 2008
Well, I finally was able to get this solved, but not to my
satisfaction. What I'm having to do is this:
if( ! NSContainsRect(rect, [self visibleRect]) && ! NSEqualRects
(rect,[self visibleRect]) ) {
[self setNeedsDisplayInRect:[self bounds]];
[self displayIfNeededIgnoringOpacity];
return;
}
which in my opinion is a really dirt hack and I'd love to find a
better (real?) solution. I'm pretty sure I'm just drawing twice
between flushing the buffer, but I'm not sure how to debug it or
prevent it. Anyone run into something like this?
Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
<email_removed>
740.590.0009
On Feb 21, 2008, at 1:23 AM, Ben Lachman wrote:
> I have a text view that contains a custom view which in turn
> contains an imageview and draws an image and a drop shadow. During
> selection the bits of the view which are not fully opaque (the
> shadow and the image) sometimes draw twice, producing a darker
> shadow than I want. This seems to alternate with normal looking
> drawing, so when I select text the shadow flickers between regular
> and darker along with the other non-opaque bits in the image. My
> method for drawing the shadow looks like this:
>
> - (void)drawRect:(NSRect)rect {
> NSAffineTransform *xform = [NSAffineTransform transform];
>
> [NSGraphicsContext saveGraphicsState];
>
> [xform translateXBy:imageViewOrigin.x yBy:imageViewOrigin.y];
> [xform rotateByDegrees:rotation];
> [xform concat];
>
> NSShadow *imageShadow = [[NSShadow alloc] init];
> [imageShadow setShadowOffset:NSMakeSize(0,-5)];
> [imageShadow setShadowBlurRadius:5];
> [imageShadow setShadowColor:[NSColor blackColor]];
>
> [imageShadow set];
> [[NSColor whiteColor] set];
> [NSBezierPath fillRect:[imageView bounds]];
> [NSGraphicsContext restoreGraphicsState];
>
> [imageShadow release];
> }
>
> I should note that the selection area does not overlap the view
> (custom shaped text container). Anyone have any ideas as to what
> might be going wrong?
| Related mails | Author | Date |
|---|---|---|
| Ben Lachman | Feb 21, 07:23 | |
| Ben Lachman | Feb 29, 20:55 | |
| Ken Ferry | Feb 29, 23:52 | |
| Ben Lachman | Mar 2, 22:02 | |
| Uli Kusterer | Mar 3, 11:38 | |
| Ben Lachman | Mar 5, 22:22 | |
| Ben Lachman | Mar 14, 09:11 | |
| Uli Kusterer | Mar 14, 13:11 | |
| Uli Kusterer | Mar 14, 13:34 | |
| Uli Kusterer | Mar 14, 13:54 | |
| Jean-Daniel Dupas | Mar 14, 14:09 | |
| Ben Lachman | Mar 14, 18:13 |






Cocoa mail archive

