[Vm-dev] Bigger cursors needed

Bert Freudenberg bert at freudenbergs.de
Sun Mar 4 15:54:00 UTC 2007


On Mar 4, 2007, at 13:18 , Bert Freudenberg wrote:

>
> On Mar 3, 2007, at 22:31 , John M McIntosh wrote:
>
>> 10.2 has a restriction of 16x16, but that is lifted in 10.3
>> I'll need to convert to the new NSCursor model. so will do that  
>> soon in  3.8.16 mac carbon vm.
>>
>> If you can point to a image that enables the large cursor  
>> functionality so I can do testing that would be good.
>
> Well, I can't test it without a real implementation. But this  
> should work if the primitive works:
>
> | form cursor |
> form := Cursor normal asCursorForm as8BitColorForm.
> form replaceColor: Color white with: (Color green alpha: 0.25).
> form replaceColor: Color black with: (Color blue alpha: 0.5).
> form := form asFormOfDepth: 32.
> form := form magnify: (0 at 0 extent: 9 at 16) by: 3.
> cursor := Cursor extent: form extent depth: 32.
> form displayOn: cursor at: 0 at 0 rule: Form blend. "pre-multiply alpha"
> form asMorph openInHand.
> cursor show
>
> The cursor rendering should match the morph (provided your world is  
> set to 32 bpp). In particular, the green border should not appear  
> grayish, if it is, your system does not use pre-multiplied alpha.  
> We can still change the spec if this is the case.

Err, forgot the offset. Also, much more configurable. Special! Only  
today! Choose your own source, scale, and colors! ;-)

| source scale colors form cursor |
source := Cursor read.
scale := 3.
colors := {Color blue alpha: 0.5. Color green alpha: 0.25}.
form := source asCursorForm as8BitColorForm.
form replaceColor: Color black with: colors first.
form replaceColor: Color white with: colors second.
form := form asFormOfDepth: 32.
form := form magnify: (source innerPixelRectFor: 0 orNot: false) by:  
scale.
form asMorph openInHand.
cursor := Cursor extent: form extent depth: 32.
form displayOn: cursor at: 0 at 0 rule: Form blend. "pre-multiply alpha"
cursor offset: (source offset - 0.5 * scale min: 0 at 0 max: cursor  
extent negated) asIntegerPoint.
cursor show

For testing the offset, "Cursor crossHair" might work best.

- Bert -




More information about the Vm-dev mailing list