RE: [GD-DEVEL] Re: plotting data c++
[email protected] ("Bill Frost")
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <000c01c8652b$327b4e40$ab00a8c0@BillFrost> |
Hi Pierre,
Yep, please organise a CVS account.
Not sure what you mean by your other question - I do use gd for all JPEG
work, as per the fragment below:
gdImagePtr imgVelocity;
imgVelocity = gdImageCreate(xCanvasSize, yCanvasSize);
<snip>
/* join each velocity point in a straight line, painted black */
gdImageSetThickness(imgVelocity, 2);
for (unsigned int mbr = 1; mbr < mbrCount; ++mbr) {
gdImageLine(imgVelocity, pCGraphMember[mbr-1].xPosition,
pCGraphMember[mbr-1].yPosition, pCGraphMember[mbr].xPosition,
pCGraphMember[mbr].yPosition, black);
}
<snip>
FILE *velJpeg;
velJpeg = fopen("fourier.jpg", "wb");
gdImageJpeg(imgVelocity, velJpeg, -1);
fclose(velJpeg);
gdImageDestroy(imgVelocity);
return 0;
}
When I finish the console app, I make a platform specific Windows call to
show the user the JPEG -
system("fourier.jpg");
-----Original Message-----
From: Pierre Joye [mailto:[email protected]]
Sent: Saturday, 2 February 2008 1:37 AM
To: Bill Frost
Cc: Patolfo; [email protected]
Subject: Re: [GD-DEVEL] Re: plotting data c++
Hi Bill!
Very nice work (from the description point of view) :)
If you like/wish, you can have a cvs account and maintains it in the
GD repository. As you said it can be a fantastic demo about what is
possible with GD.
One question, why not using gd's jpeg support or custom image formats?
Cheers,
--Pierre
On Feb 1, 2008 3:11 PM, Bill Frost <[email protected]> wrote:
> Hi guys,
>
> This has always sounded to me like an ideal gdLib application.
>
> I had a bit of spare time today and I was intrigued by the problem. I dug
> out some existing C++ code and modified it a bit and it now plots
Patolfo's
> data points as a square wave in JPEG format. If I keep the number of
samples
> at 256 but vary the number of terms from a high, such as 128, a square
wave
> is generated. If the number of terms is then set low, such as 8, a
> sinusoidal-square wave is generated. Looks nice as a curved plot!
>
> Selecting 256 samples with 128 terms runs in 0.093 seconds on a Centrino,
as
> gdLib / C++ is very fast.
>
> Note that it is a utility, not a GUI application. It runs Padolfo's test
> data application and opens the file using the operating system's default
> JPEG handler (typically Windows Picture and Fax Viewer).
>
> It:
>
> * runs the sample algorithm,
> * saves the sample data to a file and closes it (normally user-supplied)
> * re opens the file
> * extracts all data into a class, finding max and min values
> * sets up a device context in gdLib, with some scaling
> * creates the JPEG and thumbnail
> * iterates the class and plots each x, y to a pixel
> * scales and labels the axis
>
>
> I've just fixed a rather embarrassing buffer overrun and I need to do a
> little code clean up and make the JPEG slightly more aesthetic. Then I'll
> post the source as a royalty free utility (seeing Padolfo wrote the main
> algorithm!) as an example of using gdLib. Comments welcome once I have
done
> this as I am by no means an expert on gdLib and I still don't really know
> what FFT is all about.
>
> Cheers,
>
> Bill
>
>
> -----Original Message-----
> From: Patolfo [mailto:[email protected]]
> Sent: Thursday, 31 January 2008 10:15 AM
> To: Bill Frost; [email protected]
> Subject: [GD-DEVEL] Re: plotting data c++
>
> ok guys here is the problem again, i am plotting x,y data, floats to be
> precise, must be in C, C++, the hardway, no perl or python just know how
> to us perl a little, the idea is to have the application data to do the
> approximation of a square wave by means of fourier series, the job is
> done, now the problem is the gui, well i tried tk with perl and
> everything went smootly, till the part of converting perl to C, and
> including the interpreter and all that stuff, truly i did not get it
> right so it freezes and is buggy, so well back in track i found my self
> on the same road, just C, the gui I plan to do them with windowsapi they
> are the lesser problem, mingw, but the plotting data per se is the
> biggest problem, i tried reading the wiki for libgd, and let me tell you
> it is not for noobs, or at least not for the dumbest as me.
>
> The algorithm says more or less:
> number or harmonics, number of data points, using gui, some routines,
> and then we have and arbitrary number of data with a max value of 1 and
> the minimum of 0, arranged in pairs of x,y,
>
> i have the suspicion it is straightforward, but i seem to fail, i am
> still googling, found koolplot, which i think uses libgd, did not work
> for my mingw, so, any directions where to look...
>
> --
> GD Devel Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> GD Devel Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Pierre
http://blog.thepimp.net | http://www.libgd.org
--
GD Devel Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php