How to copy a point in SDL 1.3

Hello

I’m currently doing a audio spectrum analyser with SDL 1.3. I’m looking for
a function that simply allows me to copy a point to another location; I
mean for example copy the x and y of point A to x and y of point B that a
different z of course… and doing that for a lot of points.

I’ve searching withotu succes untill now.

Thank you very much.

Victor

Thank you very much.

Victor–
View this message in context: http://old.nabble.com/how-to-copy-a-point-in-SDL-1.3-tp30768528p30768528.html
Sent from the SDL mailing list archive at Nabble.com.

What do you mean by “copy a point”? Do you mean to get the RGBA value for
the screen location at x, y so that you can draw that same color some where
else?> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of victor-victor
Sent: Wednesday, January 26, 2011 4:21 PM
To: sdl at lists.libsdl.org
Subject: [SDL] how to copy a point in SDL 1.3

Hello

I’m currently doing a audio spectrum analyser with SDL 1.3. I’m looking for
a function that simply allows me to copy a point to another location; I
mean for example copy the x and y of point A to x and y of point B that a
different z of course… and doing that for a lot of points.

I’ve searching withotu succes untill now.

Thank you very much.

Victor

Thank you very much.

Victor

View this message in context:
http://old.nabble.com/how-to-copy-a-point-in-SDL-1.3-tp30768528p30768528.htm
l
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello

There are two thinks actually; x and y coordinates and color; let me present
in its context.

I display frequency versus amplitude of the sound in a 2D surface (at z =
0); sound data’s arrive the speed, say, of 1sec; so every second the 2D
surface i’m talking about is updated. When it is updated, I want that
surface go behind “one step” at, say, z= -0.1, while the new sound analysis
is display at z = 0; then again what is is = -0.1 goes in z = -0.2, what is
in z = 0 goes in z = 0.1, and the new data are display in z = 0.

In other words, i’d like the 2D surface (x, y and color) be copied entirely
in another parallel surface with different z.

What i’m doing now is that i store in a table the maximum values of each y
of each curve, then copy it at the next step.

Thank you

Victor–
View this message in context: http://old.nabble.com/how-to-copy-a-point-in-SDL-1.3-tp30768528p30776741.html
Sent from the SDL mailing list archive at Nabble.com.

You can do this a couple of different ways. One is to just create a large
lookup table with the values, and then copy them left one row at a time.
Then use those values to draw your color.

The other approach would be to create a texture (or surface in SDL 1.2.x)
that is larger the width of the screen (typically twice the width), and the
same height. Then you could draw your points into the surface/texture at
0,0…screenW-1,screenH-1 for the first time slice and copy that rect to the
screen texture/surface, draw the new column at screenW for the next time
slice, and copy from x=1, y=0 to x=screenW, y=screenH-1 for the next time
slice, etc.

Once you get to where you are filling the right most column, you would then
use the left most (wrapping around) for the next time slice. At that point
you will be doing two Blit’s or RenderCopy calls. One for the pixels up to
the right side of your surface, and another for the left strip.

The latter approach will probably yield the best performance, but frankly,
if you don’t have a lot of experience doing this type of split blit, you may
want to start with the first approach since it is conceptually much easier
to understand.

Ken> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of victor-victor
Sent: Thursday, January 27, 2011 6:17 AM
To: sdl at lists.libsdl.org
Subject: Re: [SDL] how to copy a point in SDL 1.3

Hello

There are two thinks actually; x and y coordinates and color; let me present
in its context.

I display frequency versus amplitude of the sound in a 2D surface (at z =
0); sound data’s arrive the speed, say, of 1sec; so every second the 2D
surface i’m talking about is updated. When it is updated, I want that
surface go behind “one step” at, say, z= -0.1, while the new sound analysis
is display at z = 0; then again what is is = -0.1 goes in z = -0.2, what is
in z = 0 goes in z = 0.1, and the new data are display in z = 0.

In other words, i’d like the 2D surface (x, y and color) be copied entirely
in another parallel surface with different z.

What i’m doing now is that i store in a table the maximum values of each y
of each curve, then copy it at the next step.

Thank you

Victor

View this message in context:
http://old.nabble.com/how-to-copy-a-point-in-SDL-1.3-tp30768528p30776741.htm
l
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

BTW, you an do the second approach with as little as 1 column of extra
pixels. You don’t have to make it twice as wide as the screen.

There is a 3rd option, which is similar to the 1st, but instead of using an
array, the texture/surface IS the array, and you do Blit/RenderCopy calls to
copy over each column. IMHO this is the slowest of the 3, but for some
hardware/platforms it may be faster than on others.> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Ken Rogoway
Sent: Thursday, January 27, 2011 10:16 AM
To: 'SDL Development List’
Subject: Re: [SDL] how to copy a point in SDL 1.3

You can do this a couple of different ways. One is to just create a large
lookup table with the values, and then copy them left one row at a time.
Then use those values to draw your color.

The other approach would be to create a texture (or surface in SDL 1.2.x)
that is larger the width of the screen (typically twice the width), and the
same height. Then you could draw your points into the surface/texture at
0,0…screenW-1,screenH-1 for the first time slice and copy that rect to the
screen texture/surface, draw the new column at screenW for the next time
slice, and copy from x=1, y=0 to x=screenW, y=screenH-1 for the next time
slice, etc.

Once you get to where you are filling the right most column, you would then
use the left most (wrapping around) for the next time slice. At that point
you will be doing two Blit’s or RenderCopy calls. One for the pixels up to
the right side of your surface, and another for the left strip.

The latter approach will probably yield the best performance, but frankly,
if you don’t have a lot of experience doing this type of split blit, you may
want to start with the first approach since it is conceptually much easier
to understand.

Ken

-----Original Message-----
From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of victor-victor
Sent: Thursday, January 27, 2011 6:17 AM
To: sdl at lists.libsdl.org
Subject: Re: [SDL] how to copy a point in SDL 1.3

Hello

There are two thinks actually; x and y coordinates and color; let me present
in its context.

I display frequency versus amplitude of the sound in a 2D surface (at z =
0); sound data’s arrive the speed, say, of 1sec; so every second the 2D
surface i’m talking about is updated. When it is updated, I want that
surface go behind “one step” at, say, z= -0.1, while the new sound analysis
is display at z = 0; then again what is is = -0.1 goes in z = -0.2, what is
in z = 0 goes in z = 0.1, and the new data are display in z = 0.

In other words, i’d like the 2D surface (x, y and color) be copied entirely
in another parallel surface with different z.

What i’m doing now is that i store in a table the maximum values of each y
of each curve, then copy it at the next step.

Thank you

Victor

View this message in context:
http://old.nabble.com/how-to-copy-a-point-in-SDL-1.3-tp30768528p30776741.htm
l
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thank you so much Ken

I’m using the first solution now with succes; i’ll examine the other one
also–
View this message in context: http://old.nabble.com/how-to-copy-a-point-in-SDL-1.3-tp30768528p30799008.html
Sent from the SDL mailing list archive at Nabble.com.