home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
da
/
clipmagi.sit
/
iconpict.p
< prev
next >
Wrap
Text File
|
1989-06-01
|
2KB
|
64 lines
unit UConvertor;
const
{the constants are for use of the simulator only }
testID = 128; { change to reflect code resource ID }
testType = 'ICON'; { change to reflect the data type you are testing }
interface
type
routineInfo = record
entryPoint: ProcPtr;
resID: Integer;
parmCount: Integer;
useDefault: boolean;
end;
routineInfoPtr = ^routineInfo;
parmInfo = record
srcType: ResType;
srcHandle: Handle;
dstType: ResType;
dstHandle: Handle;
end;
parmInfoPtr = ^parmInfo;
{ the name xMain is for debugging use only, change to Main before making the code resource }
function xMain (myInfoPtr: routineInfoPtr; parmPtr: parmInfoPtr): OSErr;
implementation
function xMain (myInfoPtr: routineInfoPtr; parmPtr: parmInfoPtr): OSErr;
var
r: rect;
aBitMap: BitMap;
orgPort: GrafPtr;
tempPort: GrafPort;
err: OSErr;
begin
parmPtr^.dstHandle := NewHandle(128);
if parmPtr^.dstHandle <> nil then
begin
HLock(parmPtr^.dstHandle);
HLock(parmPtr^.srcHandle);
SetRect(r, 0, 0, 32, 32);
with aBitMap do
begin
baseAddr := parmPtr^.dstHandle^;
rowBytes := 4;
bounds := r;
end;
GetPort(orgPort);
OpenPort(@tempPort);
SetPortBits(aBitMap);
ClipRect(r);
EraseRect(r);
DrawPicture(PicHandle(parmPtr^.srcHandle), r);
HUnLock(parmPtr^.srcHandle);
HUnLock(parmPtr^.dstHandle);
SetPort(orgPort);
parmPtr^.dstType := 'ICON';
xMain := NoErr;
end
else
xMain := MemError;
end;
end.