source: abuse/branches/pd/imlib/include/morph.hpp @ 597

Last change on this file since 597 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
File size: 2.6 KB
Line 
1#ifndef __MORPH_HPP_
2#define __MORPH_HPP_
3
4#include <stdio.h>
5#include "image.hpp"
6#include "palette.hpp"
7#include "macs.hpp"
8#include "monoprnt.hpp"
9#include "specs.hpp"
10#include "filter.hpp"
11#include "jmalloc.hpp"
12
13
14struct morph_point8
15{
16  unsigned char x1,y1,x2,y2;
17  unsigned char start_color,end_color;
18} ;
19
20struct morph_point16
21{
22  unsigned short x1,y1,x2,y2;
23  unsigned char start_color,end_color;
24} ;
25
26struct morph_patch                // patch a frame of animation
27{
28  unsigned short patches;
29  unsigned char *patch_data;       // x,y,color
30} ;
31
32class jmorph
33{
34protected :
35  unsigned char small;
36  void *p;                  // points to a 8 or 16 struct
37  long total;
38  unsigned short w[2],h[2];
39public :
40  int total_points() { return total; }
41  morph_point8 *small_points() { return (morph_point8 *)p; }
42  jmorph(spec_entry *e, FILE *fp);
43  jmorph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps);
44  void show_frame(image *screen, int x, int y, int frames, int frame_on,
45             color_filter *fli, palette *pal);
46  void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
47  void show_24frame(unsigned char *screen, int width, int height,
48                    int x, int y, int frames, int frame_on, palette *pal);
49  void show_step_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
50  int bound_x1(int which) { return 0; }
51  int bound_y1(int which) { return 0; }
52  int bound_x2(int which) { return w[which]; }
53  int bound_y2(int which) { return h[which]; }
54  int write(FILE *fp);
55  void add_filler(int frames);
56  int small_morph() { return small; }
57  ~jmorph() { jfree(p); }
58} ;
59
60
61
62class patched_morph : public jmorph
63{
64public :
65  morph_patch *pats;
66  unsigned short patches;
67  patched_morph(spec_entry *e, FILE *fp);
68  patched_morph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps,
69                color_filter *fli, palette *pal, int frames);
70  void show_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
71  void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
72  ~patched_morph() { jfree(pats); }
73
74} ;
75
76struct step_struct
77{
78  unsigned short x,y,r,g,b;
79  short dx,dy,dr,dg,db;
80} ;
81
82class step_morph
83{
84  int total;
85  step_struct *points;
86  int frame_on,dir,face_dir;
87  patched_morph *pm;
88public :
89  step_morph(patched_morph *mor, palette *pal, int frame_direction, int face_direction);
90  void show_frame(image *screen, int x, int y,  color_filter *fli);
91  void reverse_direction();
92  ~step_morph() { jfree(points); }
93} ;
94
95
96#endif
97
98
99
100
101
102
Note: See TracBrowser for help on using the repository browser.