LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-23-2006, 03:27 AM   #16
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428

Hello.

You have to install `libsdl1.2-dev' package to obtain /usr/include/SDL/SDL.h file.

Type `make sdltest' (as I can see) and run `./sdltest' .

Here is an example with libplot (plotutils):
Code:
// C-curve.c

#include <stdio.h>
#include <plot.h>
#define MAXORDER 13

void draw_c_curve (plPlotter *plotter, double dx, double dy, int order)
{
	if (order >= MAXORDER)
		/* continue path along (dx, dy) */
		pl_fcontrel_r (plotter, dx, dy);
	else
	{
		draw_c_curve (plotter,
				0.5 * (dx - dy), 0.5 * (dx + dy), order + 1);
		draw_c_curve (plotter,
				0.5 * (dx + dy), 0.5 * (dy - dx), order + 1);
	}
}

int main ()
{
	plPlotter *plotter;
	plPlotterParams *plotter_params;

	/* set a Plotter parameter */
	plotter_params = pl_newplparams ();
	pl_setplparam (plotter_params, "PAGESIZE", "letter");

      /* `X' -- X-window, change to `ps' -- write Postscript
          file to stdout
      */
	if ((plotter = pl_newpl_r ("X", stdin, stdout, stderr,
					plotter_params)) == NULL)
	{
		fprintf (stderr, "Couldn't create Plotter\n");
		return 1;
	}

	if (pl_openpl_r (plotter) < 0)      /* open Plotter */
	{
		fprintf (stderr, "Couldn't open Plotter\n");
		return 1;
	}
	pl_fspace_r (plotter, 0.0, 0.0, 1000.0, 1000.0); /* set coor system */
	pl_flinewidth_r (plotter, 0.25);    /* set line thickness */
	pl_pencolorname_r (plotter, "red"); /* use red pen */
	pl_erase_r (plotter);               /* erase graphics display */
	pl_fmove_r (plotter, 600.0, 300.0); /* position the graphics cursor */
	pl_fontname_r(plotter, "hersheysans");
	pl_alabel_r (plotter,'l', 'x', "this is\\spa\\ep label!!!");
	draw_c_curve (plotter, 0.0, 400.0, 0);
	if (pl_closepl_r (plotter) < 0)     /* close Plotter */
	{
		fprintf (stderr, "Couldn't close Plotter\n");
		return 1;
	}

	if (pl_deletepl_r (plotter) < 0)    /* delete Plotter */
	{
		fprintf (stderr, "Couldn't delete Plotter\n");
		return 1;
	}
	return 0;
}
And Makefile:
Code:
# Makefile
LIB=/usr/X11R6/lib/
curve: C-curve.o
	gcc -o curve C-curve.o -L$(LIB) -lplot -lXaw -lXmu -lXt -lXext -lX11 -lpng -lz -lm
C-curve.o: C-curve.c
	gcc -c C-curve.c


clean:
	rm -f *.o curve
Just type `make' (plotutils have to be installed). The ability to plot in almost any graphics format (not just X-window) is often useful.

Bye.

Last edited by firstfire; 10-23-2006 at 03:34 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MEPIS/Linux learning curve questions 21Williamkp Linux - Software 3 05-01-2006 09:40 PM
can I use AIX plot(1B) format files in linux (plotutils?) jkey AIX 2 01-26-2006 02:28 PM
Using linux to read unix ".plot" files jkey Linux - General 0 10-05-2005 02:30 PM
using SunOS plot files (1b or 4b format) in linux jkey Solaris / OpenSolaris 0 09-18-2005 06:14 AM
Real Time Plot... DaFrEQ Linux - Software 0 08-27-2002 08:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration