[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get GWorld's pixel address
- To: minagawa@st.rim.or.jp (Minagawa,Kazushi)
- Subject: Re: How to get GWorld's pixel address
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Wed, 3 May 1995 10:05:18 -0400
- Cc: info-mcl@digitool.com
- Sender: owner-info-mcl@digitool.com
At 3:05 AM 5/3/95, Minagawa,Kazushi wrote:
>I'm having a problem with getting GWorld's pixel address using the
>GetPixBaseAddr trap. I must be doing something wrong.
>
>Here's the code.
>
>(defun access-to-gworld ()
> (rlet ((gw-p :ointer)
> (gw-r :rect
> :topleft #@(0 0)
> :bottomright #@(100 100)))
> (#_NewGWorld gw-p 32 gw-r (%null-ptr) (%null-ptr) 0)
> (with-macptrs ((pix-addr (#_GetPixBaseAddr (#_GetGWorldPxMap gw-p))))
> (print (%get-byte pix-addr)))))
>
>With macsbug I show that the error is "bus error". This means the address I
>got using the GetPixBaseAddress trap is invalid.
>
>Does anybody have any ideas about what is wrong here?
gw-p is a pointer to a pointer to a cgrafport. #_GetGWorldPixmap
expects a pointer to a cgrafport, so you need an additional
%get-ptr call (CAPITALIZED BELOW):
(defun access-to-gworld ()
(rlet ((gw-p :pointer)
(gw-r :rect
:topleft #@(0 0)
:bottomright #@(100 100)))
(#_NewGWorld gw-p 32 gw-r (%null-ptr) (%null-ptr) 0)
(with-macptrs ((pix-addr (#_GetPixBaseAddr (#_GetGWorldPixMap
(%GET-PTR GW-P)))))
(print (%get-byte pix-addr)))))