File: morph.hpp

package info (click to toggle)
abuse 2.00-12
  • links: PTS
  • area: main
  • in suites: slink
  • size: 12,708 kB
  • ctags: 15,389
  • sloc: ansic: 115,852; cpp: 6,792; lisp: 2,066; sh: 1,734; makefile: 1,601; asm: 264
file content (102 lines) | stat: -rw-r--r-- 2,622 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef __MORPH_HPP_
#define __MORPH_HPP_

#include <stdio.h>
#include "image.hpp"
#include "palette.hpp"
#include "macs.hpp"
#include "monoprnt.hpp"
#include "specs.hpp"
#include "filter.hpp"
#include "jmalloc.hpp"


struct morph_point8
{ 
  unsigned char x1,y1,x2,y2;
  unsigned char start_color,end_color;
} ;

struct morph_point16
{ 
  unsigned short x1,y1,x2,y2;
  unsigned char start_color,end_color;
} ;

struct morph_patch                // patch a frame of animation
{
  unsigned short patches;
  unsigned char *patch_data;       // x,y,color
} ;

class jmorph
{
protected :
  unsigned char small;
  void *p;                  // points to a 8 or 16 struct
  long total; 
  unsigned short w[2],h[2];
public : 
  int total_points() { return total; }
  morph_point8 *small_points() { return (morph_point8 *)p; }
  jmorph(spec_entry *e, FILE *fp);
  jmorph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps);
  void show_frame(image *screen, int x, int y, int frames, int frame_on, 
             color_filter *fli, palette *pal); 
  void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal); 
  void show_24frame(unsigned char *screen, int width, int height,
                    int x, int y, int frames, int frame_on, palette *pal); 
  void show_step_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
  int bound_x1(int which) { return 0; }
  int bound_y1(int which) { return 0; }
  int bound_x2(int which) { return w[which]; }
  int bound_y2(int which) { return h[which]; }
  int write(FILE *fp);
  void add_filler(int frames);
  int small_morph() { return small; }
  ~jmorph() { jfree(p); }
} ; 



class patched_morph : public jmorph
{
public :
  morph_patch *pats;
  unsigned short patches;
  patched_morph(spec_entry *e, FILE *fp);
  patched_morph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps,
	        color_filter *fli, palette *pal, int frames);
  void show_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal); 
  void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal); 
  ~patched_morph() { jfree(pats); }

} ;

struct step_struct
{
  unsigned short x,y,r,g,b;
  short dx,dy,dr,dg,db;
} ;

class step_morph
{
  int total;
  step_struct *points;
  int frame_on,dir,face_dir;
  patched_morph *pm;
public :
  step_morph(patched_morph *mor, palette *pal, int frame_direction, int face_direction);
  void show_frame(image *screen, int x, int y,  color_filter *fli); 
  void reverse_direction();
  ~step_morph() { jfree(points); }
} ;


#endif