[Cuis-dev] VectorGraphics and Morph
Juan Vuletich
juan at jvuletich.org
Fri Jul 17 11:57:37 PDT 2020
Hi Hilaire,
Several days ago I told I'd be working on a replacement for that
VectorGraphicsPasteUpMorph hack I'd done.
I have some experimental stuff working. The strategy is to use a
subclass of BitBltCanvas called HybridCanvas, that holds a VectorCanvas
in an instance variable. This means that vector graphics morphs can be
added to the world just like regular morphs. I had to do many changes to
the way that damage regions are handled, etc. It is kind of working, but
not without some hiccups, and maybe I'd change things again. So, this is
not yet ready for integration.
The code is attached. To test this you'll need a bit of patience. It
includes 25 files! Also, it works reasonably well (without a
VectorGraphics plugin!) in a rather fast machine. A slow machine might
make it unusable. The procedure is:
- Pull repos
- Start Cuis. Don’t use an image you care about!
- Install Updates
- Feature require: 'VectorGraphics'
- Open FileList on VGExperiments. Sort by name. Install each of the 25
files, in name order.
- Close all windows.
- Open a Workspace.
- evaluate each of the following lines
self runningWorld setCanvas: (HybridCanvas onForm: Display). "set hybrid
canvas"
self runningWorld canvas class. "validate canvas updated"
a _ EllipseMorph2 new openInWorld.
b _ EllipseMorph3 new.
c _ EllipseMorph4 new.
a addMorph: b.
b morphPosition: 100 at 0.
a addMorph: c.
c morphPosition: -100 at 0.
Then you can do stuff like
c stopStepping
c startStepping
Try the halo grow handle, etc.
Browse a bit the new EllipseMorph classes. These new classes _only_ now
how to draw themselves. They don't include #morphContainsPoint: or
#morphBoundsInWorld logic at all. Also check that the moment you modify
the #drawOn: method, everything works as expected. The idea is to make
writing new morphs as simple as possible, with the framework handling
the complex parts.
I plan to keep working on this, until it is mature enough for
integration in Cuis.
Thanks,
On 7/8/2020 10:42 AM, Juan Vuletich via Cuis-dev wrote:
> On 7/4/2020 5:46 PM, Hilaire Fernandes via Cuis-dev wrote:
>> containsPoint: aPoint
>> (super containsPoint: aPoint) ifFalse: [^ false].
>>
>> (closed and: [color isTransparent not]) ifTrue:
>> [ ^ (self filledForm pixelValueAt: aPoint - bounds topLeft + 1)> 0].
>>
>> self lineSegmentsDo:
>> [ :p1 :p2 |
>> (aPoint onLineFrom: p1 to: p2 within: (3 max: borderWidth+1//2) asFloat)
>> ifTrue: [^ true]].
>>
>> self arrowForms do:
>> [ :f | (f pixelValueAt: aPoint - f offset)> 0 ifTrue: [^ true]].
>>
>> ^ false
>
> Hi Hilaire,
>
> The first thing to mention is that PolygonMorph should not inherit
> from RectangleLikeMorph. PolygonMorph is more like M3Exp01Morph,
> M3Exp02Morph and M3Exp03Morph. But these also don't work well yet.
> Damage areas are not reported correctly and morphContainsPoint:
> doesn't work either.
>
> The VectorGraphicsPasteUpMorph was just a hack to let you play with
> vector graphics drawing, but I guess it is time to clean it up, make
> it usable, and integrate it. Then it will make sense to start building
> things like PolygonMorph in a clean style.
>
> Please give me a few days to work on this.
>
> Cheers,
> --
> Juan Vuletich
> www.cuis-smalltalk.org
> https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
> https://github.com/jvuletich
> https://www.linkedin.com/in/juan-vuletich-75611b3
> @JuanVuletich
--
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200717/36b84d4b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VGExperiments.zip
Type: application/x-zip-compressed
Size: 41586 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200717/36b84d4b/attachment-0001.bin>
More information about the Cuis-dev
mailing list