Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: CGImageCreate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGImageCreate?



On Sat, Aug 23, 2008 at 7:42 PM, Bill Dudney <email@hidden> wrote:
> Thanks David,
> So if I understand you correctly I could so something like this.
>    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
> pathForResource:@"image" ofType:@"png"]];
>    CGDataProviderRef maskData = CGDataProviderCreateWithURL((CFURLRef)url);
>
>    CGImageRef image1 = CGImageCreateWithPNGDataProvider(maskData, NULL, NO,
> kCGRenderingIntentDefault);
>
>    size_t width = CGImageGetWidth(image1);
>    size_t height = CGImageGetHeight(image1);
>    size_t bitsPerComponent = CGImageGetBitsPerComponent(image1);
>    size_t bitsPerPixel = CGImageGetBitsPerPixel(image1);
>    size_t bytesPerRow = CGImageGetBytesPerRow(image1);
>    CGColorSpaceRef colorSpace = CGImageGetColorSpace(image1);
>    CGBitmapInfo info = CGImageGetBitmapInfo(image1);
>    CGFloat *decode = NULL;
>    BOOL shouldInteroplate = NO;
>    CGColorRenderingIntent intent = CGImageGetRenderingIntent(image1);
>    CGDataProviderRef pngProvider = CGImageGetDataProvider(image1);
>    CGImageRef image2 = CGImageCreate(width, height, bitsPerComponent,
> bitsPerPixel, bytesPerRow, colorSpace, info, pngProvider, decode,
> shouldInteroplate, intent);

Why are you doing this? You already have an CGImage instance because
of what you got back from CGImageCreateWithPNGDataProvider. Why do you
want to create another image instance in rather round about way?

Again what are you really trying to achieve? Do you want access to the
pixels? Do you want to just draw the image? etc.

-Shawn
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >CGImageCreate? (From: Bill Dudney <email@hidden>)
 >Re: CGImageCreate? (From: David Duncan <email@hidden>)
 >Re: CGImageCreate? (From: "Adam R. Maxwell" <email@hidden>)
 >Re: CGImageCreate? (From: David Duncan <email@hidden>)
 >Re: CGImageCreate? (From: Bill Dudney <email@hidden>)
 >Re: CGImageCreate? (From: David Duncan <email@hidden>)
 >Re: CGImageCreate? (From: Bill Dudney <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.