• 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: Weird drawing trouble, please help me
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Re: Weird drawing trouble, please help me
      • From: "Alan Smith" <email@hidden>
References: 
 >Re: Re: Weird drawing trouble, please help me (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: A bit confused about NSView instances in Interface Builder
  • Next by Date: Re: Bring Window to Front
  • Previous by thread: Re: Re: Weird drawing trouble, please help me
  • Next by thread: Re: Re: Weird drawing trouble, please help me
  • Index(es):
    • Date
    • Thread