source: abuse/tags/pd/macabuse/src/points.c

Last change on this file was 49, checked in by Sam Hocevar, 11 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 668 bytes
Line 
1#include "points.hpp"
2#include <string.h>
3
4#include "dev.hpp"
5
6
7point_list::point_list(unsigned char how_many, unsigned char *Data)
8{
9  tot=how_many;
10  if (tot)
11  {
12    data=(unsigned char *)jmalloc((int)how_many*2,"point list");
13    memcpy(data,Data,(int)tot*2);
14  } else data=NULL;
15}
16
17point_list::point_list(bFILE *fp)
18{
19  fp->read(&tot,1);
20  if (tot)
21  {
22    data=(unsigned char *)jmalloc((int)tot*2,"point list : loaded");
23    fp->read(data,(int)tot*2);
24
25    int i;
26    for (i=0;i<tot*2;i++)
27      data[i]=data[i]*scale_mult/scale_div;   
28
29  } else data=NULL;
30}
31
32void point_list::save(bFILE *fp)
33{
34  fp->write(&tot,1);
35  if (tot) fp->write(data,(int)tot*2);
36}
37
38
39
Note: See TracBrowser for help on using the repository browser.