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

Doubled Pixels


  • Subject: Doubled Pixels
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Fri, 23 Jun 2017 22:45:56 +0700

macOS 12.5

I try to make a sub image (subRect has size 32 x 32) like:

NSRect pubRect = NSZeroRect; pubRect.size = subRect.size;
NSImage *subImage = [ [NSImage alloc] initWithSize: subRect.size ];

[ subImage lockFocus ];
[ self.image    drawAtPoint:    NSMakePoint(0, 0)
                                fromRect:               subRect
                                operation:
NSCompositingOperationCopy
                                fraction:               1
];
NSBitmapImageRep *oneRep = [ [ NSBitmapImageRep alloc ]
initWithFocusedViewRect: pubRect ];
[ subImage unlockFocus ];

NSData *subData = [ oneRep representationUsingType: NSPNGFileType  properties:
@{} ];

the image looks fine, but when I write subData to disk, it has 64 x 64 pixels.

How can this doubling of pixels be avoided?

Gerriet.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Doubled Pixels
      • From: Graham Cox <email@hidden>
    • Re: Doubled Pixels
      • From: Jens Alfke <email@hidden>
  • Prev by Date: MKMapView userLocation heading & a dropped pin
  • Next by Date: Re: Doubled Pixels
  • Previous by thread: Re: MKMapView userLocation heading & a dropped pin
  • Next by thread: Re: Doubled Pixels
  • Index(es):
    • Date
    • Thread