Writing a paint program à la MS Paint - how to interpolate between mouse move events?

后端 未结 6 530
陌清茗
陌清茗 2020-12-14 22:48

I want to write a paint program in the style of MS Paint.

For painting things on screen when the user moves the mouse, I have to wait for mouse move events and draw

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 23:16

    You can make them really smooth using splines: http://freespace.virgin.net/hugo.elias/graphics/x_bezier.htm

    But you'll have to delay the drawing of each line segment until one frame later, so that you have the start and end points, plus the next and previous points available for the calculation.

提交回复
热议问题