orpheus@reed.UUCP (Aaron Semplers) (05/29/90)
| arichard@manta.nosc.mil.UUCP (Adam W. Richardson) writes: | | I am using THINK C 4.0 and I'm trying to access the routines in | 32-bit quickdraw (specifically I need to create an offscreen | GWorld--if anyone has already done this and has sample code | I'd be VERY interested in seeing it), but I don't think | I have the appropriate header files. I tried to use the 32-bit QuickDraw routines for offscreen worlds. I had the docs on the Develop CD and a good understanding of pixmaps on my side. I had a weekend in which to get the code written. And I had absolutely no success. About the best I could get was 8-bit static and a series of fatal bus errors. Now, I was probably doing something wrong, I but I spent the entire weekend going over and over the routines. Granted, I am not the best programmer, but I am competant, and I generally know what I am doing. A failure like that shakes you up. I wish you the best of luck. If you succeed, there might be hope for me and people like me to live rich, full lives with offscreen worlds the likes of which even God has never seen. So, anyway... I was in Think Pascal, and I got the interfaces I needed from MPW. They were in an interface called OffWorld or something similar. I would imagine the C include file would have a similar name. If you don't have MPW, I wonder what the legal issues are about mailing it to you. | (Obtaining via Symantec is impossible--I work for the Navy and the | government procurement system is horrible! Anything we order takes 3 | months at a minimum to get here via mail) Lame. At least you have Usenet access... orpheus@reed
aclark@bcarh332.bnr.ca (Alexa Clark) (05/30/90)
In article <15018@reed.UUCP> orpheus@reed.UUCP (Aaron Semplers) writes: >| arichard@manta.nosc.mil.UUCP (Adam W. Richardson) writes: >| >| I am using THINK C 4.0 and I'm trying to access the routines in >| 32-bit quickdraw (specifically I need to create an offscreen >| GWorld--if anyone has already done this and has sample code >| I'd be VERY interested in seeing it), but I don't think >| I have the appropriate header files. > >I tried to use the 32-bit QuickDraw routines for offscreen worlds. I >had the docs on the Develop CD and a good understanding of pixmaps on >my side. I had a weekend in which to get the code written. And I had >absolutely no success. > I have used the 32-bit QuickDraw offscreen stuff, with some success. I have however been using MPW C (3.1) on system 6.0.5 on MacIIx. This may seem like useless additional info. But I found that some of the offscreen stuff messed up on the MacCI. (this maybe because of interaction with a video card I have as well) But using "NewGWorld" and defining appropriate pixel depths..(0 for use what the screen is), and a nil pointer for devicehandle, 0 for flags, and nil pointer for colour table.....it should set it up correctly. Remember though...and this got me, so maybe I'm dumb. the DEVICEHANDLE IN THE PARAMETERS FOR NewGWorld IS NEVER USED, to set the device to offscreen setPort to the GWorldPtr. hope this helps. alexa. 1 mistake & it all turns bitchy, listen to records by Lionel Richie, I'm not sure if he deserves it, I wonder if we do. - Jazz Butcher. Alexa Clark, BNR, Ottawa, ON. (613) 765 4998. ..uunet!bnrgate!bcarh332!aclark AppleLink: cda0119.
phils@chaos.cs.brandeis.edu (Phil Shapiro) (06/01/90)
We have a short file that tells how to convert the MPW 32Bit QD headers, which I would mail but my mailer appears to be brain-dead. Essentially, just change the <QuickDraw.h> to <Color.h>, and change the typedef enum { ... } GWorldFlag to a bunch of #define's, using 1L instead of just 1. (ThC's enum uses 16 bit ints). If you want a FAX of this file, or some sample 32Bit programs, call Tech Support, (617) 275-4800. -phil shapiro, symantec tech support -- Phil Shapiro phils@chaos.cs.brandeis.edu
hildreth@cg-atla.agfa.com (Lon Hildreth) (06/02/90)
There's been several people lately having trouble using 32 Bit QuickDraw from THINK C 4.0. Back in November David Phillip Oster posted a .h and a .c file that provides this interface. I've been using this quite successfully for the past 6 months. So following is a repost. ----------------------------------------------------- Path: cg-atla!samsung!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!oster >From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: THINK C & 32-bit quickdraw Message-ID: <32503@ucbvax.BERKELEY.EDU> Date: 12 Nov 89 07:24:07 GMT Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 118 As my way of saying thank you, here are the interfaces for 32-bit Quickdraw for THINK C. You may want to save this file and upload it, since it contains tabs and fairly long lines.: > The mac is a detour in the inevitable march of mediocre computers. > drs@bnlux0.bnl.gov (David R. Stampf) --- David Phillip Oster -master of the ad hoc odd hack. Arpa: oster@dewey.soe.berkeley.edu Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu (cut here, call this QuickDraw32Bit.h). /* let's get a real juicy 32 bit discussion going based on this maybe !! by bhamlin@well.sf.ca.us (Brian M. Hamlin) from oster@well.sf.ca.us (David Phillip Oster) */ /* I think that's it - check it out, write something fun. Remember: You don't have to have a 32bit video card, just Sys 6.0.3 or greater on a color-capable machine and the 32bit Quickdraw INIT in your system folder to use these calls ! */ /* hoo-boy, well ANYWAY thanks to Sam Roberts for assembler tweaking. */ #ifndef _QuickDraw32Bit_ #define _QuickDraw32Bit_ #ifndef _Quickdraw_ #include <Quickdraw.h> #endif #ifndef _Color_ #include <Color.h> #endif /* New Constants for 32-Bit QuickDraw */ #define ditherCopy 64 /* Dither mode for Copybits */ #define RGBDirect 16 /* 16 & 32 bits/pixel pixelType value */ /* New error codes */ #define rgnOverflowErr -147 /* Region accumulation failed. Resulting region may be currupt */ #define pixmapTooDeepErr -148 /* Pixmap is not 1-bit/pixel for BitmapToRegion */ #define insufficientStackErr -149 /* QuickDraw could not complete the operation */ #define cDepthErr -157 /* invalid pixel depth passed to NewGWorld or UpdateGWorld */ #define pixPurgeMask 1 #define noNewDeviceMask 2 /* Flag bits passed to or returned by Offscreen routines */ enum { pixPurgeBit = 0, nowNewDeviceBit = 1, pixelsPurgeableBit = 6, pixelsLockedBit = 7, mapPixBit = 16, /* set if color table mapping occurred */ newDepthBit = 17, /* set if pixels were scaled to a different depth */ alignPixBit = 18, /* set if pixels were realigned to screen alignment */ newRowBytesBit = 19, /* set if pixmap was reconfigured in a new rowBytes */ reallocPixBit = 20, /* set if offscreen buffer had to be reallocated */ clipPixBit = 28, /* set if pixels were or are to be clipped */ stretchPixBit = 29, /* set if pixels were or are to be stretched/shrinked */ ditherPixBit = 30, gwFlagErrBit = 31 }; typedef enum { pixPurge = 1L << pixPurgeBit, nowNewDevice = 1L << nowNewDeviceBit, pixelsPurgeable = 1L << pixelsPurgeableBit, pixelsLocked = 1L << pixelsLockedBit, mapPix = 1L << mapPixBit, newDepth = 1L << newDepthBit, alignPix = 1L << alignPixBit, newRowBytes = 1L << newRowBytesBit, reallocPix = 1L << reallocPixBit, clipPix = 1L << clipPixBit, stretchPix = 1L << stretchPixBit, ditherPix = 1L << ditherPixBit, gwFlagErr = 1L << gwFlagErrBit }GWorldFlag; typedef long GWorldFlags; /* Type definition of a GWorldPtr */ typedef CGrafPtr GWorldPtr; /* Function Prototypes (necessary to get automatic type coercion -- see LSC User's Manual p.125) */ pascal OSErr BitmapToRegion(RgnHandle, BitMap *); pascal QDErr NewGWorld(GWorldPtr *, short, Rect *, CTabHandle, GDHandle, GWorldFlags); pascal Boolean LockPixels(PixMapHandle); pascal void UnlockPixels(PixMapHandle); pascal GWorldFlags UpdateGWorld(GWorldPtr *, short, Rect *, CTabHandle, GDHandle, GWorldFlags); pascal void DisposeGWorld(GWorldPtr); pascal void GetGWorld(CGrafPtr *, GDHandle *); pascal void SetGWorld(CGrafPtr, GDHandle); pascal void CTabChanged(CTabHandle); pascal void PixPatChanged(PixPatHandle); pascal void PortChanged(GrafPtr); pascal void GDeviceChanged(GDHandle); pascal void AllowPurgePixels(PixMapHandle); pascal void NoPurgePixels(PixMapHandle); pascal GWorldFlags GetPixelsState(PixMapHandle); pascal void SetPixelsState(PixMapHandle, GWorldFlags); pascal Ptr GetPixBaseAddr(PixMapHandle); pascal QDErr NewScreenBuffer(Rect *, Boolean, GDHandle *, PixMapHandle *); pascal void DisposeScreenBuffer(PixMapHandle); pascal GDHandle GetGWorldDevice(GWorldPtr); #endif Path: cg-atla!samsung!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!oster >From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: THINK C & 32-bit quickdraw (.c) Message-ID: <32505@ucbvax.BERKELEY.EDU> Date: 12 Nov 89 07:29:11 GMT References: <32503@ucbvax.BERKELEY.EDU> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 274 As my way of saying thank you, here are the interfaces for 32-bit Quickdraw for THINK C. You can save this, compile it, then get at all the 32-bit quickdraw traps from THINK C. You may want to save this file and upload it, since it contains tabs and fairly long lines.: > The mac is a detour in the inevitable march of mediocre computers. > drs@bnlux0.bnl.gov (David R. Stampf) --- David Phillip Oster -master of the ad hoc odd hack. Arpa: oster@dewey.soe.berkeley.edu Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu (cut here, call this QuickDraw32Bit.c). #include <QuickDraw32Bit.h> /* let's get a real juicy 32 bit discussion going based on this maybe !! by bhamlin@well.sf.ca.us (Brian M. Hamlin) from oster@well.sf.ca.us (David Phillip Oster) */ /* BitmapToRegion - */ pascal OSErr BitmapToRegion(region, bmap) RgnHandle region; BitMap *bmap;{ asm { SUBQ.L #2,SP MOVE.L region(A6),-(SP) MOVE.L bmap(A6),-(SP) DC.W 0xA8D7 MOVE.W (SP)+,D0 } } /* NewGWorld - */ pascal QDErr NewGWorld(offscreenGWorld, pixelDepth, boundsRect, cTable, aGDevice, flags) GWorldPtr *offscreenGWorld; short pixelDepth; Rect *boundsRect; CTabHandle cTable; GDHandle aGDevice; GWorldFlags flags;{ asm { SUBQ.L #2,SP MOVE.L offscreenGWorld(A6),-(SP) MOVE.W pixelDepth(A6),-(SP) MOVE.L boundsRect(A6),-(SP) MOVE.L cTable(A6),-(SP) MOVE.L aGDevice(A6),-(SP) MOVE.L flags(A6),-(SP) MOVEQ #0,D0 DC.W 0xAB1D MOVE.W (SP)+,D0 } } /* LockPixels - */ pascal Boolean LockPixels(pm)PixMapHandle pm;{ asm { SUBQ.L #2,SP MOVE.L pm(A6),-(SP) MOVEQ #1,D0 DC.W 0xAB1D MOVE.B (SP)+,D0 } } /* UnlockPixels - */ pascal void UnlockPixels(pm)PixMapHandle pm;{ asm { MOVE.L pm(A6),-(SP) MOVEQ #2,D0 DC.W 0xAB1D } } /* UpdateGWorld - */ pascal GWorldFlags UpdateGWorld(offscreenGWorld, pixelDepth, boundsRect, cTable, aGDevice, flags) GWorldPtr *offscreenGWorld; short pixelDepth; Rect *boundsRect; CTabHandle cTable; GDHandle aGDevice; GWorldFlags flags;{ asm { SUBQ.L #4,SP MOVE.L offscreenGWorld(A6),-(SP) MOVE.W pixelDepth(A6),-(SP) MOVE.L boundsRect(A6),-(SP) MOVE.L cTable(A6),-(SP) MOVE.L aGDevice(A6),-(SP) MOVE.L flags(A6),-(SP) MOVEQ #3,D0 DC.W 0xAB1D MOVE.L (SP)+,D0 } } /* DisposeGWorld - */ pascal void DisposeGWorld(offscreenGWorld)GWorldPtr offscreenGWorld;{ asm { MOVE.L offscreenGWorld(A6),-(SP) MOVEQ #4,D0 DC.W 0xAB1D } } /* GetGWorld - */ pascal void GetGWorld(port, gdh)CGrafPtr *port;GDHandle *gdh;{ asm { MOVE.L port(A6),-(SP) MOVE.L gdh(A6),-(SP) MOVEQ #5,D0 DC.W 0xAB1D } } /* SetGWorld - */ pascal void SetGWorld(port, gdh)CGrafPtr port;GDHandle gdh;{ asm { MOVE.L port(A6),-(SP) MOVE.L gdh(A6),-(SP) MOVEQ #6,D0 DC.W 0xAB1D } } /* CTabChanged - */ pascal void CTabChanged(ctab)CTabHandle ctab;{ asm { MOVE.L ctab(A6),-(SP) MOVEQ #7,D0 DC.W 0xAB1D } } /* PixPatChanged - */ pascal void PixPatChanged(ppat)PixPatHandle ppat;{ asm { MOVE.L ppat(A6),-(SP) MOVEQ #8,D0 DC.W 0xAB1D } } /* PortChanged - */ pascal void PortChanged(port)GrafPtr port;{ asm { MOVE.L port(A6),-(SP) MOVEQ #9,D0 DC.W 0xAB1D } } /* GDeviceChanged - */ pascal void GDeviceChanged(gdh)GDHandle gdh;{ asm { MOVE.L gdh(A6),-(SP) MOVEQ #0x0A,D0 DC.W 0xAB1D } } /* AllowPurgePixels - */ pascal void AllowPurgePixels(pm)PixMapHandle pm;{ asm { MOVE.L pm(A6),-(SP) MOVEQ #0x0B,D0 DC.W 0xAB1D } } /* NoPurgePixels - */ pascal void NoPurgePixels(pm)PixMapHandle pm;{ asm { MOVE.L pm(A6),-(SP) MOVEQ #0x0C,D0 DC.W 0xAB1D } } /* GetPixelsState - */ pascal GWorldFlags GetPixelsState(pm)PixMapHandle pm;{ asm { SUBQ.L #4,SP MOVE.L pm(A6),-(SP) MOVEQ #0x0D,D0 DC.W 0xAB1D MOVE.L (SP)+,D0 } } /* SetPixelsState - */ pascal void SetPixelsState(pm, state)PixMapHandle pm;GWorldFlags state;{ asm { MOVE.L pm(A6),-(SP) MOVE.L state(A6),-(SP) MOVEQ #0x0E,D0 DC.W 0xAB1D } } /* GetPixBaseAddr - */ pascal Ptr GetPixBaseAddr(pm)PixMapHandle pm;{ asm { SUBQ.L #4,SP MOVE.L pm(A6),-(SP) MOVEQ #0x0F,D0 DC.W 0xAB1D MOVE.L (SP)+,D0 } } /* NewScreenBuffer - */ pascal QDErr NewScreenBuffer(globalRect, purgeable, gdh, offscreenPixMap) Rect *globalRect; Boolean purgeable; GDHandle *gdh; PixMapHandle *offscreenPixMap;{ asm { SUBQ.L #2,SP MOVE.L globalRect(A6),-(SP) MOVE.B purgeable(A6),-(SP) MOVE.L gdh(A6),-(SP) MOVE.L offscreenPixMap(A6),-(SP) MOVEQ #0x10,D0 DC.W 0xAB1D MOVE.W (SP),D0 } } /* DisposeScreenBuffer - */ pascal void DisposeScreenBuffer(offscreenPixMap)PixMapHandle offscreenPixMap;{ asm { MOVE.L offscreenPixMap(A6),-(SP) MOVEQ #0x11,D0 DC.W 0xAB1D } } /* GetGWorldDevice - */ pascal GDHandle GetGWorldDevice(offscreenGWorld)GWorldPtr offscreenGWorld;{ asm { SUBQ.L #4,SP MOVE.L offscreenGWorld(A6),-(SP) MOVEQ #0x12,D0 DC.W 0xAB1D MOVE.L (SP)+,D0 } } -- Lon Hildreth ...!{decvax,uunet,samsung}!cg-atla!hildreth Agfa Compugraphic or hildreth@cg-atla.agfa.com Wilmington, MA A Cub fan, but not a Bud man.
phils@chaos.cs.brandeis.edu (Phil Shapiro) (06/04/90)
This will work *except* for the GWorldFlag enum. Since ThC uses 16 bit ints, and since enums use int type (p.441, User Manual), the bit shifts in this enum will not work. Simply change the enum {} to a bunch of #defines, and add 'typedef long GWorldFlag;' to the .h file. -phil shapiro, symantec tech support -- Phil Shapiro phils@chaos.cs.brandeis.edu