You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Maxim Solodovnik <so...@gmail.com> on 2016/10/05 16:57:34 UTC

Get mouse coordinates on high speed

Hello,

Recently I got request to capture hand drawing from pen device using
as3 (latest apache flex)
unfortunately I got ungly results in case drawing is fast
in case mouse/pen moves slowly I got smooth curve

Is it possible to get mouse coordinates on higher frequency?

-- 
WBR
Maxim aka solomax

Re: Get mouse coordinates on high speed

Posted by Steve Easley <st...@redminnow.com>.
are you using an EnterFrame handler or a Timer? I think using a timer would be the best choice to capture the mouse location.


Steve Easley
Red Minnow Interactive, LLC
903 Eastwind Dr.
Westerville, OH 43081
614.893.8169





> On Oct 5, 2016, at 1:17 PM, Jason Taylor <ja...@dedoose.com> wrote:
> 
> can't you just up the frame per second of the swf to say 60, and if needed interpolate data points to smooth it?
> 
> -----Original Message-----
> From: Clint M [mailto:cmodien@gmail.com] 
> Sent: Wednesday, October 05, 2016 10:07 AM
> To: users@flex.apache.org
> Subject: Re: Get mouse coordinates on high speed
> 
> I think the simple answer to what you're asking is no.
> 
> Try posting the code you're using to draw the curve though.
> 
> Someone might spot something to help speed it up.
> 
> On Wed, Oct 5, 2016 at 9:57 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
> 
>> Hello,
>> 
>> Recently I got request to capture hand drawing from pen device using
>> as3 (latest apache flex)
>> unfortunately I got ungly results in case drawing is fast in case 
>> mouse/pen moves slowly I got smooth curve
>> 
>> Is it possible to get mouse coordinates on higher frequency?
>> 
>> --
>> WBR
>> Maxim aka solomax
>> 


Re: Get mouse coordinates on high speed

Posted by Javier Guerrero García <ja...@gmail.com>.
enterFrame:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Application.html#eventSummary

