[Newbie]PaintBoxMorph enhancement question

Karl Ramberg karl.ramberg at chello.se
Sat Apr 22 18:28:08 UTC 2000


Hello,
I've been playing with the PaintBoxMorph trying to enhance on the
drawing cursor and found a paintbrush cursor that was used but
not visible (?)(Try the changeset). Also I wanted to make the brush like
the precision
brush in Photoshop a one pixel ring the size of the brush, xor(reverse?)
to the background.
Now I got a paintbrush, a white square with a one pixel border the size
of the brush,
transparency does not work and the bigger the extent of the brush the
more white space I get.
Anybody care to shed some light on this for me ?

Karl Ramberg

'From Squeak2.8alpha of 19 February 2000 [latest update: #2005] on 22
April 2000 at 8:07:27 pm'!

!PaintBoxMorph methodsFor: 'actions' stamp: 'kfr 4/22/2000 15:41'!
actionCursor
 "Return the cursor to use with this painting action/tool. Offset of the
form must be set."

 | ff width co larger box |

action == #paint: ifTrue: ["Make a cursor from the brush and the color"
  width _ self getNib width.
  co _ (currentCursor offset - ((width negated )@34)) min: (0 at 0).

  larger _ width negated + 10 @0 extent: currentCursor extent +
(width-10 at width).
  ff _ currentCursor copy: larger.
  ff fill: (box _ co negated extent: (width at width))
     fillColor: (Color r: 0.5 g: 0.5 b: 1.0).
  ff fill: (box insetBy: 1 at 1) fillColor: Color transparent.
  ff offset: co - (width at width //2).

  ^ ff].

 action == #erase: ifTrue: ["Make a cursor from the cursor and the
color"
  width _ self getNib width.
  co _ (currentCursor offset + (width//2 at 4)) min: (0 at 0).
  larger _ 0 at 0 extent: currentCursor extent + (width at width).
  ff _ currentCursor copy: larger.
  ff fill: (box _ co negated extent: (width at width))
     fillColor: (Color r: 0.5 g: 0.5 b: 1.0).
  ff fill: (box insetBy: 1 at 1) fillColor: Color transparent.
  ff offset: co - (width at width //2).
  ^ ff].

 ^ currentCursor
! !






More information about the Squeak-dev mailing list