• 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
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scaling view


  • Subject: Scaling view
  • From: Lorenzo <email@hidden>
  • Date: Sun, 24 Sep 2006 20:42:28 +0200

Hi,
I scale my NSView horizontally.
Therefore all its subviews look scaled horizontally.
Each subviews has an icon and I need to leave this icon unscaled.
So in the subview drawRect method I re-scale the icon so it will look not
scaled.

    inRect = NSMakeRect(3.0f * scaleFactor, 1.0f,
                        iconWidth * scaleFactor, iconHeight);
    [mIcon drawInRect:inRect fromRect:NSZeroRect
           operation:oper fraction:fraction];

When scaleFactor is > 0.0 (smaller view) the icon looks good.
When scaleFactor is < 0.0 (bigger  view) the icon looks deformed (bad
scaling). I suppose that drawInRect rounds the rect to the integer pixel, so
when the scaling of the superview comes (later) I get a wrong final rect.
How can I avoid this?


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: Custom view background texture/color
  • Next by Date: How to make elements a subview of an existing box?
  • Previous by thread: Re: nested header files
  • Next by thread: How to make elements a subview of an existing box?
  • Index(es):
    • Date
    • Thread