On Wed, Oct 12, 2016 at 8:35 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello All,
>
> just have tried to find "screenRedraw" event to add listener and was
> unable to :( which one should I use?
>
> I tried to add
>
> stage.addEventListener("screenRedraw", drawLine);
> But unfortunately got only 1 point instead of series.
> I'll to experiment with predefined FPS, setting it in runtime seems to
> have no effect
>
>
> On Thu, Oct 6, 2016 at 10:15 PM, Alex Harui <ah...@adobe.com> wrote:
> > Might be time to run the profiler to see how much work is being done on
> > each mouse event.
> > And you can try an ActionScript-only version of your test.  A variant of
> > such a test would track timestamps on the mouse events and not draw
> > anything until "much later" so you can get a sense for how many mouse
> > events you can get if you don't do any display updates at all.  It could
> > just be that the input rate is gated by the browser or Flash Player.
> >
> > On the other hand, remember that the Graphics object builds up a vector
> > list, so if you scribbled long enough there would be thousands and
> > eventually millions of lineTo's to render, and that would totally swamp
> > the renderer.  Depending on what kind of "undo" logic you want to
> support,
> > you can opt for a "Paint" approach and draw the vectors into a bitmap and
> > then forget about them, and/or retain your own vector list and somehow
> cut
> > off how far back you can undo.
> >
> > HTH,
> > -Alex
> >
> > On 10/6/16, 1:24 AM, "Maxim Solodovnik" <so...@gmail.com> wrote:
> >
> >>>> Another possibility: don't attach the events to the stage, but to the
> >>>>"area" object instead.
> >>Maybe I'm doing something wrong, but this is what I have started from,
> >>and it completely not working in my quickstart app
> >>
> >>will try "screenRedraw", we'll see it will allow more precise coordinates
> >>:)
> >>
> >>On Thu, Oct 6, 2016 at 3:21 PM, Javier Guerrero García
> >><ja...@gmail.com> wrote:
> >>> And the 60fps? :)
> >>>
> >>> Also, try this: attach ALWAYS the mousemove event listener (even
> >>>directly
> >>> on MXML) instead of attaching it "on demand", and make mouseDown and
> >>> mouseUp just set a "capturing" variable to either true of false.
> >>>
> >>> Another possibility: don't attach the events to the stage, but to the
> >>> "area" object instead.
> >>>
> >>> Another one: IIRC, there was a "screenRedraw" event, triggering right
> >>>after
> >>> each frame is painted (30-60 times per sec). You could attach the
> >>>capturing
> >>> function directly to that event, just checking if the "capturing"
> >>>variable
> >>> is true or false before proceed with the points.push.
> >>>
> >>> On Thu, Oct 6, 2016 at 10:03 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> >>> wrote:
> >>>
> >>>> I tried to change the code as follows
> >>>> grab points in event handler [1], then actually draw it after
> >>>> capturing is over [2]
> >>>> The result curve is not smooth in case of fast, long distance moves
> >>>>
> >>>> [1] https://github.com/solomax/FlexSandbox/blob/master/web/
> >>>> src/Main1.mxml#L37
> >>>> [2] https://github.com/solomax/FlexSandbox/blob/master/web/
> >>>> src/Main1.mxml#L31
> >>>>
> >>>> On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
> >>>> <ja...@gmail.com> wrote:
> >>>> > Yes, I understood, but you can do it in many ways:
> >>>> >
> >>>> >    - Capture mouse coordinates, and draw the new pixel on a bitmap
> >>>>placed
> >>>> >    underneath
> >>>> >    - Capture mouse coordinates, and draw a new <Line> object from
> the
> >>>> last
> >>>> >    captured point to the new coordinates, and so on
> >>>> >    - Capture mouse coordinates, and perfom a graphics.lineTo on a
> >>>>Sprite
> >>>> on
> >>>> >    each mouse move (a one liner for a one liner :)
> >>>> >
> >>>> > I think the vector approach should perform better on redraws, and I
> >>>> really
> >>>> > do think your problem is right there on the fullscreen redraws:
> >>>>60fps or
> >>>> > even 30fps should be more than enough to capture a signature.
> >>>> >
> >>>> > To confirm first, try first separating the areas, and see it that
> >>>>makes
> >>>> it
> >>>> > smoother :)
> >>>> >
> >>>> > On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik
> >>>><so...@gmail.com>
> >>>> > wrote:
> >>>> >
> >>>> >> It sort of "pencil drawing" by mouse/pen
> >>>> >> I'll try to capture points and draw it later(or better in separated
> >>>> thread)
> >>>> >>
> >>>> >> Thanks for the pointer
> >>>> >>
> >>>> >> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
> >>>> >> <ja...@gmail.com> wrote:
> >>>> >> > Hi Maxim!
> >>>> >> >
> >>>> >> > Are you capturing the points on line objects, or on a bitmap
> >>>>drawn at
> >>>> the
> >>>> >> > bottom that has to be interpolated and redrawn on every mouse
> >>>> movement?
> >>>> >> Try
> >>>> >> > separating the capture and paint areas, capturing line objects
> >>>> instead of
> >>>> >> > pixels on a bitmap, or at least draw the bitmap with the lowest
> >>>> posible
> >>>> >> > interpolation quality, to see if it helps.
> >>>> >> >
> >>>> >> > Hope it works :)
> >>>> >> >
> >>>> >> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <
> >>>> solomax666@gmail.com>
> >>>> >> > wrote:
> >>>> >> >
> >>>> >> >> changing FPS to 60 doesn't help :( (originally it was 30)
> >>>> >> >> Final code for capturing events and drawing is the same as
> >>>>prototype
> >>>> >> code
> >>>> >> >> still got ugly, non-smooth curve in case mouse moving very fast
> >>>> >> >>
> >>>> >> >> Line in much smoother in Gimp
> >>>> >> >> In fact Flex desktop app produces smooth enough line
> >>>> >> >> will try to create browser quick start and double check
> >>>> >> >>
> >>>> >> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <
> >>>> solomax666@gmail.com>
> >>>> >> >> wrote:
> >>>> >> >> > Hello,
> >>>> >> >> >
> >>>> >> >> > Thanks a lot for the quick answers, definitely flex is one of
> >>>>my
> >>>> >> >> > favorite communities :)
> >>>> >> >> > Here is example project: https://github.com/solomax/
> FlexSandbox
> >>>> >> >> > since it is desktop and tiny it looks not that bad
> >>>> >> >> > In my main project the resulting line is not smooth at all :(
> >>>> >> >> >
> >>>> >> >> > I'll try to check the code and remove any delays, thanks for
> >>>>the
> >>>> >> pointer.
> >>>> >> >> >
> >>>> >> >> > Additionally I'll try to check FFT, I have tried to add
> >>>>additional
> >>>> >> >> > points and use cubicCurveTo, but was unable to finish this (it
> >>>>is
> >>>> >> >> > currently commented)
> >>>> >> >> >
> >>>> >> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net>
> >>>>wrote:
> >>>> >> >> >> Alex Harui wrote
> >>>> >> >> >>>>can't you just up the frame per second of the swf to say 60,
> >>>>and
> >>>> if
> >>>> >> >> >>>>needed interpolate data points to smooth it?
> >>>> >> >> >>> That is a possibility, but the interpolation code may also
> >>>>affect
> >>>> >> input
> >>>> >> >> >>> rate.
> >>>> >> >> >>
> >>>> >> >> >> For this approach it might be helpful to google with "spline
> >>>> >> >> interpolation"
> >>>> >> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some
> >>>> ready to
> >>>> >> >> use
> >>>> >> >> >> AS3 implementations.
> >>>> >> >> >>
> >>>> >> >> >> Olaf
> >>>> >> >> >>
> >>>> >> >> >>
> >>>> >> >> >>
> >>>> >> >> >>
> >>>> >> >> >> --
> >>>> >> >> >> View this message in context: http://apache-flex-users.
> >>>> >> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
> >>>> >> >> speed-tp13737p13748.html
> >>>> >> >> >> Sent from the Apache Flex Users mailing list archive at
> >>>> Nabble.com.
> >>>> >> >> >
> >>>> >> >> >
> >>>> >> >> >
> >>>> >> >> > --
> >>>> >> >> > WBR
> >>>> >> >> > Maxim aka solomax
> >>>> >> >>
> >>>> >> >>
> >>>> >> >>
> >>>> >> >> --
> >>>> >> >> WBR
> >>>> >> >> Maxim aka solomax
> >>>> >> >>
> >>>> >>
> >>>> >>
> >>>> >>
> >>>> >> --
> >>>> >> WBR
> >>>> >> Maxim aka solomax
> >>>> >>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> WBR
> >>>> Maxim aka solomax
> >>>>
> >>
> >>
> >>
> >>--
> >>WBR
> >>Maxim aka solomax
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Get mouse coordinates on high speed

Posted by Maxim Solodovnik <so...@gmail.com>.
Hello All,

just have tried to find "screenRedraw" event to add listener and was
unable to :( which one should I use?

I tried to add

stage.addEventListener("screenRedraw", drawLine);
But unfortunately got only 1 point instead of series.
I'll to experiment with predefined FPS, setting it in runtime seems to
have no effect


On Thu, Oct 6, 2016 at 10:15 PM, Alex Harui <ah...@adobe.com> wrote:
> Might be time to run the profiler to see how much work is being done on
> each mouse event.
> And you can try an ActionScript-only version of your test.  A variant of
> such a test would track timestamps on the mouse events and not draw
> anything until "much later" so you can get a sense for how many mouse
> events you can get if you don't do any display updates at all.  It could
> just be that the input rate is gated by the browser or Flash Player.
>
> On the other hand, remember that the Graphics object builds up a vector
> list, so if you scribbled long enough there would be thousands and
> eventually millions of lineTo's to render, and that would totally swamp
> the renderer.  Depending on what kind of "undo" logic you want to support,
> you can opt for a "Paint" approach and draw the vectors into a bitmap and
> then forget about them, and/or retain your own vector list and somehow cut
> off how far back you can undo.
>
> HTH,
> -Alex
>
> On 10/6/16, 1:24 AM, "Maxim Solodovnik" <so...@gmail.com> wrote:
>
>>>> Another possibility: don't attach the events to the stage, but to the
>>>>"area" object instead.
>>Maybe I'm doing something wrong, but this is what I have started from,
>>and it completely not working in my quickstart app
>>
>>will try "screenRedraw", we'll see it will allow more precise coordinates
>>:)
>>
>>On Thu, Oct 6, 2016 at 3:21 PM, Javier Guerrero García
>><ja...@gmail.com> wrote:
>>> And the 60fps? :)
>>>
>>> Also, try this: attach ALWAYS the mousemove event listener (even
>>>directly
>>> on MXML) instead of attaching it "on demand", and make mouseDown and
>>> mouseUp just set a "capturing" variable to either true of false.
>>>
>>> Another possibility: don't attach the events to the stage, but to the
>>> "area" object instead.
>>>
>>> Another one: IIRC, there was a "screenRedraw" event, triggering right
>>>after
>>> each frame is painted (30-60 times per sec). You could attach the
>>>capturing
>>> function directly to that event, just checking if the "capturing"
>>>variable
>>> is true or false before proceed with the points.push.
>>>
>>> On Thu, Oct 6, 2016 at 10:03 AM, Maxim Solodovnik <so...@gmail.com>
>>> wrote:
>>>
>>>> I tried to change the code as follows
>>>> grab points in event handler [1], then actually draw it after
>>>> capturing is over [2]
>>>> The result curve is not smooth in case of fast, long distance moves
>>>>
>>>> [1] https://github.com/solomax/FlexSandbox/blob/master/web/
>>>> src/Main1.mxml#L37
>>>> [2] https://github.com/solomax/FlexSandbox/blob/master/web/
>>>> src/Main1.mxml#L31
>>>>
>>>> On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
>>>> <ja...@gmail.com> wrote:
>>>> > Yes, I understood, but you can do it in many ways:
>>>> >
>>>> >    - Capture mouse coordinates, and draw the new pixel on a bitmap
>>>>placed
>>>> >    underneath
>>>> >    - Capture mouse coordinates, and draw a new <Line> object from the
>>>> last
>>>> >    captured point to the new coordinates, and so on
>>>> >    - Capture mouse coordinates, and perfom a graphics.lineTo on a
>>>>Sprite
>>>> on
>>>> >    each mouse move (a one liner for a one liner :)
>>>> >
>>>> > I think the vector approach should perform better on redraws, and I
>>>> really
>>>> > do think your problem is right there on the fullscreen redraws:
>>>>60fps or
>>>> > even 30fps should be more than enough to capture a signature.
>>>> >
>>>> > To confirm first, try first separating the areas, and see it that
>>>>makes
>>>> it
>>>> > smoother :)
>>>> >
>>>> > On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik
>>>><so...@gmail.com>
>>>> > wrote:
>>>> >
>>>> >> It sort of "pencil drawing" by mouse/pen
>>>> >> I'll try to capture points and draw it later(or better in separated
>>>> thread)
>>>> >>
>>>> >> Thanks for the pointer
>>>> >>
>>>> >> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
>>>> >> <ja...@gmail.com> wrote:
>>>> >> > Hi Maxim!
>>>> >> >
>>>> >> > Are you capturing the points on line objects, or on a bitmap
>>>>drawn at
>>>> the
>>>> >> > bottom that has to be interpolated and redrawn on every mouse
>>>> movement?
>>>> >> Try
>>>> >> > separating the capture and paint areas, capturing line objects
>>>> instead of
>>>> >> > pixels on a bitmap, or at least draw the bitmap with the lowest
>>>> posible
>>>> >> > interpolation quality, to see if it helps.
>>>> >> >
>>>> >> > Hope it works :)
>>>> >> >
>>>> >> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <
>>>> solomax666@gmail.com>
>>>> >> > wrote:
>>>> >> >
>>>> >> >> changing FPS to 60 doesn't help :( (originally it was 30)
>>>> >> >> Final code for capturing events and drawing is the same as
>>>>prototype
>>>> >> code
>>>> >> >> still got ugly, non-smooth curve in case mouse moving very fast
>>>> >> >>
>>>> >> >> Line in much smoother in Gimp
>>>> >> >> In fact Flex desktop app produces smooth enough line
>>>> >> >> will try to create browser quick start and double check
>>>> >> >>
>>>> >> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <
>>>> solomax666@gmail.com>
>>>> >> >> wrote:
>>>> >> >> > Hello,
>>>> >> >> >
>>>> >> >> > Thanks a lot for the quick answers, definitely flex is one of
>>>>my
>>>> >> >> > favorite communities :)
>>>> >> >> > Here is example project: https://github.com/solomax/FlexSandbox
>>>> >> >> > since it is desktop and tiny it looks not that bad
>>>> >> >> > In my main project the resulting line is not smooth at all :(
>>>> >> >> >
>>>> >> >> > I'll try to check the code and remove any delays, thanks for
>>>>the
>>>> >> pointer.
>>>> >> >> >
>>>> >> >> > Additionally I'll try to check FFT, I have tried to add
>>>>additional
>>>> >> >> > points and use cubicCurveTo, but was unable to finish this (it
>>>>is
>>>> >> >> > currently commented)
>>>> >> >> >
>>>> >> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net>
>>>>wrote:
>>>> >> >> >> Alex Harui wrote
>>>> >> >> >>>>can't you just up the frame per second of the swf to say 60,
>>>>and
>>>> if
>>>> >> >> >>>>needed interpolate data points to smooth it?
>>>> >> >> >>> That is a possibility, but the interpolation code may also
>>>>affect
>>>> >> input
>>>> >> >> >>> rate.
>>>> >> >> >>
>>>> >> >> >> For this approach it might be helpful to google with "spline
>>>> >> >> interpolation"
>>>> >> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some
>>>> ready to
>>>> >> >> use
>>>> >> >> >> AS3 implementations.
>>>> >> >> >>
>>>> >> >> >> Olaf
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> --
>>>> >> >> >> View this message in context: http://apache-flex-users.
>>>> >> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
>>>> >> >> speed-tp13737p13748.html
>>>> >> >> >> Sent from the Apache Flex Users mailing list archive at
>>>> Nabble.com.
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >> >> > --
>>>> >> >> > WBR
>>>> >> >> > Maxim aka solomax
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> --
>>>> >> >> WBR
>>>> >> >> Maxim aka solomax
>>>> >> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >> --
>>>> >> WBR
>>>> >> Maxim aka solomax
>>>> >>
>>>>
>>>>
>>>>
>>>> --
>>>> WBR
>>>> Maxim aka solomax
>>>>
>>
>>
>>
>>--
>>WBR
>>Maxim aka solomax
>



-- 
WBR
Maxim aka solomax

Re: Get mouse coordinates on high speed

Posted by Alex Harui <ah...@adobe.com>.
Might be time to run the profiler to see how much work is being done on
each mouse event.
And you can try an ActionScript-only version of your test.  A variant of
such a test would track timestamps on the mouse events and not draw
anything until "much later" so you can get a sense for how many mouse
events you can get if you don't do any display updates at all.  It could
just be that the input rate is gated by the browser or Flash Player.

On the other hand, remember that the Graphics object builds up a vector
list, so if you scribbled long enough there would be thousands and
eventually millions of lineTo's to render, and that would totally swamp
the renderer.  Depending on what kind of "undo" logic you want to support,
you can opt for a "Paint" approach and draw the vectors into a bitmap and
then forget about them, and/or retain your own vector list and somehow cut
off how far back you can undo.

HTH,
-Alex

On 10/6/16, 1:24 AM, "Maxim Solodovnik" <so...@gmail.com> wrote:

>>> Another possibility: don't attach the events to the stage, but to the
>>>"area" object instead.
>Maybe I'm doing something wrong, but this is what I have started from,
>and it completely not working in my quickstart app
>
>will try "screenRedraw", we'll see it will allow more precise coordinates
>:)
>
>On Thu, Oct 6, 2016 at 3:21 PM, Javier Guerrero García
><ja...@gmail.com> wrote:
>> And the 60fps? :)
>>
>> Also, try this: attach ALWAYS the mousemove event listener (even
>>directly
>> on MXML) instead of attaching it "on demand", and make mouseDown and
>> mouseUp just set a "capturing" variable to either true of false.
>>
>> Another possibility: don't attach the events to the stage, but to the
>> "area" object instead.
>>
>> Another one: IIRC, there was a "screenRedraw" event, triggering right
>>after
>> each frame is painted (30-60 times per sec). You could attach the
>>capturing
>> function directly to that event, just checking if the "capturing"
>>variable
>> is true or false before proceed with the points.push.
>>
>> On Thu, Oct 6, 2016 at 10:03 AM, Maxim Solodovnik <so...@gmail.com>
>> wrote:
>>
>>> I tried to change the code as follows
>>> grab points in event handler [1], then actually draw it after
>>> capturing is over [2]
>>> The result curve is not smooth in case of fast, long distance moves
>>>
>>> [1] https://github.com/solomax/FlexSandbox/blob/master/web/
>>> src/Main1.mxml#L37
>>> [2] https://github.com/solomax/FlexSandbox/blob/master/web/
>>> src/Main1.mxml#L31
>>>
>>> On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
>>> <ja...@gmail.com> wrote:
>>> > Yes, I understood, but you can do it in many ways:
>>> >
>>> >    - Capture mouse coordinates, and draw the new pixel on a bitmap
>>>placed
>>> >    underneath
>>> >    - Capture mouse coordinates, and draw a new <Line> object from the
>>> last
>>> >    captured point to the new coordinates, and so on
>>> >    - Capture mouse coordinates, and perfom a graphics.lineTo on a
>>>Sprite
>>> on
>>> >    each mouse move (a one liner for a one liner :)
>>> >
>>> > I think the vector approach should perform better on redraws, and I
>>> really
>>> > do think your problem is right there on the fullscreen redraws:
>>>60fps or
>>> > even 30fps should be more than enough to capture a signature.
>>> >
>>> > To confirm first, try first separating the areas, and see it that
>>>makes
>>> it
>>> > smoother :)
>>> >
>>> > On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik
>>><so...@gmail.com>
>>> > wrote:
>>> >
>>> >> It sort of "pencil drawing" by mouse/pen
>>> >> I'll try to capture points and draw it later(or better in separated
>>> thread)
>>> >>
>>> >> Thanks for the pointer
>>> >>
>>> >> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
>>> >> <ja...@gmail.com> wrote:
>>> >> > Hi Maxim!
>>> >> >
>>> >> > Are you capturing the points on line objects, or on a bitmap
>>>drawn at
>>> the
>>> >> > bottom that has to be interpolated and redrawn on every mouse
>>> movement?
>>> >> Try
>>> >> > separating the capture and paint areas, capturing line objects
>>> instead of
>>> >> > pixels on a bitmap, or at least draw the bitmap with the lowest
>>> posible
>>> >> > interpolation quality, to see if it helps.
>>> >> >
>>> >> > Hope it works :)
>>> >> >
>>> >> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <
>>> solomax666@gmail.com>
>>> >> > wrote:
>>> >> >
>>> >> >> changing FPS to 60 doesn't help :( (originally it was 30)
>>> >> >> Final code for capturing events and drawing is the same as
>>>prototype
>>> >> code
>>> >> >> still got ugly, non-smooth curve in case mouse moving very fast
>>> >> >>
>>> >> >> Line in much smoother in Gimp
>>> >> >> In fact Flex desktop app produces smooth enough line
>>> >> >> will try to create browser quick start and double check
>>> >> >>
>>> >> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <
>>> solomax666@gmail.com>
>>> >> >> wrote:
>>> >> >> > Hello,
>>> >> >> >
>>> >> >> > Thanks a lot for the quick answers, definitely flex is one of
>>>my
>>> >> >> > favorite communities :)
>>> >> >> > Here is example project: https://github.com/solomax/FlexSandbox
>>> >> >> > since it is desktop and tiny it looks not that bad
>>> >> >> > In my main project the resulting line is not smooth at all :(
>>> >> >> >
>>> >> >> > I'll try to check the code and remove any delays, thanks for
>>>the
>>> >> pointer.
>>> >> >> >
>>> >> >> > Additionally I'll try to check FFT, I have tried to add
>>>additional
>>> >> >> > points and use cubicCurveTo, but was unable to finish this (it
>>>is
>>> >> >> > currently commented)
>>> >> >> >
>>> >> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net>
>>>wrote:
>>> >> >> >> Alex Harui wrote
>>> >> >> >>>>can't you just up the frame per second of the swf to say 60,
>>>and
>>> if
>>> >> >> >>>>needed interpolate data points to smooth it?
>>> >> >> >>> That is a possibility, but the interpolation code may also
>>>affect
>>> >> input
>>> >> >> >>> rate.
>>> >> >> >>
>>> >> >> >> For this approach it might be helpful to google with "spline
>>> >> >> interpolation"
>>> >> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some
>>> ready to
>>> >> >> use
>>> >> >> >> AS3 implementations.
>>> >> >> >>
>>> >> >> >> Olaf
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> --
>>> >> >> >> View this message in context: http://apache-flex-users.
>>> >> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
>>> >> >> speed-tp13737p13748.html
>>> >> >> >> Sent from the Apache Flex Users mailing list archive at
>>> Nabble.com.
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> > --
>>> >> >> > WBR
>>> >> >> > Maxim aka solomax
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> WBR
>>> >> >> Maxim aka solomax
>>> >> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> WBR
>>> >> Maxim aka solomax
>>> >>
>>>
>>>
>>>
>>> --
>>> WBR
>>> Maxim aka solomax
>>>
>
>
>
>-- 
>WBR
>Maxim aka solomax


Re: Get mouse coordinates on high speed

Posted by Javier Guerrero García <ja...@gmail.com>.
And don't forget <mx:application frameRate="60"> :)

On Thu, Oct 6, 2016 at 10:24 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> >> Another possibility: don't attach the events to the stage, but to the
> "area" object instead.
> Maybe I'm doing something wrong, but this is what I have started from,
> and it completely not working in my quickstart app
>
> will try "screenRedraw", we'll see it will allow more precise coordinates
> :)
>
> On Thu, Oct 6, 2016 at 3:21 PM, Javier Guerrero García
> <ja...@gmail.com> wrote:
> > And the 60fps? :)
> >
> > Also, try this: attach ALWAYS the mousemove event listener (even directly
> > on MXML) instead of attaching it "on demand", and make mouseDown and
> > mouseUp just set a "capturing" variable to either true of false.
> >
> > Another possibility: don't attach the events to the stage, but to the
> > "area" object instead.
> >
> > Another one: IIRC, there was a "screenRedraw" event, triggering right
> after
> > each frame is painted (30-60 times per sec). You could attach the
> capturing
> > function directly to that event, just checking if the "capturing"
> variable
> > is true or false before proceed with the points.push.
> >
> > On Thu, Oct 6, 2016 at 10:03 AM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> >> I tried to change the code as follows
> >> grab points in event handler [1], then actually draw it after
> >> capturing is over [2]
> >> The result curve is not smooth in case of fast, long distance moves
> >>
> >> [1] https://github.com/solomax/FlexSandbox/blob/master/web/
> >> src/Main1.mxml#L37
> >> [2] https://github.com/solomax/FlexSandbox/blob/master/web/
> >> src/Main1.mxml#L31
> >>
> >> On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
> >> <ja...@gmail.com> wrote:
> >> > Yes, I understood, but you can do it in many ways:
> >> >
> >> >    - Capture mouse coordinates, and draw the new pixel on a bitmap
> placed
> >> >    underneath
> >> >    - Capture mouse coordinates, and draw a new <Line> object from the
> >> last
> >> >    captured point to the new coordinates, and so on
> >> >    - Capture mouse coordinates, and perfom a graphics.lineTo on a
> Sprite
> >> on
> >> >    each mouse move (a one liner for a one liner :)
> >> >
> >> > I think the vector approach should perform better on redraws, and I
> >> really
> >> > do think your problem is right there on the fullscreen redraws: 60fps
> or
> >> > even 30fps should be more than enough to capture a signature.
> >> >
> >> > To confirm first, try first separating the areas, and see it that
> makes
> >> it
> >> > smoother :)
> >> >
> >> > On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> >> > wrote:
> >> >
> >> >> It sort of "pencil drawing" by mouse/pen
> >> >> I'll try to capture points and draw it later(or better in separated
> >> thread)
> >> >>
> >> >> Thanks for the pointer
> >> >>
> >> >> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
> >> >> <ja...@gmail.com> wrote:
> >> >> > Hi Maxim!
> >> >> >
> >> >> > Are you capturing the points on line objects, or on a bitmap drawn
> at
> >> the
> >> >> > bottom that has to be interpolated and redrawn on every mouse
> >> movement?
> >> >> Try
> >> >> > separating the capture and paint areas, capturing line objects
> >> instead of
> >> >> > pixels on a bitmap, or at least draw the bitmap with the lowest
> >> posible
> >> >> > interpolation quality, to see if it helps.
> >> >> >
> >> >> > Hope it works :)
> >> >> >
> >> >> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <
> >> solomax666@gmail.com>
> >> >> > wrote:
> >> >> >
> >> >> >> changing FPS to 60 doesn't help :( (originally it was 30)
> >> >> >> Final code for capturing events and drawing is the same as
> prototype
> >> >> code
> >> >> >> still got ugly, non-smooth curve in case mouse moving very fast
> >> >> >>
> >> >> >> Line in much smoother in Gimp
> >> >> >> In fact Flex desktop app produces smooth enough line
> >> >> >> will try to create browser quick start and double check
> >> >> >>
> >> >> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <
> >> solomax666@gmail.com>
> >> >> >> wrote:
> >> >> >> > Hello,
> >> >> >> >
> >> >> >> > Thanks a lot for the quick answers, definitely flex is one of my
> >> >> >> > favorite communities :)
> >> >> >> > Here is example project: https://github.com/solomax/FlexSandbox
> >> >> >> > since it is desktop and tiny it looks not that bad
> >> >> >> > In my main project the resulting line is not smooth at all :(
> >> >> >> >
> >> >> >> > I'll try to check the code and remove any delays, thanks for the
> >> >> pointer.
> >> >> >> >
> >> >> >> > Additionally I'll try to check FFT, I have tried to add
> additional
> >> >> >> > points and use cubicCurveTo, but was unable to finish this (it
> is
> >> >> >> > currently commented)
> >> >> >> >
> >> >> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net>
> wrote:
> >> >> >> >> Alex Harui wrote
> >> >> >> >>>>can't you just up the frame per second of the swf to say 60,
> and
> >> if
> >> >> >> >>>>needed interpolate data points to smooth it?
> >> >> >> >>> That is a possibility, but the interpolation code may also
> affect
> >> >> input
> >> >> >> >>> rate.
> >> >> >> >>
> >> >> >> >> For this approach it might be helpful to google with "spline
> >> >> >> interpolation"
> >> >> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some
> >> ready to
> >> >> >> use
> >> >> >> >> AS3 implementations.
> >> >> >> >>
> >> >> >> >> Olaf
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context: http://apache-flex-users.
> >> >> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
> >> >> >> speed-tp13737p13748.html
> >> >> >> >> Sent from the Apache Flex Users mailing list archive at
> >> Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > WBR
> >> >> >> > Maxim aka solomax
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> WBR
> >> >> >> Maxim aka solomax
> >> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> WBR
> >> >> Maxim aka solomax
> >> >>
> >>
> >>
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Get mouse coordinates on high speed

Posted by Maxim Solodovnik <so...@gmail.com>.
>> Another possibility: don't attach the events to the stage, but to the "area" object instead.
Maybe I'm doing something wrong, but this is what I have started from,
and it completely not working in my quickstart app

will try "screenRedraw", we'll see it will allow more precise coordinates :)

On Thu, Oct 6, 2016 at 3:21 PM, Javier Guerrero García
<ja...@gmail.com> wrote:
> And the 60fps? :)
>
> Also, try this: attach ALWAYS the mousemove event listener (even directly
> on MXML) instead of attaching it "on demand", and make mouseDown and
> mouseUp just set a "capturing" variable to either true of false.
>
> Another possibility: don't attach the events to the stage, but to the
> "area" object instead.
>
> Another one: IIRC, there was a "screenRedraw" event, triggering right after
> each frame is painted (30-60 times per sec). You could attach the capturing
> function directly to that event, just checking if the "capturing" variable
> is true or false before proceed with the points.push.
>
> On Thu, Oct 6, 2016 at 10:03 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
>> I tried to change the code as follows
>> grab points in event handler [1], then actually draw it after
>> capturing is over [2]
>> The result curve is not smooth in case of fast, long distance moves
>>
>> [1] https://github.com/solomax/FlexSandbox/blob/master/web/
>> src/Main1.mxml#L37
>> [2] https://github.com/solomax/FlexSandbox/blob/master/web/
>> src/Main1.mxml#L31
>>
>> On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
>> <ja...@gmail.com> wrote:
>> > Yes, I understood, but you can do it in many ways:
>> >
>> >    - Capture mouse coordinates, and draw the new pixel on a bitmap placed
>> >    underneath
>> >    - Capture mouse coordinates, and draw a new <Line> object from the
>> last
>> >    captured point to the new coordinates, and so on
>> >    - Capture mouse coordinates, and perfom a graphics.lineTo on a Sprite
>> on
>> >    each mouse move (a one liner for a one liner :)
>> >
>> > I think the vector approach should perform better on redraws, and I
>> really
>> > do think your problem is right there on the fullscreen redraws: 60fps or
>> > even 30fps should be more than enough to capture a signature.
>> >
>> > To confirm first, try first separating the areas, and see it that makes
>> it
>> > smoother :)
>> >
>> > On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik <so...@gmail.com>
>> > wrote:
>> >
>> >> It sort of "pencil drawing" by mouse/pen
>> >> I'll try to capture points and draw it later(or better in separated
>> thread)
>> >>
>> >> Thanks for the pointer
>> >>
>> >> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
>> >> <ja...@gmail.com> wrote:
>> >> > Hi Maxim!
>> >> >
>> >> > Are you capturing the points on line objects, or on a bitmap drawn at
>> the
>> >> > bottom that has to be interpolated and redrawn on every mouse
>> movement?
>> >> Try
>> >> > separating the capture and paint areas, capturing line objects
>> instead of
>> >> > pixels on a bitmap, or at least draw the bitmap with the lowest
>> posible
>> >> > interpolation quality, to see if it helps.
>> >> >
>> >> > Hope it works :)
>> >> >
>> >> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <
>> solomax666@gmail.com>
>> >> > wrote:
>> >> >
>> >> >> changing FPS to 60 doesn't help :( (originally it was 30)
>> >> >> Final code for capturing events and drawing is the same as prototype
>> >> code
>> >> >> still got ugly, non-smooth curve in case mouse moving very fast
>> >> >>
>> >> >> Line in much smoother in Gimp
>> >> >> In fact Flex desktop app produces smooth enough line
>> >> >> will try to create browser quick start and double check
>> >> >>
>> >> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <
>> solomax666@gmail.com>
>> >> >> wrote:
>> >> >> > Hello,
>> >> >> >
>> >> >> > Thanks a lot for the quick answers, definitely flex is one of my
>> >> >> > favorite communities :)
>> >> >> > Here is example project: https://github.com/solomax/FlexSandbox
>> >> >> > since it is desktop and tiny it looks not that bad
>> >> >> > In my main project the resulting line is not smooth at all :(
>> >> >> >
>> >> >> > I'll try to check the code and remove any delays, thanks for the
>> >> pointer.
>> >> >> >
>> >> >> > Additionally I'll try to check FFT, I have tried to add additional
>> >> >> > points and use cubicCurveTo, but was unable to finish this (it is
>> >> >> > currently commented)
>> >> >> >
>> >> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
>> >> >> >> Alex Harui wrote
>> >> >> >>>>can't you just up the frame per second of the swf to say 60, and
>> if
>> >> >> >>>>needed interpolate data points to smooth it?
>> >> >> >>> That is a possibility, but the interpolation code may also affect
>> >> input
>> >> >> >>> rate.
>> >> >> >>
>> >> >> >> For this approach it might be helpful to google with "spline
>> >> >> interpolation"
>> >> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some
>> ready to
>> >> >> use
>> >> >> >> AS3 implementations.
>> >> >> >>
>> >> >> >> Olaf
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context: http://apache-flex-users.
>> >> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
>> >> >> speed-tp13737p13748.html
>> >> >> >> Sent from the Apache Flex Users mailing list archive at
>> Nabble.com.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > WBR
>> >> >> > Maxim aka solomax
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> WBR
>> >> >> Maxim aka solomax
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> WBR
>> >> Maxim aka solomax
>> >>
>>
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>



-- 
WBR
Maxim aka solomax

Re: Get mouse coordinates on high speed

Posted by Javier Guerrero García <ja...@gmail.com>.
And the 60fps? :)

Also, try this: attach ALWAYS the mousemove event listener (even directly
on MXML) instead of attaching it "on demand", and make mouseDown and
mouseUp just set a "capturing" variable to either true of false.

Another possibility: don't attach the events to the stage, but to the
"area" object instead.

Another one: IIRC, there was a "screenRedraw" event, triggering right after
each frame is painted (30-60 times per sec). You could attach the capturing
function directly to that event, just checking if the "capturing" variable
is true or false before proceed with the points.push.

On Thu, Oct 6, 2016 at 10:03 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> I tried to change the code as follows
> grab points in event handler [1], then actually draw it after
> capturing is over [2]
> The result curve is not smooth in case of fast, long distance moves
>
> [1] https://github.com/solomax/FlexSandbox/blob/master/web/
> src/Main1.mxml#L37
> [2] https://github.com/solomax/FlexSandbox/blob/master/web/
> src/Main1.mxml#L31
>
> On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
> <ja...@gmail.com> wrote:
> > Yes, I understood, but you can do it in many ways:
> >
> >    - Capture mouse coordinates, and draw the new pixel on a bitmap placed
> >    underneath
> >    - Capture mouse coordinates, and draw a new <Line> object from the
> last
> >    captured point to the new coordinates, and so on
> >    - Capture mouse coordinates, and perfom a graphics.lineTo on a Sprite
> on
> >    each mouse move (a one liner for a one liner :)
> >
> > I think the vector approach should perform better on redraws, and I
> really
> > do think your problem is right there on the fullscreen redraws: 60fps or
> > even 30fps should be more than enough to capture a signature.
> >
> > To confirm first, try first separating the areas, and see it that makes
> it
> > smoother :)
> >
> > On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> >> It sort of "pencil drawing" by mouse/pen
> >> I'll try to capture points and draw it later(or better in separated
> thread)
> >>
> >> Thanks for the pointer
> >>
> >> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
> >> <ja...@gmail.com> wrote:
> >> > Hi Maxim!
> >> >
> >> > Are you capturing the points on line objects, or on a bitmap drawn at
> the
> >> > bottom that has to be interpolated and redrawn on every mouse
> movement?
> >> Try
> >> > separating the capture and paint areas, capturing line objects
> instead of
> >> > pixels on a bitmap, or at least draw the bitmap with the lowest
> posible
> >> > interpolation quality, to see if it helps.
> >> >
> >> > Hope it works :)
> >> >
> >> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> >> > wrote:
> >> >
> >> >> changing FPS to 60 doesn't help :( (originally it was 30)
> >> >> Final code for capturing events and drawing is the same as prototype
> >> code
> >> >> still got ugly, non-smooth curve in case mouse moving very fast
> >> >>
> >> >> Line in much smoother in Gimp
> >> >> In fact Flex desktop app produces smooth enough line
> >> >> will try to create browser quick start and double check
> >> >>
> >> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> >> >> wrote:
> >> >> > Hello,
> >> >> >
> >> >> > Thanks a lot for the quick answers, definitely flex is one of my
> >> >> > favorite communities :)
> >> >> > Here is example project: https://github.com/solomax/FlexSandbox
> >> >> > since it is desktop and tiny it looks not that bad
> >> >> > In my main project the resulting line is not smooth at all :(
> >> >> >
> >> >> > I'll try to check the code and remove any delays, thanks for the
> >> pointer.
> >> >> >
> >> >> > Additionally I'll try to check FFT, I have tried to add additional
> >> >> > points and use cubicCurveTo, but was unable to finish this (it is
> >> >> > currently commented)
> >> >> >
> >> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
> >> >> >> Alex Harui wrote
> >> >> >>>>can't you just up the frame per second of the swf to say 60, and
> if
> >> >> >>>>needed interpolate data points to smooth it?
> >> >> >>> That is a possibility, but the interpolation code may also affect
> >> input
> >> >> >>> rate.
> >> >> >>
> >> >> >> For this approach it might be helpful to google with "spline
> >> >> interpolation"
> >> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some
> ready to
> >> >> use
> >> >> >> AS3 implementations.
> >> >> >>
> >> >> >> Olaf
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://apache-flex-users.
> >> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
> >> >> speed-tp13737p13748.html
> >> >> >> Sent from the Apache Flex Users mailing list archive at
> Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > WBR
> >> >> > Maxim aka solomax
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> WBR
> >> >> Maxim aka solomax
> >> >>
> >>
> >>
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Get mouse coordinates on high speed

Posted by Maxim Solodovnik <so...@gmail.com>.
I tried to change the code as follows
grab points in event handler [1], then actually draw it after
capturing is over [2]
The result curve is not smooth in case of fast, long distance moves

[1] https://github.com/solomax/FlexSandbox/blob/master/web/src/Main1.mxml#L37
[2] https://github.com/solomax/FlexSandbox/blob/master/web/src/Main1.mxml#L31

On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
<ja...@gmail.com> wrote:
> Yes, I understood, but you can do it in many ways:
>
>    - Capture mouse coordinates, and draw the new pixel on a bitmap placed
>    underneath
>    - Capture mouse coordinates, and draw a new <Line> object from the last
>    captured point to the new coordinates, and so on
>    - Capture mouse coordinates, and perfom a graphics.lineTo on a Sprite on
>    each mouse move (a one liner for a one liner :)
>
> I think the vector approach should perform better on redraws, and I really
> do think your problem is right there on the fullscreen redraws: 60fps or
> even 30fps should be more than enough to capture a signature.
>
> To confirm first, try first separating the areas, and see it that makes it
> smoother :)
>
> On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
>> It sort of "pencil drawing" by mouse/pen
>> I'll try to capture points and draw it later(or better in separated thread)
>>
>> Thanks for the pointer
>>
>> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
>> <ja...@gmail.com> wrote:
>> > Hi Maxim!
>> >
>> > Are you capturing the points on line objects, or on a bitmap drawn at the
>> > bottom that has to be interpolated and redrawn on every mouse movement?
>> Try
>> > separating the capture and paint areas, capturing line objects instead of
>> > pixels on a bitmap, or at least draw the bitmap with the lowest posible
>> > interpolation quality, to see if it helps.
>> >
>> > Hope it works :)
>> >
>> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <so...@gmail.com>
>> > wrote:
>> >
>> >> changing FPS to 60 doesn't help :( (originally it was 30)
>> >> Final code for capturing events and drawing is the same as prototype
>> code
>> >> still got ugly, non-smooth curve in case mouse moving very fast
>> >>
>> >> Line in much smoother in Gimp
>> >> In fact Flex desktop app produces smooth enough line
>> >> will try to create browser quick start and double check
>> >>
>> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <so...@gmail.com>
>> >> wrote:
>> >> > Hello,
>> >> >
>> >> > Thanks a lot for the quick answers, definitely flex is one of my
>> >> > favorite communities :)
>> >> > Here is example project: https://github.com/solomax/FlexSandbox
>> >> > since it is desktop and tiny it looks not that bad
>> >> > In my main project the resulting line is not smooth at all :(
>> >> >
>> >> > I'll try to check the code and remove any delays, thanks for the
>> pointer.
>> >> >
>> >> > Additionally I'll try to check FFT, I have tried to add additional
>> >> > points and use cubicCurveTo, but was unable to finish this (it is
>> >> > currently commented)
>> >> >
>> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
>> >> >> Alex Harui wrote
>> >> >>>>can't you just up the frame per second of the swf to say 60, and if
>> >> >>>>needed interpolate data points to smooth it?
>> >> >>> That is a possibility, but the interpolation code may also affect
>> input
>> >> >>> rate.
>> >> >>
>> >> >> For this approach it might be helpful to google with "spline
>> >> interpolation"
>> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some ready to
>> >> use
>> >> >> AS3 implementations.
>> >> >>
>> >> >> Olaf
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> View this message in context: http://apache-flex-users.
>> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
>> >> speed-tp13737p13748.html
>> >> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > WBR
>> >> > Maxim aka solomax
>> >>
>> >>
>> >>
>> >> --
>> >> WBR
>> >> Maxim aka solomax
>> >>
>>
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>



-- 
WBR
Maxim aka solomax

Re: Get mouse coordinates on high speed

Posted by Javier Guerrero García <ja...@gmail.com>.
Yes, I understood, but you can do it in many ways:

   - Capture mouse coordinates, and draw the new pixel on a bitmap placed
   underneath
   - Capture mouse coordinates, and draw a new <Line> object from the last
   captured point to the new coordinates, and so on
   - Capture mouse coordinates, and perfom a graphics.lineTo on a Sprite on
   each mouse move (a one liner for a one liner :)

I think the vector approach should perform better on redraws, and I really
do think your problem is right there on the fullscreen redraws: 60fps or
even 30fps should be more than enough to capture a signature.

To confirm first, try first separating the areas, and see it that makes it
smoother :)

