gtkosx-image

gtkosx-image — Convert image resourcess to NSImage

Functions

NSImage * nsimage_from_resource ()
NSImage * nsimage_from_pixbuf ()

Description

Quartz requires icon resources for the dock or menu items to be NSImages while Gnome uses either GdkPixbuf or image files such as jpeg or png. The functions in this section convert those resources into NSImage.

Functions

nsimage_from_resource ()

NSImage *
nsimage_from_resource (const gchar *name,
                       const gchar *type,
                       const gchar *subdir);

Retrieve an image file from the bundle and return an NSImage* of it.

Parameters

name

The filename

 

type

The extension (e.g., jpg) of the filename

 

subdir

The subdirectory of $Bundle/Contents/Resources in which to look for the file.

 

Returns

An autoreleased NSImage


nsimage_from_pixbuf ()

NSImage *
nsimage_from_pixbuf (GdkPixbuf *pixbuf);

Create an NSImage from a CGImageRef. Lifted from http://www.cocoadev.com/index.pl?CGImageRef

Parameters

pixbuf

The GdkPixbuf* to convert

 

Returns

An auto-released NSImage*