bachinger software <
[hidden email]> wrote in message
news:
[hidden email]...
> I couldn't find any example to revert a line by using rules.
> For example: A line is fixed with one side at: 50@50. The
> line should follow the mouse beam. But only the line from
> 50@50 to mouse beam point should be visible. I could figure
> it out by myself but a working example makes live easier.
You will probably want to use the SetROP2 API call. You will need to add
the methods bellow to support it in Dolphin (I don't think Dolphin includes
these methods yet).
I don't have an example of what you want to do, but I think I can explain a
way you could approach it.
You probably want to set this based on a mouse button pressed event:
lastPoint := startPoint := 50@50.
Then when there is a mouseMoved event you want to do the following:
canvas setRop2: 6.
"Draw a line from startPoint to lastPoint. This clears the old line."
lastPoint := "current mouse position (you can get it from the event)"
"Draw a line from startPoint to lastPoint. Now this makes the new line."
canvas setRop2: 13. "incase other things may need to redraw them selves."
You will find the code needed to call the API bellow. Hopefully my
explanation make sense.
Chris
============
!GDILibrary methodsFor!
setRop2: hdc fnDrawMode: aR2Constant
"CJD 6-20-2001 Addeds Rop2 masking, I added this because
Dolphin did not seem to have this feature."
<stdcall: dword SetROP2 handle sdword >
^self invalidCall
! !
!GDILibrary categoriesFor:
#setRop2:fnDrawMode:!*-primitives!*-unclassified!public! !
!Canvas methodsFor!
setRop2: r2Constant
"CJD 6-20-2001 Set the current drawing mode to r2Constant.
r2Constant
can be any one the following:
R2Black 1, R2White 16, R2Nop 11, R2Not 6, R2Copypen 13,
R2Notcopypen 4,
R2Mergepennot 14, R2Maskpennot 5, R2Mergenotpen 12, R2Masknotpen 3,
R2Mergepen 15, R2Notmergepen 2, R2Maskpen 9, R2Notmaskpen 8,
R2Xorpen 7, R2Notxorpen 10"
"self halt."
( GDILibrary default setRop2: self handle fnDrawMode: r2Constant ) =
0
ifTrue: [GDILibrary default systemError"^self error: 'OS Error'
"]
! !
!Canvas categoriesFor: #setRop2:!*-unclassified!public! !