On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> It sort of "pencil drawing" by mouse/pen
> I'll try to capture points and draw it later(or better in separated thread)
>
> Thanks for the pointer
>
> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
> <ja...@gmail.com> wrote:
> > Hi Maxim!
> >
> > Are you capturing the points on line objects, or on a bitmap drawn at the
> > bottom that has to be interpolated and redrawn on every mouse movement?
> Try
> > separating the capture and paint areas, capturing line objects instead of
> > pixels on a bitmap, or at least draw the bitmap with the lowest posible
> > interpolation quality, to see if it helps.
> >
> > Hope it works :)
> >
> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> >> changing FPS to 60 doesn't help :( (originally it was 30)
> >> Final code for capturing events and drawing is the same as prototype
> code
> >> still got ugly, non-smooth curve in case mouse moving very fast
> >>
> >> Line in much smoother in Gimp
> >> In fact Flex desktop app produces smooth enough line
> >> will try to create browser quick start and double check
> >>
> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <so...@gmail.com>
> >> wrote:
> >> > Hello,
> >> >
> >> > Thanks a lot for the quick answers, definitely flex is one of my
> >> > favorite communities :)
> >> > Here is example project: https://github.com/solomax/FlexSandbox
> >> > since it is desktop and tiny it looks not that bad
> >> > In my main project the resulting line is not smooth at all :(
> >> >
> >> > I'll try to check the code and remove any delays, thanks for the
> pointer.
> >> >
> >> > Additionally I'll try to check FFT, I have tried to add additional
> >> > points and use cubicCurveTo, but was unable to finish this (it is
> >> > currently commented)
> >> >
> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
> >> >> Alex Harui wrote
> >> >>>>can't you just up the frame per second of the swf to say 60, and if
> >> >>>>needed interpolate data points to smooth it?
> >> >>> That is a possibility, but the interpolation code may also affect
> input
> >> >>> rate.
> >> >>
> >> >> For this approach it might be helpful to google with "spline
> >> interpolation"
> >> >> and "FFT" (Fast Fourier Transformation). Maybe you find some ready to
> >> use
> >> >> AS3 implementations.
> >> >>
> >> >> Olaf
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> View this message in context: http://apache-flex-users.
> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
> >> speed-tp13737p13748.html
> >> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >> > --
> >> > WBR
> >> > Maxim aka solomax
> >>
> >>
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Get mouse coordinates on high speed

Posted by Maxim Solodovnik <so...@gmail.com>.
It sort of "pencil drawing" by mouse/pen
I'll try to capture points and draw it later(or better in separated thread)

Thanks for the pointer

On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
<ja...@gmail.com> wrote:
> Hi Maxim!
>
> Are you capturing the points on line objects, or on a bitmap drawn at the
> bottom that has to be interpolated and redrawn on every mouse movement? Try
> separating the capture and paint areas, capturing line objects instead of
> pixels on a bitmap, or at least draw the bitmap with the lowest posible
> interpolation quality, to see if it helps.
>
> Hope it works :)
>
> On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
>> changing FPS to 60 doesn't help :( (originally it was 30)
>> Final code for capturing events and drawing is the same as prototype code
>> still got ugly, non-smooth curve in case mouse moving very fast
>>
>> Line in much smoother in Gimp
>> In fact Flex desktop app produces smooth enough line
>> will try to create browser quick start and double check
>>
>> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <so...@gmail.com>
>> wrote:
>> > Hello,
>> >
>> > Thanks a lot for the quick answers, definitely flex is one of my
>> > favorite communities :)
>> > Here is example project: https://github.com/solomax/FlexSandbox
>> > since it is desktop and tiny it looks not that bad
>> > In my main project the resulting line is not smooth at all :(
>> >
>> > I'll try to check the code and remove any delays, thanks for the pointer.
>> >
>> > Additionally I'll try to check FFT, I have tried to add additional
>> > points and use cubicCurveTo, but was unable to finish this (it is
>> > currently commented)
>> >
>> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
>> >> Alex Harui wrote
>> >>>>can't you just up the frame per second of the swf to say 60, and if
>> >>>>needed interpolate data points to smooth it?
>> >>> That is a possibility, but the interpolation code may also affect input
>> >>> rate.
>> >>
>> >> For this approach it might be helpful to google with "spline
>> interpolation"
>> >> and "FFT" (Fast Fourier Transformation). Maybe you find some ready to
>> use
>> >> AS3 implementations.
>> >>
>> >> Olaf
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context: http://apache-flex-users.
>> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
>> speed-tp13737p13748.html
>> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>> >
>> >
>> >
>> > --
>> > WBR
>> > Maxim aka solomax
>>
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>



-- 
WBR
Maxim aka solomax

Re: Get mouse coordinates on high speed

Posted by Javier Guerrero García <ja...@gmail.com>.
Hi Maxim!

Are you capturing the points on line objects, or on a bitmap drawn at the
bottom that has to be interpolated and redrawn on every mouse movement? Try
separating the capture and paint areas, capturing line objects instead of
pixels on a bitmap, or at least draw the bitmap with the lowest posible
interpolation quality, to see if it helps.

Hope it works :)

