• 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
Scaling view and draw one pixel line
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scaling view and draw one pixel line


  • Subject: Scaling view and draw one pixel line
  • From: Lorenzo <email@hidden>
  • Date: Sun, 24 Sep 2006 17:39:43 +0200

Hi,
I need to scale my view horizontally only and I want that a rectangle inside
this view still looks with a "one pixel width" border. It almost work well,
but sometimes I cannot see the border. What do I miss?

When I change the scaleFactor I do:
------------------------------------------------------
    scaleFactor  = [sender floatValue];
    oneSize = NSMakeSize(1.0, 1.0);
    oldSize = [aView convertSize:oneSize fromView:[aView superview]];
    newSize = NSMakeSize(oldSize.width / scaleFactor, 1.0);
    [aView scaleUnitSquareToSize:newSize];

    frameSize = NSMakeSize(gWidth / scaleFactor, [aView frame].size.height)
    [aView setFrameSize:frameSize];
    [aView setNeedsDisplay:YES];


In the drawRect method of the rectangle subview I do:
------------------------------------------------------
        // I fill the rectangle with blue
        NSRect  theBounds = [self bounds];
        [[NSColor blueColor] set];
        NSRectFill(theBounds);

        // So I fill the insect rectangle with white
        [[NSColor whiteColor] set];
        NSRectFill(NSInsetRect(theBounds, 1.0f * scaleFactor, 1.0f));


Best Regards
--
Lorenzo
email: email@hidden

 _______________________________________________
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

  • Prev by Date: Re: Obtain computer model
  • Next by Date: Re: Obtain computer model
  • Previous by thread: Re: Re: Obtain computer model
  • Next by thread: nested header files
  • Index(es):
    • Date
    • Thread