Filled bezier shape?
Filled bezier shape?
Is it possible to draw a filled bezier shape (like PolyBezier_() api but filled) without brute force filling it with FillArea()? I am totally stumped in every single way possible. I do not even know how to draw a non-filled one...
A bit rough but it works.

Code: Select all
OpenWindow(0,0,0,800,600,"",$ca0001)
InitSprite()
OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)
*points=AllocateMemory(2*4*4)
PokeL(*points,100);start
PokeL(*points+4,100)
PokeL(*points+8,300);control
PokeL(*points+12,20)
PokeL(*points+16,500);control
PokeL(*points+20,580)
PokeL(*points+24,700);end
PokeL(*points+28,500)
hdc=StartDrawing(ScreenOutput())
FrontColor(#White)
BeginPath_(hdc)
PolyBezier_(hdc,*points,4)
MoveToEx_(hdc,100,100,*points)
LineTo_(hdc,700,500)
SetPolyFillMode_(hdc,#ALTERNATE)
EndPath_(hdc)
FillPath_(hdc)
StopDrawing()
Repeat
Until WaitWindowEvent()=16
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
-
- New User
- Posts: 4
- Joined: Sun May 18, 2008 6:46 pm
- Location: Welschbillig Germany
Why AllocateMemoryDerek wrote:Code: Select all
*points=AllocateMemory(2*4*4)

Code: Select all
OpenWindow(0,0,0,800,600,"",$ca0001) ; $ca0001?
InitSprite()
OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)
Dim points.Point(4)
points(0)\x = 100 ;start
points(0)\y = 100
points(1)\x = 300 ;control
points(1)\y = 20
points(2)\x = 500 ;control
points(2)\y = 580
points(3)\x = 700 ;end
points(3)\y = 500
hdc=StartDrawing(ScreenOutput())
FrontColor(#White)
BeginPath_(hdc)
PolyBezier_(hdc,@points(),4)
MoveToEx_(hdc,100,100,@points())
LineTo_(hdc,700,500)
SetPolyFillMode_(hdc,#ALTERNATE)
EndPath_(hdc)
FillPath_(hdc)
StopDrawing()
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
No, he just want's to know if it's possible!Derek wrote:Ah right, I thought you just wanted the end result.

There's some good examples here http://en.wikipedia.org/wiki/B%C3%A9zier_curve which have animations on them being produced. This might help get your mind around the idea.
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein