24 static color colormap[17] = {
51 _size_x = src->_specified_x;
52 _size_y = src->_specified_y;
54 _fps = src->_specified_fps;
55 int padx = _size_x + 2;
56 int pady = _size_y + 2;
57 _cells =
new unsigned char[padx * pady];
58 _cells2 =
new unsigned char[padx * pady];
59 memset(_cells, 255, padx * pady);
60 memset(_cells2, 255, padx * pady);
62 _can_seek_fast =
false;
71 ~InkblotVideoCursor() {
81 int frame = (int)(time / _fps);
82 if (frame == _current_frame) {
86 _current_frame = frame;
95 PT(
Buffer) buffer = get_standard_buffer();
97 int padx = size_x() + 2;
98 int pady = size_y() + 2;
100 if (_current_frame < _last_frame) {
102 memset(_cells, 255, padx * pady);
103 memset(_cells2, 255, padx * pady);
107 while (_last_frame <= _current_frame) {
109 for (
int y=1; y<pady-1; y++) {
110 for (
int x=1; x<padx-1; x++) {
112 _cells[(x+1)+(y+1)*padx] +
113 _cells[(x+1)+(y+0)*padx] +
114 _cells[(x+1)+(y-1)*padx] +
115 _cells[(x+0)+(y+1)*padx] +
116 _cells[(x+0)+(y+0)*padx] +
117 _cells[(x+0)+(y-1)*padx] +
118 _cells[(x-1)+(y+1)*padx] +
119 _cells[(x-1)+(y+0)*padx] +
120 _cells[(x-1)+(y-1)*padx];
121 _cells2[x + y*padx] = (tot/9)+3;
124 unsigned char *t = _cells;
129 unsigned char *data = buffer->_block;
130 for (
int y=1; y<pady - 1; y++) {
131 for (
int x=1; x<padx - 1; x++) {
132 int val = _cells[x + y*padx];
133 color &c1 = colormap[(val>>4)+0];
134 color &c2 = colormap[(val>>4)+1];
136 data[0] = (c1.b * (16-lerp) + c2.b * lerp) / 16;
137 data[1] = (c1.g * (16-lerp) + c2.g * lerp) / 16;
138 data[2] = (c1.r * (16-lerp) + c2.r * lerp) / 16;
InkblotVideoCursor(InkblotVideo *src)
xxx
PT(MovieVideoCursor::Buffer) InkblotVideoCursor
See MovieVideoCursor::fetch_buffer.
virtual bool set_time(double time, int loop_count)
See MovieVideoCursor::set_time().
A MovieVideo is actually any source that provides a sequence of video frames.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A cellular automaton that generates an amusing pattern of swirling colors.
TypeHandle is the identifier used to differentiate C++ class types.