On Feb 23, 2006, at 4:25 PM, Mike Woodworth wrote:


On Feb 23, 2006, at 12:33 PM, Charles Yeomans wrote:

type = pixmap.OSTypeMBS(60) is returning a strange value because 60 isn't the right offset; I compute it to be 38. A PixMap struct is 50 bytes.

As for baseaddr.StringValue(0,1024), you might try creating a Picture object and set the pixels to known values, then poke around and if you can find them using these functions.

of course you're right on the size... i've spent too much time playing with singles recently, and I read all the shorts as singles. grm. anyways... still cant get a reasonable result for the ostype, it seems MBS always returns "". so i wrote my own little function to do it...

Function LongToOSType(Long as Integer) As string
  Dim s As String
  dim m as new MemoryBlock(4)

  m.Long(0) = Long

s = Encodings.MacRoman.CHR(m.Byte(0)) +Encodings.MacRoman.CHR(m.Byte(1)) + Encodings.MacRoman.CHR(m.Byte(2)) + Encodings.MacRoman.CHR(m.Byte(3))

  Return s
End Function

still im getting gibberish for the pixeltype. i was hoping to see this work before i start digging around in the baseaddr more, but i'm starting to wonder if RB isnt properly setting it?

I don't think the problem is with Rb. First, GetGWorldPixMap returns a PixMapHandle. So to get at the PixMap, you need to perform an additional dereference.

  dim pixmapHandle as MemoryBlock = GetGWorldPixMap(cgrafptr)
  dim pixMapPointer as MemoryBlock = pixmapHandle.Ptr(0)

Now, the pixelFormat field is indeed at offset 38; inspection reveals its integer value (for a JPEG file I opened) to be 32. That certainly does not look like a FourCharCode, and in fact it's not. To figure out what it means, you turn to the header file QuickDraw.h, from which we learn that some basic pixel formats are represented not as FourCharCodes, but as integers. Here, 32 = k32ARGBPixelFormat. I assume that this is a standard Mac format.

--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to