How to create a custom cursor?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create a custom cursor?

Gruenewald, Tom

Hello forum.
I like to create a custom cursor (for a drag&drop event) which exceeds the size of 16x16 pixels.
Why does the following procedure fail?

| anImage aMaskImage cursor |
anImage := self loadCustomImage.
"anImage = Depth24Image(extent: 48 @ 48 depth: 24)"
aMaskImage := Image
extent: anImage
depth: 1
bitsPerPixel: 1
palette: (CoveragePalette maxPixelValue: 1).
aMaskImage pixelsDo: [:x :y | aMaskImage atX: x y: y put: 1].
cursor := Cursor new.
cursor
setImage: anImage
mask: aMaskImage
hotSpot: 0@0
name: 'CustomCursor'.
cursor showWhile: [(Delay forSeconds: 1) wait]



Unhandled exception: a primitive has failed
HandleRegistry>>evaluateWithFullProtection:
HandleRegistry>>registerValueOf:
Cursor class(OSHandle class)>>registerValueOf:
optimized [] in OSHandle>>handleValue:
BlockClosure>>ifCurtailed:
Cursor(OSHandle)>>handleValue:
Cursor>>privateInstall
Cursor>>beCursor
Cursor class>>currentCursor:
Cursor>>show
Cursor>>showWhile:
UndefinedObject>>unboundMethod
[...]


Best regards,
Tom Grünewald

________

Carl Zeiss Industrielle Messtechnik GmbH
Softwareentwicklung/Software Development

T o m G r ü n e w a l d

73446 Oberkochen, Germany
tel: +49.7364.20-8541
fax: +49.7364.20-4800
email: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl–Zeiss–Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Axel Jaeger
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Handelsregister: Amtsgericht Ulm, HRB 501561
USt–IdNr.: DE 811 515 346


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

Reply | Threaded
Open this post in threaded view
|

Re: How to create a custom cursor?

Travis Griggs-4
On Nov 23, 2010, at 5:42 AM, Gruenewald, Tom wrote:

Hello forum.
I like to create a custom cursor (for a drag&drop event) which exceeds the size of 16x16 pixels.
Why does the following procedure fail?

| anImage aMaskImage cursor |
anImage := self loadCustomImage.
"anImage = Depth24Image(extent: 48 @ 48 depth: 24)"
aMaskImage := Image
extent: anImage
depth: 1
bitsPerPixel: 1
palette: (CoveragePalette maxPixelValue: 1).
aMaskImage pixelsDo: [:x :y | aMaskImage atX: x y: y put: 1].
cursor := Cursor new.
cursor
setImage: anImage
mask: aMaskImage
hotSpot: 0@0
name: 'CustomCursor'.
cursor showWhile: [(Delay forSeconds: 1) wait]



Unhandled exception: a primitive has failed
HandleRegistry>>evaluateWithFullProtection:
HandleRegistry>>registerValueOf:
Cursor class(OSHandle class)>>registerValueOf:
optimized [] in OSHandle>>handleValue:
BlockClosure>>ifCurtailed:
Cursor(OSHandle)>>handleValue:
Cursor>>privateInstall
Cursor>>beCursor
Cursor class>>currentCursor:
Cursor>>show
Cursor>>showWhile:
UndefinedObject>>unboundMethod
[...]


Best regards,
Tom Grünewald


VisualWorks has a 32x32 cursor limit, due to xplatform limits.

--
Travis Griggs
Objologist
I multiply all time estimates by pi, to account for running around in circles.




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to create a custom cursor?

Gruenewald, Tom

Sorry Mr. Griggs.
I cannot even make a Depth4Image(extent: 16 @ 16 depth: 3) image working.

My fantastic example image:

^Image extent: 16@16 depth: 3 bitsPerPixel: 4 palette: (Graphics.MappedPalette withColors: (#(#(#{Graphics.ColorValue} #scaledRed:scaledGreen:scaledBlue: #(0 4111 0)) #(#{Graphics.ColorValue} #scaledRed:scaledGreen:scaledBlue: #(8191 0 8191)) #(#{Graphics.ColorValue} #scaledRed:scaledGreen:scaledBlue: #(8191 8191 0)) #(#{Graphics.ColorValue} #scaledRed:scaledGreen:scaledBlue: #(0 8191 0)) #(#{Graphics.ColorValue} #scaledRed:scaledGreen:scaledBlue: #(8191 0 0)) #(#{Graphics.ColorValue} #scaledRed:scaledGreen:scaledBlue: #(0 0 8191)) ) collect: [:each | (each at: 1) value perform: (each at: 2) withArguments: (each at: 3)])) usingBits: #[68 68 68 68 65 17 17 17 68 68 68 68 68 68 51 51 68 68 68 68 68 68 51 51 68 68 68 68 68 68 51 51 68 68 68 68 68 68 51 51 34 34 34 35 51 51 51 51 34 34 34 35 51 51 51 51 34 34 34 35 51 51 51 51 34 34 34 35 51 51 51 51 34 34 34 35 51 51 51 51 85 85 85 35 51 51 51 51 85 85 85 35 51 51 51 51 85 85 85 0 0 0 0 0 85 85 85 0 0 0 0 0 85 85 85 0 0 0 0 0 85 85 85 0 0 0 0 0]

By the way: #extent was missing.

| anImage aMaskImage cursor |
anImage := self loadCustomImage.
aMaskImage := Image
extent: anImage extent
depth: 1
bitsPerPixel: 1
palette: (CoveragePalette maxPixelValue: 1).
aMaskImage pixelsDo: [:x :y | aMaskImage atX: x y: y put: 1].
cursor := Cursor new.
cursor
setImage: anImage
mask: aMaskImage
hotSpot: 0@0
name: 'CustomCursor'.
cursor showWhile: [(Delay forSeconds: 1) wait]

Best regards,
Tom Grünewald


________

Carl Zeiss Industrielle Messtechnik GmbH
Softwareentwicklung/Software Development

T o m G r ü n e w a l d

73446 Oberkochen, Germany
tel: +49.7364.20-8541
fax: +49.7364.20-4800
email: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl–Zeiss–Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Axel Jaeger
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Handelsregister: Amtsgericht Ulm, HRB 501561
USt–IdNr.: DE 811 515 346

Inactive hide details for Travis Griggs <travisgriggs@gmail.com>Travis Griggs <[hidden email]>



An


Kopie


Thema

    Re: [vwnc] How to create a custom cursor?

On Nov 23, 2010, at 5:42 AM, Gruenewald, Tom wrote:

    Hello forum.
    I like to create a custom cursor (for a drag&drop event) which exceeds the size of 16x16 pixels.
    Why does the following procedure fail?


    | anImage aMaskImage cursor |
    anImage := self loadCustomImage.
    "anImage = Depth24Image(extent: 48 @ 48 depth: 24)"
    aMaskImage := Image
    extent: anImage
    depth: 1
    bitsPerPixel: 1
    palette: (CoveragePalette maxPixelValue: 1).
    aMaskImage pixelsDo: [:x :y | aMaskImage atX: x y: y put: 1].
    cursor := Cursor new.
    cursor
    setImage: anImage
    mask: aMaskImage
    hotSpot: 0@0
    name: 'CustomCursor'.
    cursor showWhile: [(Delay forSeconds: 1) wait]




    Unhandled exception: a primitive has failed
    HandleRegistry>>evaluateWithFullProtection:
    HandleRegistry>>registerValueOf:
    Cursor class(OSHandle class)>>registerValueOf:
    optimized [] in OSHandle>>handleValue:
    BlockClosure>>ifCurtailed:
    Cursor(OSHandle)>>handleValue:
    Cursor>>privateInstall
    Cursor>>beCursor
    Cursor class>>currentCursor:
    Cursor>>show
    Cursor>>showWhile:
    UndefinedObject>>unboundMethod
    [...]



    Best regards,
    Tom Grünewald


VisualWorks has a 32x32 cursor limit, due to xplatform limits.

--
Travis Griggs
Objologist
I multiply all time estimates by pi, to account for running around in circles.





----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

pic02173.gif (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to create a custom cursor?

Travis Griggs-4
On Nov 23, 2010, at 6:48 AM, Gruenewald, Tom wrote:

Sorry Mr. Griggs.
I cannot even make a Depth4Image(extent: 16 @ 16 depth: 3) image working.

Er, uh, yes, I didn't look at your example enough. You're limited to two colors as well. I wish neither restriction were in place, but I guess that's the limits imposed by the cross-platform story.

A better architecture (IMO), would probably be to
A) lift the cursor handling out of the VM completely
B) write the Smalltalk code that can query the platform's maximum depth and or extents
C) write the Smalltalk code that would take your candidate graphic, and make sure it fits within the current platforms abilities, adjusting by either downsampling the colors or scaling the size

While I was at it, I'd put in the prototype we have for separating "busy state" cursors from "spatial" cursors.

Back to my little dream cloud. 

--
Travis Griggs
Objologist
"I did not have time to write you a short program, so I wrote you a long one instead."


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc