Rootless Squeak on OS X?
John M McIntosh
johnmci at smalltalkconsulting.com
Fri Feb 23 07:26:25 UTC 2007
On Feb 22, 2007, at 10:35 PM, Aaron Reichow wrote:
> John and the list-
>
> There has to be a way to do this on OS X! I'm hoping that John or
> someone else on the list might be willing to tackle it or be
> willing to tell me where to look myself. I'm quite handy with
> anything in Smalltalk, but when it comes to the workings of the VM
> or FFI calls into C I'm lost.
>
> It seems that this should be pretty easy to implement, if only
> because a) Mac OS X can do transparency too and b) the Windows
> version manages to be implemented in a measly ~5 pages of code,
> looking at the fileout. When you actually file it in, it's a tiny
> bit of code, relatively. It uses FFI to work its magic and doesn't
> require a plugin. As you see if you download the zip below, it was
> created for Squeak 3.0, however I've used it on newer Squeaks (at
> least up to 3.6, possibly 3.7 IIRC) with no problems or patches.
Have you fiddled with
http://www.smalltalkconsulting.com/html/squeakinfoplist.html
SqueakWindowHasTitle
SqueakWindowType
SqueakWindowAttribute
kOverlayWindowClass
Identifies an overlay window, which is a completely transparent
window positioned above all other windows. Overlay windows are
intended as a replacement for the pre-Carbon practice of drawing
directly into the Window Manager port. By creating a full-screen
overlay window and drawing into it, you can draw over any window in
any application without disturbing the contents of the windows
beneath your drawing. Overlay windows have a default handler for
kEventWindowPaint that uses CGContextClearRect to clear the overlay
window's alpha channel to zero. This ensures the initial transparency
of the window.
If you don't set
SqueakWindowAttribute
to all zeros, then you'll crash because I don't check for window
failure open,and by setting kOverlayWindowClass to 14 you must have
the right attributes.
Likely you should code a FFI call to
WindowAttributes GetAvailableWindowAttributes (
WindowClass inClass
);
likely you could also code a FFI call to
OSStatus SetWindowClass (
WindowRef window,
WindowClass inClass
);
and
OSStatus ChangeWindowAttributes (
WindowRef window,
WindowAttributes setTheseAttributes,
WindowAttributes clearTheseAttributes
);
Both Sophie and Croquet have lots of FFI calls you can look at for
examples.
Lastly I believe I drag the data out of the squeak display buffer
using kCGImageAlphaNoneSkipFirst
in sqMacWindowUniversal.c
I guess I could make this a info.plist and let people figure out what
they want.
I suspect you'll need a new vm and set thing to kCGImageAlphaFirst or
kCGImageAlphaPremultipliedFirst
Oh and likely it might different for macIntel.
Anyway you'll need to test some things before a vm change, then let
me know
kCGImageAlphaFirst
The alpha component is stored in the most significant bits of each
pixel. For example, non-premultiplied ARGB.
kCGImageAlphaLast
The alpha component is stored in the least significant bits of each
pixel. For example, non-premultiplied RGBA.
kCGImageAlphaNone
There is no alpha channel. If the total size of the pixel is greater
than the space required for the number of color components in the
color space, the least significant bits are ignored. This value is
equivalent to kCGImageAlphaNoneSkipLast.
kCGImageAlphaNoneSkipFirst
There is no alpha channel. If the total size of the pixel is greater
than the space required for the number of color components in the
color space, the most significant bits are ignored.
kCGImageAlphaOnly
There is no color data, only an alpha channel.
kCGImageAlphaNoneSkipLast
There is no alpha channel. If the total size of the pixel is greater
than the space required for the number of color components in the
color space, the least significant bits are ignored. This value is
equivalent to kCGImageAlphaNone.
kCGImageAlphaPremultipliedFirst
The alpha component is stored in the most significant bits of each
pixel and the color components have already been multiplied by this
alpha value. For example, premultiplied ARGB.
kCGImageAlphaPremultipliedLast
The alpha component is stored in the least significant bits of each
pixel and the color components have already been multiplied by this
alpha value. For example, premultiplied RGBA.
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
More information about the Squeak-dev
mailing list
|