[MSEide-MSEgui-talk] MSE Canvas.

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] MSE Canvas.

fredvs
Hello Martin.

How to draw lines on a canvas with MSE ?

For example,
LCL: Canvas.Line(x,y, cx, cy)...
fpGUI: Canvas.drawLine(x,y,cx,cy)...

Does it exist a demo of some use of MSE canvas/draw lines ?

Would it be possible to draw on the canvas of a TSlider.scrollbar.face ?
This to draw the wave-form of a song as background of a slider.

See simulated image:
<http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/msesliderwave.png>

Or maybe it will be easier to create a slider from scratch.

Thanks.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

mse
Administrator
On Tuesday 26 September 2017 15:05:21 fredvs wrote:
> Hello Martin.
>
> How to draw lines on a canvas with MSE ?
>
> For example,
> LCL: Canvas.Line(x,y, cx, cy)...
> fpGUI: Canvas.drawLine(x,y,cx,cy)...
>
See lib/common/graphics/msegraphics.pas tcanvas:
"
   procedure drawline(const startpoint,endpoint: pointty;
                                        const acolor: colorty = cl_default);
   procedure drawline(const startpoint: pointty; const length: sizety;
                                        const acolor: colorty = cl_default);
   procedure drawlinesegments(const apoints: array of segmentty;
                         const acolor: colorty = cl_default);

   procedure drawlines(const apoints: array of pointty;
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1); overload;
                               //-1 = all
   procedure drawlines(const apoints: array of pointty;
                       const abreaks: array of integer; //ascending order
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1); overload;

   procedure drawvect(const startpoint: pointty;
                   const direction: graphicdirectionty;
                   const length: integer; const acolor: colorty = cl_default);
                                                           overload;
   procedure drawvect(const startpoint: pointty;
                      const direction: graphicdirectionty;
                      const length: integer; out endpoint: pointty;
                      const acolor: colorty = cl_default); overload;
"
> Does it exist a demo of some use of MSE canvas/draw lines ?
>
http://freepascal.ru/article/mse/20060205191314/
"mp()" is a shorthand of "makepoint()", ms() of makesize().

> Would it be possible to draw on the canvas of a TSlider.scrollbar.face ?
> This to draw the wave-form of a song as background of a slider.
>
Activate tslider.scrollbar.face, select a tfacecomp in template and use
tfacecomp.onafterpaint.
"
procedure tmainfo.faceafterpaint(const sender: tcustomface;
               const canvas: tcanvas; const arect: rectty);
begin
 canvas.drawline(arect.pos,ms(arect.cx-1,arect.cy-1),cl_red);
                         //ms is shorthand for makesize
end;
"
Needs MSEgui git master 49a6c90d8643b5b01b6ea3c3a31ecaebf564cd56 because of a
regression.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

sliderbackground.png (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas. (Answer from Martin)

fredvs
In reply to this post by fredvs
Ooops, your message did not appear in nabble.com --> here a copy:

On Tuesday 26 September 2017 15:05:21 fredvs wrote:
> Hello Martin.
>
> How to draw lines on a canvas with MSE ?
>
> For example,
> LCL: Canvas.Line(x,y, cx, cy)...
> fpGUI: Canvas.drawLine(x,y,cx,cy)...
>
See lib/common/graphics/msegraphics.pas tcanvas:
"
   procedure drawline(const startpoint,endpoint: pointty;
                                        const acolor: colorty = cl_default);
   procedure drawline(const startpoint: pointty; const length: sizety;
                                        const acolor: colorty = cl_default);
   procedure drawlinesegments(const apoints: array of segmentty;
                         const acolor: colorty = cl_default);

   procedure drawlines(const apoints: array of pointty;
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1);
overload;
                               //-1 = all
   procedure drawlines(const apoints: array of pointty;
                       const abreaks: array of integer; //ascending order
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1);
overload;

   procedure drawvect(const startpoint: pointty;
                   const direction: graphicdirectionty;
                   const length: integer; const acolor: colorty =
cl_default);
                                                           overload;
   procedure drawvect(const startpoint: pointty;
                      const direction: graphicdirectionty;
                      const length: integer; out endpoint: pointty;
                      const acolor: colorty = cl_default); overload;
"
> Does it exist a demo of some use of MSE canvas/draw lines ?
>
http://freepascal.ru/article/mse/20060205191314/
"mp()" is a shorthand of "makepoint()", ms() of makesize().

> Would it be possible to draw on the canvas of a TSlider.scrollbar.face ?
> This to draw the wave-form of a song as background of a slider.
>
Activate tslider.scrollbar.face, select a tfacecomp in template and use
tfacecomp.onafterpaint.
"
procedure tmainfo.faceafterpaint(const sender: tcustomface;
               const canvas: tcanvas; const arect: rectty);
begin
 canvas.drawline(arect.pos,ms(arect.cx-1,arect.cy-1),cl_red);
                         //ms is shorthand for makesize
end;
"
Needs MSEgui git master 49a6c90d8643b5b01b6ea3c3a31ecaebf564cd56 because of
a
regression.



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

fredvs
In reply to this post by mse


Wow.


White night tonight ?


Many thanks


Fre;D.



De : Martin Schreiber <[hidden email]>
Envoyé : mardi 26 septembre 2017 17:03
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] MSE Canvas.
 
