• 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: Reading .BMPs the hard way
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading .BMPs the hard way


  • Subject: Re: Reading .BMPs the hard way
  • From: "Sean McBride" <email@hidden>
  • Date: Fri, 18 Mar 2005 11:39:43 -0500
  • Organization: Rogue Research

On 2005-03-18 11:14, Heinrich Giesen said:

>> Still, the values I get back don't seem to be right... Any clues??
>
>You have to respect that all values in a BMP file are littleEndian
>values. So you have to read with something like:
>
>- (int) readIntFrom:(int)inx	// byteOrder==NS_LittleEndian
>{
>	return (imgDataBuffer[inx+3]<<24) | (imgDataBuffer[inx+2]<<16) |
>(imgDataBuffer[inx+1]<<8) | imgDataBuffer[inx];
>}

Foundation/NSByteOrder.h has some useful functions for this.  If you use
NSSwapLittleIntToHost() your code will convert from little endian to
whatever endianness the machine you're building for is.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


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

This email sent to email@hidden

References: 
 >Re: Reading .BMPs the hard way (From: Heinrich Giesen <email@hidden>)

  • Prev by Date: Re: Reading .BMPs the hard way
  • Next by Date: Re: NSDrawerWindow - using it is okay?
  • Previous by thread: Re: Reading .BMPs the hard way
  • Next by thread: Need serious help with NSOutlineView
  • Index(es):
    • Date
    • Thread