Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Getting pixel from CGImageRef

 
   Macintosh computer (Home) -> Programmer Help RSS
Next:  Cant burn CD in Leopard  
Author Message
Fonarix

External


Since: Dec 27, 2007
Posts: 4



(Msg. 1) Posted: Wed Jan 09, 2008 6:35 am
Post subject: Getting pixel from CGImageRef
Archived from groups: comp>sys>mac>programmer>help (more info?)

Greetings!
Hi everyone! Does anyone know how get pixel from [1,1] of the
CGImageRef?
I cant find it!!! (Just only via new context... )

CGImageRef LoadImageFromMainBundle(CFStringRef imageName)
{
CGImageRef image = NULL;
CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
imageName, NULL, NULL);
if (url != NULL)
{
CGDataProviderRef provider = CGDataProviderCreateWithURL(url);
image = CGImageCreateWithPNGDataProvider(provider, NULL, false,
kCGRenderingIntentDefault);
CGDataProviderRelease( provider );
CFRelease( url );
}
return image;
}




Thanks!
Fedor.

 >> Stay informed about: Getting pixel from CGImageRef 
Back to top
Login to vote
Ben Artin

External


Since: Jun 20, 2005
Posts: 30



(Msg. 2) Posted: Thu Jan 10, 2008 11:19 am
Post subject: Re: Getting pixel from CGImageRef [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Fonarix wrote:

> Hi everyone! Does anyone know how get pixel from [1,1] of the
> CGImageRef?
> I cant find it!!! (Just only via new context... )

An image doesn't have pixels. Only when you render an image into a context do
you produce pixels, which is why you can only access pixels through a context.

Ben

--
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>

I changed my name: <http://periodic-kingdom.org/People/NameChange.php>

 >> Stay informed about: Getting pixel from CGImageRef 
Back to top
Login to vote
Fonarix

External


Since: Dec 27, 2007
Posts: 4



(Msg. 3) Posted: Tue Jan 15, 2008 2:33 am
Post subject: Re: Getting pixel from CGImageRef [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 10, 6:19 pm, Ben Artin wrote:
> In article ,
>
> Fonarix wrote:
> > Hi everyone! Does anyone know how get pixel from [1,1] of the
> > CGImageRef?
> > I cant find it!!! (Just only via new context... )
>
> An image doesn't have pixels. Only when you render an image into a context do
> you produce pixels, which is why you can only access pixels through a context.
>
> Ben
>
> --
> If this message helped you, consider buying an item
> from my wish list: <http://artins.org/ben/wishlist>
>
> I changed my name: <http://periodic-kingdom.org/People/NameChange.php>

Thanks for your reply!

I still have a problem... When I get data via Context, it's not the
same data as I get it through FreeImage library.
I very need this data, for drawing with mask. With Context's data mask
doesn't work... but with. FreeImage data - works fine.

Thanks!
 >> Stay informed about: Getting pixel from CGImageRef 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Convert CGImageRef to IconRef - Hi, Does anyone know how to convert a CGImageRef to an IconRef? Using files/resource data is not an option as the bitmap data is generated programatically. The code must work on 10.2 and up. Thanks in advance, Peter

CGContextRef Pixel Data - I've been sifting through the docs for hours now searching for a way to gain access to pixel data from a CGContextRef. The CGContextRef comes from an NSView, and I can draw into it and do all the normal stuff. However, I have some custom drawing..

Intel Mac pixel buffer issue - Hi All, I'm having some issues with a pixel buffer I create via GWorlds and DrawString() on Intel-based Mac. I'm basically creating a GWorld with the k32RGBAPixelFormat and writing some text in the GWorld using DrawString(). I first make all the pixels...

Faster pixel display in Opengl in OSX ? - The responses I have received from this group on OpenGL coding on the Mac have been helpful. I am trying to obtain a fast display of arbitrary long sequences of frames at 60 to 120 Hz on Mac OSX 10.4.2 using a Radeon 9600 Pro, 256 MB VRAM. I have coded...

memory leaking in 10.2.8? - Hi groups, I have a question concerning the memory management in the OS X (10.2.8 to be exact). Either I don't understand the way it works or there is something like major memory leak in the version I referred to (I haven't noticed it with previous..
   Macintosh computer (Home) -> Programmer Help All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]