• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: representationUsingType:NSBMPFileType == nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: representationUsingType:NSBMPFileType == nil


  • Subject: Re: representationUsingType:NSBMPFileType == nil
  • From: Florent Pillet <email@hidden>
  • Date: Thu, 13 Nov 2003 15:32:23 +0100

Just a quick answer publicly for others to find the source code they need:

I now use the Quicktime graphics importers and exporters to export various formats
(including Quickdraw GWorlds, BTW).

For those interested, the source code is in the CVS at the osx-palm-tools project,
here is a link to a CVS file of interest:

http://cvs.sourceforge.net/viewcvs.py/osx-palm-tools/PalmServices/ NSImage-PalmExtensions.m

(don't get fooled by the "PalmExtensions" category, it's just because the code is part of a broader project which is a UI editor for Palm development).

Florent.


On 13 nov. 03, at 12:30, Lorenzo wrote:

Hi Florent,
I have the same problem, and even with the Andrew's suggestion, I cannot
find the APIs to solve the problem by myself. How to copy over just the RGB
values? Any sample code? This is what I did and it works for all of the
other NSBitmapImageFileType(s) but for the "NSBMPFileType".

id rep = [[[NSBitmapImageRep alloc] initWithData:
[myImage TIFFRepresentation]] autorelease];

id iconFormatRep = [rep representationUsingType:
NSBMPFileType properties:nil];

When I use NSBMPFileType, iconFormatRep is always nil;
Thank you.


Best Regards
--
Lorenzo
email: email@hidden


On Sep 30, 2003, at 6:10 AM, Florent Pillet wrote:
Hmm after checking the archives, it looks like I'm hitting the
"NSBMPFileType doesn't really work" problem. If I get a NSPNGFileType
representation, everything works fine. However, NSBMPFileType always
return nil. Grr.

The BMP creation code is very limited. Make sure the bitmap is 8 bit
RGB or greyscale, no alpha, no extra components, non-planar.
-initWithFocusedViewRect: may return an image with an alpha channel and
if so, the conversion to BMP won't work and you'll get NULL back. If
there is alpha, allocate a new NSBitmapImageRep and copy over just the
RGB values.

Alternatively, the BMP format is quite simple and you could write it
out yourself especially if you use 8 bit samples.

Andrew
_______________________________
Andrew Platzer
Application Frameworks
Apple Computer, Inc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


--
Florent Pillet, Code Segment email@hidden
Developer tools and end-user products for Palm OS & Mac OS X
ICQ: 117292463 http://perso.wanadoo.fr/fpillet
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >representationUsingType:NSBMPFileType == nil (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: looking for correct way to trap for option key
  • Next by Date: How to get the native localization of zh_TW?
  • Previous by thread: representationUsingType:NSBMPFileType == nil
  • Next by thread: import java.beans.XMLEncoder;
  • Index(es):
    • Date
    • Thread