On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> changing FPS to 60 doesn't help :( (originally it was 30)
> Final code for capturing events and drawing is the same as prototype code
> still got ugly, non-smooth curve in case mouse moving very fast
>
> Line in much smoother in Gimp
> In fact Flex desktop app produces smooth enough line
> will try to create browser quick start and double check
>
> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
> > Hello,
> >
> > Thanks a lot for the quick answers, definitely flex is one of my
> > favorite communities :)
> > Here is example project: https://github.com/solomax/FlexSandbox
> > since it is desktop and tiny it looks not that bad
> > In my main project the resulting line is not smooth at all :(
> >
> > I'll try to check the code and remove any delays, thanks for the pointer.
> >
> > Additionally I'll try to check FFT, I have tried to add additional
> > points and use cubicCurveTo, but was unable to finish this (it is
> > currently commented)
> >
> > On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
> >> Alex Harui wrote
> >>>>can't you just up the frame per second of the swf to say 60, and if
> >>>>needed interpolate data points to smooth it?
> >>> That is a possibility, but the interpolation code may also affect input
> >>> rate.
> >>
> >> For this approach it might be helpful to google with "spline
> interpolation"
> >> and "FFT" (Fast Fourier Transformation). Maybe you find some ready to
> use
> >> AS3 implementations.
> >>
> >> Olaf
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
> speed-tp13737p13748.html
> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Get mouse coordinates on high speed

Posted by Maxim Solodovnik <so...@gmail.com>.
changing FPS to 60 doesn't help :( (originally it was 30)
Final code for capturing events and drawing is the same as prototype code
still got ugly, non-smooth curve in case mouse moving very fast

Line in much smoother in Gimp
In fact Flex desktop app produces smooth enough line
will try to create browser quick start and double check

On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <so...@gmail.com> wrote:
> Hello,
>
> Thanks a lot for the quick answers, definitely flex is one of my
> favorite communities :)
> Here is example project: https://github.com/solomax/FlexSandbox
> since it is desktop and tiny it looks not that bad
> In my main project the resulting line is not smooth at all :(
>
> I'll try to check the code and remove any delays, thanks for the pointer.
>
> Additionally I'll try to check FFT, I have tried to add additional
> points and use cubicCurveTo, but was unable to finish this (it is
> currently commented)
>
> On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
>> Alex Harui wrote
>>>>can't you just up the frame per second of the swf to say 60, and if
>>>>needed interpolate data points to smooth it?
>>> That is a possibility, but the interpolation code may also affect input
>>> rate.
>>
>> For this approach it might be helpful to google with "spline interpolation"
>> and "FFT" (Fast Fourier Transformation). Maybe you find some ready to use
>> AS3 implementations.
>>
>> Olaf
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Get-mouse-coordinates-on-high-speed-tp13737p13748.html
>> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
>
>
> --
> WBR
> Maxim aka solomax



-- 
WBR
Maxim aka solomax

Re: Get mouse coordinates on high speed

Posted by Maxim Solodovnik <so...@gmail.com>.
Hello,

Thanks a lot for the quick answers, definitely flex is one of my
favorite communities :)
Here is example project: https://github.com/solomax/FlexSandbox
since it is desktop and tiny it looks not that bad
In my main project the resulting line is not smooth at all :(

I'll try to check the code and remove any delays, thanks for the pointer.

Additionally I'll try to check FFT, I have tried to add additional
points and use cubicCurveTo, but was unable to finish this (it is
currently commented)

On Thu, Oct 6, 2016 at 1:47 AM, OK <po...@olafkrueger.net> wrote:
> Alex Harui wrote
>>>can't you just up the frame per second of the swf to say 60, and if
>>>needed interpolate data points to smooth it?
>> That is a possibility, but the interpolation code may also affect input
>> rate.
>
> For this approach it might be helpful to google with "spline interpolation"
> and "FFT" (Fast Fourier Transformation). Maybe you find some ready to use
> AS3 implementations.
>
> Olaf
>
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Get-mouse-coordinates-on-high-speed-tp13737p13748.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.



-- 
WBR
Maxim aka solomax

Re: Get mouse coordinates on high speed

Posted by OK <po...@olafkrueger.net>.
Alex Harui wrote
>>can't you just up the frame per second of the swf to say 60, and if
>>needed interpolate data points to smooth it?
> That is a possibility, but the interpolation code may also affect input
> rate.

For this approach it might be helpful to google with "spline interpolation"
and "FFT" (Fast Fourier Transformation). Maybe you find some ready to use
AS3 implementations.

Olaf




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Get-mouse-coordinates-on-high-speed-tp13737p13748.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Get mouse coordinates on high speed

Posted by Alex Harui <ah...@adobe.com>.

On 10/5/16, 10:17 AM, "Jason Taylor" <ja...@dedoose.com> wrote:

>can't you just up the frame per second of the swf to say 60, and if
>needed interpolate data points to smooth it?

That is a possibility, but the interpolation code may also affect input
rate.

AIUI, input events are not tied to frame rate.  Screen updates may be tied
to frame rate, but you can use updateAfterEvent to force a screen update
on each mouse event.  But if the update has too much work to do, forcing
an update on every mouse event might slow the rate at which the player can
respond to the next event.

That's why it is important to understand what is going on at the lower
level.  Do events get dropped or just queued up?  Or is the next event
generated by sampling when the runtime is ready?  Once you understand if
it is possible to get accurate events at a higher rate from the low-level,
you can try to tune the application to allow for that higher rate.  If
events get queued, you have the option of "catching up" instead of
"keeping up".  If they get dropped or sampled when ready, you have to keep
up.

HTH,
-Alex

>
>-----Original Message-----
>From: Clint M [mailto:cmodien@gmail.com]
>Sent: Wednesday, October 05, 2016 10:07 AM
>To: users@flex.apache.org
>Subject: Re: Get mouse coordinates on high speed
>
>I think the simple answer to what you're asking is no.
>
>Try posting the code you're using to draw the curve though.
>
>Someone might spot something to help speed it up.
>
>On Wed, Oct 5, 2016 at 9:57 AM, Maxim Solodovnik <so...@gmail.com>
>wrote:
>
>> Hello,
>>
>> Recently I got request to capture hand drawing from pen device using
>> as3 (latest apache flex)
>> unfortunately I got ungly results in case drawing is fast in case
>> mouse/pen moves slowly I got smooth curve
>>
>> Is it possible to get mouse coordinates on higher frequency?
>>
>> --
>> WBR
>> Maxim aka solomax
>>


RE: Get mouse coordinates on high speed

Posted by Jason Taylor <ja...@dedoose.com>.
can't you just up the frame per second of the swf to say 60, and if needed interpolate data points to smooth it?

-----Original Message-----
From: Clint M [mailto:cmodien@gmail.com] 
Sent: Wednesday, October 05, 2016 10:07 AM
To: users@flex.apache.org
Subject: Re: Get mouse coordinates on high speed

I think the simple answer to what you're asking is no.

Try posting the code you're using to draw the curve though.

Someone might spot something to help speed it up.

On Wed, Oct 5, 2016 at 9:57 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello,
>
> Recently I got request to capture hand drawing from pen device using
> as3 (latest apache flex)
> unfortunately I got ungly results in case drawing is fast in case 
> mouse/pen moves slowly I got smooth curve
>
> Is it possible to get mouse coordinates on higher frequency?
>
> --
> WBR
> Maxim aka solomax
>

Re: Get mouse coordinates on high speed

Posted by Clint M <cm...@gmail.com>.
I think the simple answer to what you're asking is no.

Try posting the code you're using to draw the curve though.

Someone might spot something to help speed it up.

On Wed, Oct 5, 2016 at 9:57 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello,
>
> Recently I got request to capture hand drawing from pen device using
> as3 (latest apache flex)
> unfortunately I got ungly results in case drawing is fast
> in case mouse/pen moves slowly I got smooth curve
>
> Is it possible to get mouse coordinates on higher frequency?
>
> --
> WBR
> Maxim aka solomax
>

Re: Get mouse coordinates on high speed

Posted by Alex Harui <ah...@adobe.com>.

On 10/5/16, 9:57 AM, "Maxim Solodovnik" <so...@gmail.com> wrote:

>Hello,
>
>Recently I got request to capture hand drawing from pen device using
>as3 (latest apache flex)
>unfortunately I got ungly results in case drawing is fast
>in case mouse/pen moves slowly I got smooth curve
>
>Is it possible to get mouse coordinates on higher frequency?

Don't know for sure, but in general, since Flash does input and display in
the same thread, the question is whether you are processing the response
too slowly and events are being dropped, or the pen just doesn't output
fast enough or there is some code in between like in the browser or in
Flash itself that gates the input rate.  Many years ago, most tablet and
pen hardware couldn't keep up with fast hands.

If you use the Pen in a native app (Windows Paint, Adobe Illustrator,
etc), does it go fast enough?  If yes, then you know the device and OS is
fast enough.  Then you could try a test app that instead of drawing on
each mouse move, just queues them up and draws them "later" so you see if
Flash can get enough events without dropping any.

Then profile what happens in response to a pen event.  I could imagine
that Flex might be overthinking on each event.

HTH,
-Alex