Re: Weird drawing trouble, please help me
Re: Weird drawing trouble, please help me
- Subject: Re: Weird drawing trouble, please help me
- From: John Stiles <email@hidden>
- Date: Sun, 01 Oct 2006 11:19:15 -0700
To make a suggestion, I would need to know what your ultimate goal is.
Alan Smith wrote:
What would you suggest?
On 9/30/06, John Stiles <email@hidden> wrote:
You shouldn't be overriding private calls. Even if you can get it to
work now, it will probably break in the future when Apple makes changes
to their implementation.
I think you should try a different approach.
Alan Smith wrote:
> I've made a subclass of NSProgressIndicator and it works very well,
> except for the "scrolling" effect that it usually has. Here is my
> code:
>
> - (void)_drawProgressArea
> {
> if (progressOrigin >= [progressImage size].width)
> {
> progressOrigin = 0.0;
> }
> else
> {
> progressOrigin += 1.0;
> }
>
> NSRect drawRect = [self _getProgressFrame];
> drawRect.origin.x -= progressOrigin;
> drawRect.size.width += progressOrigin;
>
> if (progressImage == nil)
> {
> [self updateImages];
> }
>
> [self lockFocus];
> [progressImage tileInRect: drawRect];
> [self unlockFocus];
> }
>
> tileInRect: simply tiles the image side ways across the rect and seems
> to work fine. But the trouble seems to be that the drawRect.size.width
> += progressOrigin; is not working. Even though I've NSLogged it and it
> does increase in size. But if I comment it out nothing changes, it
> still doesn't draw correctly. This "drawing trouble" is that the
> rectangle seems to move over because on screen the picture does but
> the last picture "smears." It looks like the picture is drawn on top
> of itself but 1 pixel over to the left each time. I don't want that
> smeary look. Instead of that smear should appear the edge of another
> picture, same as the rest, and slide with the others.
>
> Below is - (void)tileInRect:(NSRect)rect for completeness.
>
> - (void)tileInRect:(NSRect)rect
> {
> float origin = rect.origin.x;
> float width = [self size].width;
>
> NSRect bounds = NSMakeRect(0, 0, [self size].width, [self
> size].height);
>
> while (origin <= (NSWidth(rect) + rect.origin.x))
> {
> [self drawInRect: NSMakeRect(origin, 0, width, NSHeight(rect))
> fromRect: bounds operation: NSCompositeSourceOver fraction: 1.0];
>
> origin += width;
> }
> }
>
> I will *greatly* appreciate help. Note that I'm not putting my code up
> for critue but simply to resolve my current problem.
> Peace, Alan
_______________________________________________
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