
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 |
DRAWING
Get the color depth & resolution of an image
I search my programs and find following routine. Try this. I hope this helps you.
'=================
LOCAL MODE
LOCAL FN GetPictInfo(thePictHandle&,@thePictInfo&,verb%,colorsRequested%,colorPickMet hod%,version%)
'---------------------------------------
' Get picture data.
'---------------------------------------
` CLR.W -(SP)
` MOVE.L ^thePictHandle&,-(SP) ;PicHandle
` MOVE.L ^thePictInfo&,-(SP) ;Var: PictInfo
` MOVE.W ^verb%,-(SP) ;INTEGER
` MOVE.W ^colorsRequested%,-(SP) ;INTEGER
` MOVE.W ^colorPickMethod%,-(SP) ;INTEGER
` MOVE.W ^version%,-(SP) ;INTEGER
` DC.W $303C,$0800,$A831
` MOVE.W (SP)+,D0
` EXT.L D0
END FN = REGISTER(D0) 'OSErr
'=================
CLEAR LOCAL
DIM OSerr,QDErr,PICTWorld&
'
DIM RECORD PictInfo
DIM PIzversion% ' INTEGER
DIM PIzuniqueColors& ' LONGINT
DIM PIzthePalette& ' PaletteHandle
DIM PIztheColorTable& ' CTabHandle
DIM PIzhRes& ' Fixed
DIM PIzvRes& ' Fixed
DIM PIzdepth% ' INTEGER
DIM PIzsourceRect.8 ' Rect
DIM PIztextCount& ' LONGINT
DIM PIzlineCount& ' LONGINT
DIM PIzrectCount& ' LONGINT
DIM PIzrRectCount& ' LONGINT
DIM PIzovalCount& ' LONGINT
DIM PIzarcCount& ' LONGINT
DIM PIzpolyCount& ' LONGINT
DIM PIzregionCount& ' LONGINT
DIM PIzbitMapCount& ' LONGINT
DIM PIzpixMapCount& ' LONGINT
DIM PIzcommentCount& ' LONGINT
DIM PIzuniqueComments& ' LONGINT
DIM PIzcommentHandle& ' CommentSpecHandle
DIM PIzuniqueFonts& ' LONGINT
DIM PIzfontHandle& ' FontSpecHandle
DIM PIzfontNamesHandle& ' Handle
DIM PIzreserved1& ' LONGINT
DIM PIzreserved2& ' LONGINT
DIM END RECORD _PIzSize
'
DIM RECORD MyColorInfo
DIM MyDepth%
DIM MyCTable&
DIM MyPICTRect;8
DIM END RECORD _ColorInfoSize
'
LOCAL FN GetPICTColorInfo(PictHandle&,@ColorInfoPtr&)
'---------------------------------------
LONG IF SYSTEM(_Maxcolors) > 1 AND SYSTEM(_Sysvers) >= 700'System 7 Only
'
OSerr = FN GetPictInfo(PictHandle&,PictInfo,_ReturnColorTable,256,_SystemMethod,0)
'
LONG IF OSerr = _noErr
'
LONG IF PIzdepth% <= 1 OR PIzdepth% > 8
CALL DISPOSCTABLE(PIztheColorTable&)
PIztheColorTable& = 0
END IF
'
CALL OFFSETRECT(PIzsourceRect.Top%,-PIzsourceRect.Left%,-PIzsourceRect.Top%)
'
MyPICTRect;8 = @PIzsourceRect
MyCTable& = PIztheColorTable&
MyDepth% = PIzdepth%
'
BLOCKMOVE @MyColorInfo,ColorInfoPtr&,_ColorInfoSize
'
END IF
'
XELSE
'
END IF
'
END FN = OSerr
|