PDA

View Full Version : .rsrc files - best way to make one?




toddburch
Feb 8, 2008, 01:28 PM
I don't have Photoshop. I'm writing the (probably infamous) Moon Travel Planner application from "Learning Carbon". Surprisingly, most of the Project Builder info in the book still applies to Xcode, so, so far, so good.

However, it calls for a .rsrc graphic of an image. The books web site provides all the resources needed for examples in a downloadable .sit file, but I'd rather not download stuffit to expand it.

Is there any way, with the native apps on Tiger to create a .rsrc file from a .png or .jpg?

Thanks, Todd



kainjow
Feb 8, 2008, 01:31 PM
How are you using your image? Resources files shouldn't be used anymore. They are from the classic days. CoreGraphics has lots of functions for dealing with images with Carbon directly.

toddburch
Feb 8, 2008, 01:35 PM
Well, I'm just following the book - happily and blindly using the Project Builder instructions with Xcode!

So, perhaps my question ought to be - how do I incorporate a .png file into a PICT area in a Carbon App that uses a nib in Xcode?

(Say that 3 times real fast).

kainjow
Feb 8, 2008, 01:41 PM
PICTs are legacy too ;)

The modern Carbon UI framework deals with the HIToolbox, specifically, HIViews. HIImageView is probably what you want.

The Benefits of HIToolbox: The Evolving Widget Set (http://developer.apple.com/carbon/HIToolbox_feature.html)
HIView Programming Guide (http://developer.apple.com/documentation/Carbon/Conceptual/HIViewDoc/Introduction/chapter_1_section_1.html)


First you need to load your image into a CGImageRef: Creating a CGImage Object (http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/ImageSoundResources/chapter_6_section_3.html#//apple_ref/doc/uid/10000051i-CH7-DontLinkElementID_19)

Then once you have your HIImageView setup, you can use HIImageViewSetImage().

tersono
Feb 8, 2008, 01:44 PM
Do bear in mind that Carbon is on the way out - it was a transitional API between the classic OS and OS X, but is being phased out now. Expect it to be completely deprecated in the not-too-distant future.

I'd suggest you start looking at cocoa - it's the future (and won't lead you down dead ends like .rsrc files).

kainjow
Feb 8, 2008, 01:48 PM
Do bear in mind that Carbon is on the way out - it was a transitional API between the classic OS and OS X, but is being phased out now. Expect it to be completely deprecated in the not-too-distant future.

I'd suggest you start looking at cocoa - it's the future (and won't lead you down dead ends like .rsrc files).

Yes he knows (http://forums.macrumors.com/showpost.php?p=4854404&postcount=5) :)

toddburch
Feb 8, 2008, 02:02 PM
OK, thanks kainjow. You da man. I'm reading...

Yes, I know Carbon is the lame duck. Any principles I learn I'm sure will apply to Cocoa.

Thanks!

Todd

toddburch
Feb 8, 2008, 02:06 PM
For grins, and my sanity to just make it through this tutorial without having to read volumes of additional info, could someone expand this .sit file and email to me please?

http://examples.oreilly.com/learncarbon/

I'd be eternally grateful.

Todd

kainjow
Feb 8, 2008, 02:11 PM
Just download StuffIt Expander. It's available as a UB, and for Windows if you are on that by any chance...

toddburch
Feb 8, 2008, 02:15 PM
I tried twice earlier today. Both times, the registration dialog (that you have to fill out to get a link for the download) crashed Safari, and in doing so, screwed up all my settings, big time.

I'll try with Firefox.

kainjow
Feb 8, 2008, 02:20 PM
http://my.smithmicro.com/downloads/trials/exp-dl-only.html

toddburch
Feb 8, 2008, 02:20 PM
Worked with Firefox. Thanks.

toddburch
Feb 8, 2008, 08:36 PM
Got it working!! This thread was of immense help. Thanks Soulstorm!!

http://forums.macrumors.com/archive/index.php/t-181554.html

Todd

Cromulent
Feb 8, 2008, 08:44 PM
For reference ResEdit is the application you need for editing rsrc files. Although I haven't used it since MPW was the Apple IDE of choice.

toddburch
Feb 8, 2008, 09:13 PM
I have a question about the moon.rsrc file. When I added it to IB, in the Images tab, it shows up as 3 entities:


ICNS: 16455
PICT: 32236
PICT: 8722


I suspect the first one is an ICON, as it is smaller. The other two are similar in size. What's the trailing number? The size in bytes?

Todd