IPAD must-haves. And fun-to-haves.

Brighten your iPad with a colorful cover, stream to your TV, download pictures from your digital camera, and more. There’s already so much you can do with iPad and iPad mini

Apple Wireless Keyboard

The incredibly thin Apple Wireless Keyboard uses Bluetooth technology, which makes it compatible with iPad

Apple unveils iPad mini: ‘Thin as a pencil, light as paper’

iPad inspires creativity and hands-on learning with features you won’t find in any other educational tool

Lightning connector and FaceTime HD camera

Apple announces 4th generation iPad packing an A6X CPU

Pages

Showing posts with label resize. Show all posts
Showing posts with label resize. Show all posts

Tuesday, February 26, 2013

NSImage resizing on retina devices, saving my image into just double size. I want resize should not affected by device type.


I'm developing an app for Mac OS X.


I'm trying to resize any NSImage into a specific size like 200x300. It is working fine for Non-retina Mac.


But For Retina Mac, it is resizing the image as 400x600 which is just double, as we are expecting.


My project need is to resize the image as per given size regardless, the device on which application is running is retina or non-retina.


Is there any way to achive the target?


I have tried to measure the scale property, as for retina the scale is 2.0 so we are resizing the image for just half of the required.


But when we connected to monitors, one is retina and other is not retina, it again generating the same problem.


Here is the code which I have used for resizing:


-(void)resizeImageNSImage *)sourceImage newSizeCGSize)newSize
{


   
NSString *newImagePath = [[[Utility documentPath] stringByAppendingPathComponent:imagefolder] stringByAppendingPathComponent:@"imageName"];



   
[sourceImage setScalesWhenResized:YES];
   
[sourceImage setSize:newSize];


   
NSImage *newImage = [[NSImage alloc] initWithSize:newSize];

   
[newImage lockFocus];

   
NSRect frame = NSMakeRect(0, 0, newSize.width, newSize.height);

   
[NSGraphicsContext saveGraphicsState];

   
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:frame xRadius:0 yRadius:0];
   
[path addClip];

   
[sourceImage drawInRect:frame fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];

   
[NSGraphicsContext restoreGraphicsState];

   
[newImage unlockFocus];

   
CGImageRef CGImage = [newImage CGImageForProposedRect:nil context:nil hints:nil];
   
NSBitmapImageRep *imgRep = [[[NSBitmapImageRep alloc] initWithCGImage:CGImage] autorelease];


       
NSData *data = [imgRep representationUsingType:NSPNGFileType properties: nil];
       
[[NSFileManager defaultManager] createFileAtPath:newImagePath contents:data attributes:nil];

   
[newImage release];

}


Any help would be very helpful for me.


Thanks


View the original article here

Thursday, February 14, 2013

How to resize scrollbar in pspdfkit?

please be kind enough to give me the answer about how to resize scrollbar in pspdfkit? i'm using x-code.


View the original article here