[Cuis-dev] How to fill a triangle?
Juan Vuletich
juan at jvuletich.org
Sun May 26 12:23:15 PDT 2019
On 5/26/2019 3:41 AM, Philip Bernhart via Cuis-dev wrote:
> Hi,
>
> I recently wanted to make a morph which draws
> a complex shape of itself and part of that is
> a triangle. And I have noticed that I don't
> know how to fill this triangle with color or
> how to implement that with GrafPort / BitBlt.
>
> Suggestions? Experiences?
>
>
> Thanks,
> Philip
Hi Philip,
In the future, Cuis will use VectorCanvas and VectorEngine (in
VectorGraphics.pck.st), which are capable of that, and much more. Right
now, the vector graphics engine is not able to draw the GUI in realtime,
but it can be used offline, like we do with TrueType.
So, you can do stuff like
Feature require: 'VectorGraphics'.
form := Form extent: 320 at 200 depth: 32.
canvas := VectorCanvas onForm: form..
canvas fillColor: Color red do: [
canvas
polyLine: {15 at 32. 230 at 150. 145 at 20. 15 at 32} ].
form fixAlpha.
form inspect
If the shapes you need don't change, you can use this technique and
cache the form for regular display.
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
More information about the Cuis-dev
mailing list