b1f4eb | 1998-01-13 | Fredrik Hübinette (Hubbe) | |
|
e3cb4b | 1997-04-03 | Mirar (Pontus Hagland) | |
|
4ce741 | 1997-05-29 | Mirar (Pontus Hagland) | | **! note
|
b1f4eb | 1998-01-13 | Fredrik Hübinette (Hubbe) | | **! $Id: pnm.c,v 1.9 1998/01/13 22:59:24 hubbe Exp $
|
e3cb4b | 1997-04-03 | Mirar (Pontus Hagland) | | **! class image
*/
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
#include "global.h"
#include <math.h>
#include <ctype.h>
#include "stralloc.h"
#include "global.h"
|
bb55f8 | 1997-03-16 | Fredrik Hübinette (Hubbe) | | #include "pike_macros.h"
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | #include "object.h"
#include "constants.h"
#include "interpret.h"
#include "svalue.h"
#include "array.h"
#include "error.h"
#include "image.h"
|
b1f4eb | 1998-01-13 | Fredrik Hübinette (Hubbe) | | #ifdef THIS
#undef THIS
#endif
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | #define THIS ((struct image *)(fp->current_storage))
#define THISOBJ (fp->current_object)
|
3d8925 | 1997-11-02 | Mirar (Pontus Hagland) | | extern struct program *image_program;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
e3cb4b | 1997-04-03 | Mirar (Pontus Hagland) | | |
3d8925 | 1997-11-02 | Mirar (Pontus Hagland) | | **! <b>compability method</b> - do not use in new programs.
**!
**! See <ref>Image.PNM.encode</ref>().
**!
|
e3cb4b | 1997-04-03 | Mirar (Pontus Hagland) | | **! returns PPM data
**!
**! method object|string frompnm(string pnm)
**! method object|string fromppm(string pnm)
|
3d8925 | 1997-11-02 | Mirar (Pontus Hagland) | | **! <b>compability method</b> - do not use in new programs.
**!
**! See <ref>Image.PNM.decode</ref>().
|
e3cb4b | 1997-04-03 | Mirar (Pontus Hagland) | | **!
**! returns the called object or a hint of what wronged.
**! arg string pnm
**! pnm data, as a string
*/
|
335e8e | 1997-11-02 | Mirar (Pontus Hagland) | | void img_pnm_encode_binary(INT32 args);
void img_pnm_decode(INT32 args);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | void image_toppm(INT32 args)
{
pop_n_elems(args);
|
3d8925 | 1997-11-02 | Mirar (Pontus Hagland) | |
THISOBJ->refs++;
push_object(THISOBJ);
img_pnm_encode_binary(1);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
void image_frompnm(INT32 args)
{
|
3d8925 | 1997-11-02 | Mirar (Pontus Hagland) | | struct image *img;
img_pnm_decode(args);
img=(struct image*)get_storage(sp[-1].u.object,image_program);
if (THIS->img) free(THIS->img);
*THIS=*img;
THIS->img=malloc(img->xsize*img->ysize*sizeof(rgb_group)+1);
if (!THIS->img) error("out of memory\n");
MEMCPY(THIS->img,img->img,img->xsize*img->ysize*sizeof(rgb_group));
pop_n_elems(1);
THISOBJ->refs++;
push_object(THISOBJ);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
|