FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DRAWING

Know about PICT formats


You're getting PICT handles confused with the standard PICT file format. They are the same except a PICT file has a 512 byte header.

PICT handle (including PICT resource) :
- 2 bytes for size in bytes of picture (size of the handle)
- 8 bytes for bounding rect
- rest of picture data

PICT file format :
- 512 byte header (not used unless you put info there for your own use)
- 2 bytes for size in bytes of picture (total size minus 512 byte header)
- 8 bytes for bounding rect
- rest of picture data

To put a PICT file into a handle, you have to start at byte 513 and read from there to bypass the 512 byte header.
Al Staffieri Jr.

I think Type 1 PICT's can support only the eight "old-style" QuickDraw colors(black, white, red, green, blue, cyan, magenta, yellow), while Type 2 PICT's support Color QuickDraw (full color). So you could have a Type 2 PICT that happens to be b&w; and you could have a Type 1 PICT that contains (limited)colors.

I haven't worked with it in a while, but I found this bit of code in a program which analyzes the contents of a PICT data structure. In the following, picPtr& is a pointer (_not_ a handle!) to the PICT structure.
  SELECT CASE
    CASE {picPtr& + 10} = &1101
      version = 1
      PRINT #outFile, "This is a version 1 picture"
    CASE {picPtr& + 10} = &0011 AND {picPtr& + 12} = &02FF AND {picPtr& + 14} &0C00 AND {picPtr& + 16} = -1
      version = 2
      PRINT #outFile, "This is a version 2 picture"
    CASE {picPtr& + 10} = &0011 AND {picPtr& + 12} = &02FF AND {picPtr& + 14} &0C00 AND {picPtr& + 16} = -2
      version = 2
      PRINT #outFile, "This is an extended version 2 picture"
    CASE ELSE
      version = 0
      PRINT #outFile, "This does not appear to be a valid picture!"
  END SELECT
Rick