40 #include "attribute.hh"
55 Matrix(
int tab[6],
unsigned char color);
67 unsigned char Get_Color(
int alpha,
int b,
int c)
const;
68 bool Get_Bit(
int alpha,
int b,
int c,
int bit)
const;
69 unsigned char Get_Value(
int alpha,
int b,
int c)
const;
72 void Set_Color(
int alpha,
int b,
int c,
unsigned char color);
73 void Set_Bit(
int alpha,
int b,
int c,
int bit);
74 void Unset_Bit(
int alpha,
int b,
int c,
int bit);
75 void Set_Value(
int alpha,
int b,
int c,
unsigned char val);
105 for (
int i=0; i<6; i++)
114 for (
int i=0; i<6; i++)
117 m =
new unsigned char**[tab[0]-tab[1]+1];
119 for (
int i=0; i<limits[0]-limits[1]+1; i++)
121 m[i] =
new unsigned char*[tab[2]-tab[3]+1];
123 for (
int j=0; j<tab[2]-tab[3]+1; j++)
125 m[i][j] =
new unsigned char[tab[4]-tab[5]+1];
127 for (
int k=0; k<tab[4]-tab[5]+1; k++)
128 m[i][j][k] = (m[i][j][k] & 0xFC) | (color & 0x3);
136 for (
int i=0; i<6; i++)
137 limits[i] = mat.limits[i];
139 m =
new unsigned char**[limits[0]-limits[1]+1];
141 for (
int i=0; i<limits[0]-limits[1]+1; i++)
143 m[i] =
new unsigned char*[limits[2]-limits[3]+1];
145 for (
int j=0; j<limits[2]-limits[3]+1; j++)
147 m[i][j] =
new unsigned char[limits[4]-limits[5]+1];
149 for (
int k=0; k<limits[4]-limits[5]+1; k++)
150 m[i][j][k] = mat.m[i][j][k];
162 for (
int i=0; i<limits[0]-limits[1]+1; i++)
164 for (
int j=0; j<limits[2]-limits[3]+1; j++)
213 assert(alpha >= limits[1] && alpha <= limits[0] &&
214 b >= limits[3] && b <= limits[2] &&
215 c >= limits[5] && c <= limits[4]);
217 return (m[alpha-limits[1]][b-limits[3]][c-limits[5]] & 0x3);
223 assert(alpha >= limits[1] && alpha <= limits[0] &&
224 b >= limits[3] && b <= limits[2] &&
225 c >= limits[5] && c <= limits[4]);
227 return ((m[alpha-limits[1]][b-limits[3]][c-limits[5]] >> bit) & 0x1);
233 assert(alpha >= limits[1] && alpha <= limits[0] &&
234 b >= limits[3] && b <= limits[2] &&
235 c >= limits[5] && c <= limits[4]);
237 return (m[alpha-limits[1]][b-limits[3]][c-limits[5]]);
245 assert(alpha >= limits[1] && alpha <= limits[0] &&
246 b >= limits[3] && b <= limits[2] &&
247 c >= limits[5] && c <= limits[4]);
249 m[alpha-limits[1]][b-limits[3]][c-limits[5]] =
250 (m[alpha-limits[1]][b-limits[3]][c-limits[5]] & 0xFC) | (color & 0x3);
256 assert(alpha >= limits[1] && alpha <= limits[0] &&
257 b >= limits[3] && b <= limits[2] &&
258 c >= limits[5] && c <= limits[4]);
260 m[alpha-limits[1]][b-limits[3]][c-limits[5]] =
261 (m[alpha-limits[1]][b-limits[3]][c-limits[5]] | (0x1 << bit));
267 assert(alpha >= limits[1] && alpha <= limits[0] &&
268 b >= limits[3] && b <= limits[2] &&
269 c >= limits[5] && c <= limits[4]);
271 m[alpha-limits[1]][b-limits[3]][c-limits[5]] =
272 (m[alpha-limits[1]][b-limits[3]][c-limits[5]] & (0xFF - (0x1 << bit)));
278 assert(alpha >= limits[1] && alpha <= limits[0] &&
279 b >= limits[3] && b <= limits[2] &&
280 c >= limits[5] && c <= limits[4]);
282 m[alpha-limits[1]][b-limits[3]][c-limits[5]] = val;