On Tuesday 26 September 2017 15:05:21 fredvs wrote:
> Hello Martin.
>
> How to draw lines on a canvas with MSE ?
>
> For example,
> LCL: Canvas.Line(x,y, cx, cy)...
> fpGUI: Canvas.drawLine(x,y,cx,cy)...
>
See lib/common/graphics/msegraphics.pas tcanvas:
"
   procedure drawline(const startpoint,endpoint: pointty;
                                        const acolor: colorty = cl_default);
   procedure drawline(const startpoint: pointty; const length: sizety;
                                        const acolor: colorty = cl_default);
   procedure drawlinesegments(const apoints: array of segmentty;
                         const acolor: colorty = cl_default);

   procedure drawlines(const apoints: array of pointty;
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1); overload;
                               //-1 = all
   procedure drawlines(const apoints: array of pointty;
                       const abreaks: array of integer; //ascending order
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1); overload;

   procedure drawvect(const startpoint: pointty;
                   const direction: graphicdirectionty;
                   const length: integer; const acolor: colorty = cl_default);
                                                           overload;
   procedure drawvect(const startpoint: pointty;
                      const direction: graphicdirectionty;
                      const length: integer; out endpoint: pointty;
                      const acolor: colorty = cl_default); overload;
"
> Does it exist a demo of some use of MSE canvas/draw lines ?
>
http://freepascal.ru/article/mse/20060205191314/


"mp()" is a shorthand of "makepoint()", ms() of makesize().

> Would it be possible to draw on the canvas of a TSlider.scrollbar.face ?
> This to draw the wave-form of a song as background of a slider.
>
Activate tslider.scrollbar.face, select a tfacecomp in template and use
tfacecomp.onafterpaint.
"
procedure tmainfo.faceafterpaint(const sender: tcustomface;
               const canvas: tcanvas; const arect: rectty);
begin
 canvas.drawline(arect.pos,ms(arect.cx-1,arect.cy-1),cl_red);
                         //ms is shorthand for makesize
end;
"
Needs MSEgui git master 49a6c90d8643b5b01b6ea3c3a31ecaebf564cd56 because of a
regression.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

mse
Administrator
In reply to this post by mse
On Tuesday 26 September 2017 17:03:20 Martin Schreiber wrote:

> > Would it be possible to draw on the canvas of a TSlider.scrollbar.face ?
> > This to draw the wave-form of a song as background of a slider.
>
> Activate tslider.scrollbar.face, select a tfacecomp in template and use
> tfacecomp.onafterpaint.
> "
> procedure tmainfo.faceafterpaint(const sender: tcustomface;
>                const canvas: tcanvas; const arect: rectty);
> begin
>  canvas.drawline(arect.pos,ms(arect.cx-1,arect.cy-1),cl_red);
>                          //ms is shorthand for makesize
> end;
> "
Probably more efficient is to paint the background image one time to
tslider.scrollbar.face.image.cavas.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

mse
Administrator
In reply to this post by fredvs
On Tuesday 26 September 2017 17:03:20 Martin Schreiber wrote:

> > Would it be possible to draw on the canvas of a TSlider.scrollbar.face ?
> > This to draw the wave-form of a song as background of a slider.
>
> Activate tslider.scrollbar.face, select a tfacecomp in template and use
> tfacecomp.onafterpaint.
> "
> procedure tmainfo.faceafterpaint(const sender: tcustomface;
>                const canvas: tcanvas; const arect: rectty);
> begin
>  canvas.drawline(arect.pos,ms(arect.cx-1,arect.cy-1),cl_red);
>                          //ms is shorthand for makesize
> end;
> "
Probably more efficient is to paint the background image one time to
tslider.scrollbar.face.image.cavas.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

mse
Administrator
In reply to this post by fredvs
On Tuesday 26 September 2017 15:05:21 fredvs wrote:
> Hello Martin.
>
> How to draw lines on a canvas with MSE ?
>
> For example,
> LCL: Canvas.Line(x,y, cx, cy)...
> fpGUI: Canvas.drawLine(x,y,cx,cy)...
>
See lib/common/graphics/msegraphics.pas tcanvas:
"
   procedure drawline(const startpoint,endpoint: pointty;
                                        const acolor: colorty = cl_default);
   procedure drawline(const startpoint: pointty; const length: sizety;
                                        const acolor: colorty = cl_default);
   procedure drawlinesegments(const apoints: array of segmentty;
                         const acolor: colorty = cl_default);

   procedure drawlines(const apoints: array of pointty;
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1); overload;
                               //-1 = all
   procedure drawlines(const apoints: array of pointty;
                       const abreaks: array of integer; //ascending order
                       const aclosed: boolean = false;
                       const acolor: colorty = cl_default;
              const first: integer = 0; const acount: integer = -1); overload;

   procedure drawvect(const startpoint: pointty;
                   const direction: graphicdirectionty;
                   const length: integer; const acolor: colorty = cl_default);
                                                           overload;
   procedure drawvect(const startpoint: pointty;
                      const direction: graphicdirectionty;
                      const length: integer; out endpoint: pointty;
                      const acolor: colorty = cl_default); overload;
"
> Does it exist a demo of some use of MSE canvas/draw lines ?
>
http://freepascal.ru/article/mse/20060205191314/
"mp()" is a shorthand of "makepoint()", ms() of makesize().

> Would it be possible to draw on the canvas of a TSlider.scrollbar.face ?
> This to draw the wave-form of a song as background of a slider.
>
Activate tslider.scrollbar.face, select a tfacecomp in template and use
tfacecomp.onafterpaint.
"
procedure tmainfo.faceafterpaint(const sender: tcustomface;
               const canvas: tcanvas; const arect: rectty);
begin
 canvas.drawline(arect.pos,ms(arect.cx-1,arect.cy-1),cl_red);
                         //ms is shorthand for makesize
end;
"
Needs MSEgui git master 49a6c90d8643b5b01b6ea3c3a31ecaebf564cd56 because of a
regression.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

sliderbackground.png (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

fredvs
Hello Martin.

Works perfectly.

Thanks.

PS: Demo asap.



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

fredvs
> PS: Demo asap.

Hello.

Here image (not simulated) of MSE Tslider with custom canvas:

<http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/mse_scrollbar.png>

To see and listen it:

https://github.com/fredvs/strumpract

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

mse
Administrator
In reply to this post by fredvs
> > PS: Demo asap.

>
> Hello.
>
> Here image (not simulated) of MSE Tslider with custom canvas:
>
> <http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/mse_scrollbar.png>
>
> To see and listen it:
>
> https://github.com/fredvs/strumpract
>
Great!
Attached a version with maybe better performance because it uses tface.image
and paints the waveform only once.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

sliderimage.patch (50K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

fredvs
> Great!
Thanks!

> Attached a version with maybe better performance because it uses
> tface.image
Many thanks, I will study it tonight.

Huh, I did test of resource consommation and, when synchronizing, the design
that needs the most ressource is the view meters of the console form.

But sure it was not a good idea to use groupbox as view meters. (but easy
for first test).
It must recalculate things not needed.

What do you think, what would use the less ressource for view meters?
I was thinking a simple canvas and draw it at each synchro.
Or maybe it exist a low ressource mse widget (like box-rectangle-circle).

By the way, I did test on RPi3.

Your last commits for threads did a big difference in synchro and quality of
sound.
And replacing Lock()/Unlock() by queueasynccall() solves all the "crack" in
sound.

Really, the result on the RPi3/Arm in quality of sound with built in
sound-card and graphic synchro is equivalent than a i386.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

fredvs
In reply to this post by mse
> Attached a version

OK, your patch is committed 8848320.

Many thanks.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

mse
Administrator
In reply to this post by fredvs
On Friday 29 September 2017 19:58:26 fredvs wrote:
>
> What do you think, what would use the less ressource for view meters?
> I was thinking a simple canvas and draw it at each synchro.
> Or maybe it exist a low ressource mse widget (like box-rectangle-circle).
>
Try a tprogressbar from tab edit.
You should avoid layout recalculation. Replace "visible:= true; visible:=
false" by "invalidate()", do not change widget size or position on a high
frequency.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] MSE Canvas.

fredvs
>  Replace "visible:= true; visible:=

Ha, you did see this ;-)

I did try mywidget.redraw, mywidget.draw, mywidget.refresh, .... but not
mywidget.invalidate.

Thanks for the tip.



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk