1 | /* ---------------- */ |
---|
2 | /* --- nrset2.c --- */ |
---|
3 | /* ---------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | * |
---|
9 | * Distributed under the Boost Software License, Version 1.0 |
---|
10 | * see accompanying file LICENSE.txt or copy it at |
---|
11 | * http://www.boost.org/LICENSE_1_0.txt |
---|
12 | */ |
---|
13 | |
---|
14 | |
---|
15 | #include <stdio.h> |
---|
16 | #include <stddef.h> |
---|
17 | #include <stdlib.h> |
---|
18 | #include <math.h> // fabs |
---|
19 | |
---|
20 | #include "mypredef.h" |
---|
21 | #include "nrtype.h" |
---|
22 | #include "nrdef.h" |
---|
23 | #include "nrmacro.h" |
---|
24 | #include "nrkernel.h" |
---|
25 | |
---|
26 | #include "nrset1.h" |
---|
27 | #include "nrset2.h" |
---|
28 | |
---|
29 | /* |
---|
30 | * ------------ |
---|
31 | * --- Zero --- |
---|
32 | * ------------ |
---|
33 | */ |
---|
34 | |
---|
35 | /* ---------------------------------------------------------------------- */ |
---|
36 | IMAGE_EXPORT(void) zero_si8matrix(sint8 **m, int i0, int i1, int j0, int j1) |
---|
37 | /* ---------------------------------------------------------------------- */ |
---|
38 | { |
---|
39 | int i; |
---|
40 | for(i=i0; i<=i1; i++) { |
---|
41 | zero_si8vector(m[i], j0, j1); |
---|
42 | } |
---|
43 | } |
---|
44 | /* ---------------------------------------------------------------------- */ |
---|
45 | IMAGE_EXPORT(void) zero_ui8matrix(uint8 **m, int i0, int i1, int j0, int j1) |
---|
46 | /* ---------------------------------------------------------------------- */ |
---|
47 | { |
---|
48 | int i; |
---|
49 | for(i=i0; i<=i1; i++) { |
---|
50 | zero_ui8vector(m[i], j0, j1); |
---|
51 | } |
---|
52 | } |
---|
53 | /* ------------------------------------------------------------------------ */ |
---|
54 | IMAGE_EXPORT(void) zero_si16matrix(sint16 **m, int i0, int i1, int j0, int j1) |
---|
55 | /* ------------------------------------------------------------------------ */ |
---|
56 | { |
---|
57 | int i; |
---|
58 | for(i=i0; i<=i1; i++) { |
---|
59 | zero_si16vector(m[i], j0, j1); |
---|
60 | } |
---|
61 | } |
---|
62 | /* ------------------------------------------------------------------------ */ |
---|
63 | IMAGE_EXPORT(void) zero_ui16matrix(uint16 **m, int i0, int i1, int j0, int j1) |
---|
64 | /* ------------------------------------------------------------------------ */ |
---|
65 | { |
---|
66 | int i; |
---|
67 | for(i=i0; i<=i1; i++) { |
---|
68 | zero_ui16vector(m[i], j0, j1); |
---|
69 | } |
---|
70 | } |
---|
71 | /* ------------------------------------------------------------------------ */ |
---|
72 | IMAGE_EXPORT(void) zero_si32matrix(sint32 **m, int i0, int i1, int j0, int j1) |
---|
73 | /* ------------------------------------------------------------------------ */ |
---|
74 | { |
---|
75 | int i; |
---|
76 | for(i=i0; i<=i1; i++) { |
---|
77 | zero_si32vector(m[i], j0, j1); |
---|
78 | } |
---|
79 | } |
---|
80 | /* ------------------------------------------------------------------------ */ |
---|
81 | IMAGE_EXPORT(void) zero_ui32matrix(uint32 **m, int i0, int i1, int j0, int j1) |
---|
82 | /* ------------------------------------------------------------------------ */ |
---|
83 | { |
---|
84 | int i; |
---|
85 | for(i=i0; i<=i1; i++) { |
---|
86 | zero_ui32vector(m[i], j0, j1); |
---|
87 | } |
---|
88 | } |
---|
89 | /* ------------------------------------------------------------------------ */ |
---|
90 | IMAGE_EXPORT(void) zero_si64matrix(sint64 **m, int i0, int i1, int j0, int j1) |
---|
91 | /* ------------------------------------------------------------------------ */ |
---|
92 | { |
---|
93 | int i; |
---|
94 | for(i=i0; i<=i1; i++) { |
---|
95 | zero_si64vector(m[i], j0, j1); |
---|
96 | } |
---|
97 | } |
---|
98 | /* ------------------------------------------------------------------------ */ |
---|
99 | IMAGE_EXPORT(void) zero_ui64matrix(uint64 **m, int i0, int i1, int j0, int j1) |
---|
100 | /* ------------------------------------------------------------------------ */ |
---|
101 | { |
---|
102 | int i; |
---|
103 | for(i=i0; i<=i1; i++) { |
---|
104 | zero_ui64vector(m[i], j0, j1); |
---|
105 | } |
---|
106 | } |
---|
107 | /* ------------------------------------------------------------------------ */ |
---|
108 | IMAGE_EXPORT(void) zero_f32matrix(float32 **m, int i0, int i1, int j0, int j1) |
---|
109 | /* ------------------------------------------------------------------------ */ |
---|
110 | { |
---|
111 | int i; |
---|
112 | for(i=i0; i<=i1; i++) { |
---|
113 | zero_f32vector(m[i], j0, j1); |
---|
114 | } |
---|
115 | } |
---|
116 | /* ------------------------------------------------------------------------ */ |
---|
117 | IMAGE_EXPORT(void) zero_f64matrix(float64 **m, int i0, int i1, int j0, int j1) |
---|
118 | /* ------------------------------------------------------------------------ */ |
---|
119 | { |
---|
120 | int i; |
---|
121 | for(i=i0; i<=i1; i++) { |
---|
122 | zero_f64vector(m[i], j0, j1); |
---|
123 | } |
---|
124 | } |
---|
125 | /* ---------------------------------------------------------------------- */ |
---|
126 | IMAGE_EXPORT(void) zero_rgb8matrix(rgb8 **m, int i0, int i1, int j0, int j1) |
---|
127 | /* ---------------------------------------------------------------------- */ |
---|
128 | { |
---|
129 | int i; |
---|
130 | for(i=i0; i<=i1; i++) { |
---|
131 | zero_rgb8vector(m[i], j0, j1); |
---|
132 | } |
---|
133 | } |
---|
134 | /* ------------------------------------------------------------------------ */ |
---|
135 | IMAGE_EXPORT(void) zero_rgbx8matrix(rgbx8 **m, int i0, int i1, int j0, int j1) |
---|
136 | /* ------------------------------------------------------------------------ */ |
---|
137 | { |
---|
138 | int i; |
---|
139 | for(i=i0; i<=i1; i++) { |
---|
140 | zero_rgbx8vector(m[i], j0, j1); |
---|
141 | } |
---|
142 | } |
---|
143 | /* |
---|
144 | * ------------------ |
---|
145 | * --- set_matrix --- |
---|
146 | * ------------------ |
---|
147 | */ |
---|
148 | |
---|
149 | /* ------------------------------------------------------------------------------ */ |
---|
150 | IMAGE_EXPORT(void) set_si8matrix(sint8 **m, int i0, int i1, int j0, int j1, sint8 x) |
---|
151 | /* ------------------------------------------------------------------------------ */ |
---|
152 | { |
---|
153 | int i; |
---|
154 | for(i=i0; i<=i1; i++) |
---|
155 | set_si8vector(m[i], j0, j1, x); |
---|
156 | } |
---|
157 | /* ------------------------------------------------------------------------------ */ |
---|
158 | IMAGE_EXPORT(void) set_ui8matrix(uint8 **m, int i0, int i1, int j0, int j1, uint8 x) |
---|
159 | /* ------------------------------------------------------------------------------ */ |
---|
160 | { |
---|
161 | int i; |
---|
162 | for(i=i0; i<=i1; i++) |
---|
163 | set_ui8vector(m[i], j0, j1, x); |
---|
164 | } |
---|
165 | /* --------------------------------------------------------------------------------- */ |
---|
166 | IMAGE_EXPORT(void) set_si16matrix(sint16 **m, int i0, int i1, int j0, int j1, sint16 x) |
---|
167 | /* --------------------------------------------------------------------------------- */ |
---|
168 | { |
---|
169 | int i; |
---|
170 | for(i=i0; i<=i1; i++) |
---|
171 | set_si16vector(m[i], j0, j1, x); |
---|
172 | } |
---|
173 | /* --------------------------------------------------------------------------------- */ |
---|
174 | IMAGE_EXPORT(void) set_ui16matrix(uint16 **m, int i0, int i1, int j0, int j1, uint16 x) |
---|
175 | /* --------------------------------------------------------------------------------- */ |
---|
176 | { |
---|
177 | int i; |
---|
178 | for(i=i0; i<=i1; i++) |
---|
179 | set_ui16vector(m[i], j0, j1, x); |
---|
180 | } |
---|
181 | /* --------------------------------------------------------------------------------- */ |
---|
182 | IMAGE_EXPORT(void) set_si32matrix(sint32 **m, int i0, int i1, int j0, int j1, sint32 x) |
---|
183 | /* --------------------------------------------------------------------------------- */ |
---|
184 | { |
---|
185 | int i; |
---|
186 | for(i=i0; i<=i1; i++) |
---|
187 | set_si32vector(m[i], j0, j1, x); |
---|
188 | } |
---|
189 | /* --------------------------------------------------------------------------------- */ |
---|
190 | IMAGE_EXPORT(void) set_ui32matrix(uint32 **m, int i0, int i1, int j0, int j1, uint32 x) |
---|
191 | /* --------------------------------------------------------------------------------- */ |
---|
192 | { |
---|
193 | int i; |
---|
194 | for(i=i0; i<=i1; i++) |
---|
195 | set_ui32vector(m[i], j0, j1, x); |
---|
196 | } |
---|
197 | /* --------------------------------------------------------------------------------- */ |
---|
198 | IMAGE_EXPORT(void) set_f32matrix(float32 **m, int i0, int i1,int j0, int j1, float32 x) |
---|
199 | /* --------------------------------------------------------------------------------- */ |
---|
200 | { |
---|
201 | int i; |
---|
202 | for(i=i0; i<=i1; i++) |
---|
203 | set_f32vector(m[i], j0, j1, x); |
---|
204 | } |
---|
205 | /* --------------------------------------------------------------------------------- */ |
---|
206 | IMAGE_EXPORT(void) set_f64matrix(float64 **m,int i0, int i1, int j0, int j1, float64 x) |
---|
207 | /* --------------------------------------------------------------------------------- */ |
---|
208 | { |
---|
209 | int i; |
---|
210 | for(i=i0; i<=i1; i++) |
---|
211 | set_f64vector(m[i], j0, j1, x); |
---|
212 | } |
---|
213 | /* ---------------------------------------------------------------------------- */ |
---|
214 | IMAGE_EXPORT(void) set_rgb8matrix(rgb8 **m,int i0, int i1, int j0, int j1, rgb8 x) |
---|
215 | /* ---------------------------------------------------------------------------- */ |
---|
216 | { |
---|
217 | int i; |
---|
218 | for(i=i0; i<=i1; i++) |
---|
219 | set_rgb8vector(m[i], j0, j1, x); |
---|
220 | } |
---|
221 | /* ----------------------------------------------------------------------------- */ |
---|
222 | IMAGE_EXPORT(void) set_rgbx8matrix(rgbx8 **m,int i0,int i1,int j0, int j1, rgbx8 x) |
---|
223 | /* ----------------------------------------------------------------------------- */ |
---|
224 | { |
---|
225 | int i; |
---|
226 | for(i=i0; i<=i1; i++) |
---|
227 | set_rgbx8vector(m[i], j0, j1, x); |
---|
228 | } |
---|
229 | /* |
---|
230 | * ---------------- |
---|
231 | * set_matrix_param |
---|
232 | * ---------------- |
---|
233 | */ |
---|
234 | /* ------------------------------------------------------------------------------------------------ */ |
---|
235 | void set_ui8matrix_param(uint8 **m, int i0, int i1, int j0, int j1, uint8 x, uint8 xstep, uint8 ystep) |
---|
236 | /* ------------------------------------------------------------------------------------------------ */ |
---|
237 | { |
---|
238 | int i; |
---|
239 | for(i=i0; i<=i1; i++) { |
---|
240 | set_ui8vector_param(m[i], j0, j1, x, xstep); |
---|
241 | x += ystep; |
---|
242 | } |
---|
243 | } |
---|
244 | /* -------------------------------------------------------------------------------------------------- */ |
---|
245 | void set_si8matrix_param(sint8 **m, int i0, int i1, int j0, int j1, sint8 x, sint8 xstep, sint8 ystep) |
---|
246 | /* -------------------------------------------------------------------------------------------------- */ |
---|
247 | { |
---|
248 | int i; |
---|
249 | for(i=i0; i<=i1; i++) { |
---|
250 | set_si8vector_param(m[i], j0, j1, x, xstep); |
---|
251 | x += ystep; |
---|
252 | } |
---|
253 | } |
---|
254 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
255 | void set_ui16matrix_param(uint16 **m, int i0, int i1, int j0, int j1, uint16 x, uint16 xstep, uint16 ystep) |
---|
256 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
257 | { |
---|
258 | int i; |
---|
259 | for(i=i0; i<=i1; i++) { |
---|
260 | set_ui16vector_param(m[i], j0, j1, x, xstep); |
---|
261 | x += ystep; |
---|
262 | } |
---|
263 | } |
---|
264 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
265 | void set_si16matrix_param(sint16 **m, int i0, int i1, int j0, int j1, sint16 x, sint16 xstep, sint16 ystep) |
---|
266 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
267 | { |
---|
268 | int i; |
---|
269 | for(i=i0; i<=i1; i++) { |
---|
270 | set_si16vector_param(m[i], j0, j1, x, xstep); |
---|
271 | x += ystep; |
---|
272 | } |
---|
273 | } |
---|
274 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
275 | void set_ui32matrix_param(uint32 **m, int i0, int i1, int j0, int j1, uint32 x, uint32 xstep, uint32 ystep) |
---|
276 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
277 | { |
---|
278 | int i; |
---|
279 | for(i=i0; i<=i1; i++) { |
---|
280 | set_ui32vector_param(m[i], j0, j1, x, xstep); |
---|
281 | x += ystep; |
---|
282 | } |
---|
283 | } |
---|
284 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
285 | void set_si32matrix_param(sint32 **m, int i0, int i1, int j0, int j1, sint32 x, sint32 xstep, sint32 ystep) |
---|
286 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
287 | { |
---|
288 | int i; |
---|
289 | for(i=i0; i<=i1; i++) { |
---|
290 | set_si32vector_param(m[i], j0, j1, x, xstep); |
---|
291 | x += ystep; |
---|
292 | } |
---|
293 | } |
---|
294 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
295 | void set_ui64matrix_param(uint64 **m, int i0, int i1, int j0, int j1, uint64 x, uint64 xstep, uint64 ystep) |
---|
296 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
297 | { |
---|
298 | int i; |
---|
299 | for(i=i0; i<=i1; i++) { |
---|
300 | set_ui64vector_param(m[i], j0, j1, x, xstep); |
---|
301 | x += ystep; |
---|
302 | } |
---|
303 | } |
---|
304 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
305 | void set_si64matrix_param(sint64 **m, int i0, int i1, int j0, int j1, sint64 x, sint64 xstep, sint64 ystep) |
---|
306 | /* ----------------------------------------------------------------------------------------------------- */ |
---|
307 | { |
---|
308 | int i; |
---|
309 | for(i=i0; i<=i1; i++) { |
---|
310 | set_si64vector_param(m[i], j0, j1, x, xstep); |
---|
311 | x += ystep; |
---|
312 | } |
---|
313 | } |
---|
314 | /* -------------------------------------------------------------------------------------------------------- */ |
---|
315 | void set_f32matrix_param(float32 **m, int i0, int i1, int j0, int j1, float32 x, float32 xstep, float32 ystep) |
---|
316 | /* -------------------------------------------------------------------------------------------------------- */ |
---|
317 | { |
---|
318 | int i; |
---|
319 | for(i=i0; i<=i1; i++) { |
---|
320 | set_f32vector_param(m[i], j0, j1, x, xstep); |
---|
321 | x += ystep; |
---|
322 | } |
---|
323 | } |
---|
324 | /* -------------------------------------------------------------------------------------------------------- */ |
---|
325 | void set_f64matrix_param(float64 **m, int i0, int i1, int j0, int j1, float64 x, float64 xstep, float64 ystep) |
---|
326 | /* -------------------------------------------------------------------------------------------------------- */ |
---|
327 | { |
---|
328 | int i; |
---|
329 | for(i=i0; i<=i1; i++) { |
---|
330 | set_f64vector_param(m[i], j0, j1, x, xstep); |
---|
331 | x += ystep; |
---|
332 | } |
---|
333 | } |
---|
334 | /* --------------------------------------------------------------------------------------------- */ |
---|
335 | void set_rgb8matrix_param(rgb8 **m, int i0, int i1, int j0, int j1, rgb8 x, rgb8 xstep, rgb8 ystep) |
---|
336 | /* --------------------------------------------------------------------------------------------- */ |
---|
337 | { |
---|
338 | int i; |
---|
339 | for(i=i0; i<=i1; i++) { |
---|
340 | set_rgb8vector_param(m[i], j0, j1, x, xstep); |
---|
341 | x.r += ystep.r; |
---|
342 | x.g += ystep.g; |
---|
343 | x.b += ystep.b; |
---|
344 | } |
---|
345 | } |
---|
346 | /* -------------------------------------------------------------------------------------------------- */ |
---|
347 | void set_rgbx8matrix_param(rgbx8 **m, int i0, int i1, int j0, int j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep) |
---|
348 | /* -------------------------------------------------------------------------------------------------- */ |
---|
349 | { |
---|
350 | int i; |
---|
351 | |
---|
352 | x.x = 0; |
---|
353 | for(i=i0; i<=i1; i++) { |
---|
354 | set_rgbx8vector_param(m[i], j0, j1, x, xstep); |
---|
355 | x.r += ystep.r; |
---|
356 | x.g += ystep.g; |
---|
357 | x.b += ystep.b; |
---|
358 | x.x += ystep.x; |
---|
359 | } |
---|
360 | } |
---|
361 | /* |
---|
362 | * -------------------- |
---|
363 | * --- set_matrix_i --- |
---|
364 | * -------------------- |
---|
365 | */ |
---|
366 | /* ----------------------------------------------------------------------- */ |
---|
367 | IMAGE_EXPORT(void) set_si8matrix_i(sint8 **m, int i0, int i1, int j0, int j1) |
---|
368 | /* ----------------------------------------------------------------------- */ |
---|
369 | { |
---|
370 | set_si8matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
371 | } |
---|
372 | /* ----------------------------------------------------------------------- */ |
---|
373 | IMAGE_EXPORT(void) set_ui8matrix_i(uint8 **m, int i0, int i1, int j0, int j1) |
---|
374 | /* ----------------------------------------------------------------------- */ |
---|
375 | { |
---|
376 | set_ui8matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
377 | } |
---|
378 | /* ------------------------------------------------------------------------- */ |
---|
379 | IMAGE_EXPORT(void) set_si16matrix_i(sint16 **m, int i0, int i1, int j0, int j1) |
---|
380 | /* ------------------------------------------------------------------------- */ |
---|
381 | { |
---|
382 | set_si16matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
383 | } |
---|
384 | /* ------------------------------------------------------------------------- */ |
---|
385 | IMAGE_EXPORT(void) set_ui16matrix_i(uint16 **m, int i0, int i1, int j0, int j1) |
---|
386 | /* ------------------------------------------------------------------------- */ |
---|
387 | { |
---|
388 | set_ui16matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
389 | } |
---|
390 | /* ------------------------------------------------------------------------- */ |
---|
391 | IMAGE_EXPORT(void) set_si32matrix_i(sint32 **m, int i0, int i1, int j0, int j1) |
---|
392 | /* ------------------------------------------------------------------------- */ |
---|
393 | { |
---|
394 | set_si32matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
395 | } |
---|
396 | /* ------------------------------------------------------------------------- */ |
---|
397 | IMAGE_EXPORT(void) set_ui32matrix_i(uint32 **m, int i0, int i1, int j0, int j1) |
---|
398 | /* ------------------------------------------------------------------------- */ |
---|
399 | { |
---|
400 | set_ui32matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
401 | } |
---|
402 | /* ------------------------------------------------------------------------- */ |
---|
403 | IMAGE_EXPORT(void) set_si64matrix_i(sint64 **m, int i0, int i1, int j0, int j1) |
---|
404 | /* ------------------------------------------------------------------------- */ |
---|
405 | { |
---|
406 | set_si64matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
407 | } |
---|
408 | /* ------------------------------------------------------------------------- */ |
---|
409 | IMAGE_EXPORT(void) set_ui64matrix_i(uint64 **m, int i0, int i1, int j0, int j1) |
---|
410 | /* ------------------------------------------------------------------------- */ |
---|
411 | { |
---|
412 | set_ui64matrix_param(m, i0, i1, j0, j1, i0,0, 1); |
---|
413 | } |
---|
414 | /* ------------------------------------------------------------------------- */ |
---|
415 | IMAGE_EXPORT(void) set_f32matrix_i(float32 **m, int i0, int i1, int j0, int j1) |
---|
416 | /* ------------------------------------------------------------------------- */ |
---|
417 | { |
---|
418 | set_f32matrix_param(m, i0, i1, j0, j1, (float32) i0, (float32)0, (float32)1); |
---|
419 | } |
---|
420 | /* ------------------------------------------------------------------------- */ |
---|
421 | IMAGE_EXPORT(void) set_f64matrix_i(float64 **m, int i0, int i1, int j0, int j1) |
---|
422 | /* ------------------------------------------------------------------------- */ |
---|
423 | { |
---|
424 | set_f64matrix_param(m, i0, i1, j0, j1, i0,(float64)0, (float64)1); |
---|
425 | } |
---|
426 | /* ----------------------------------------------------------------------- */ |
---|
427 | IMAGE_EXPORT(void) set_rgb8matrix_i(rgb8 **m, int i0, int i1, int j0, int j1) |
---|
428 | /* ----------------------------------------------------------------------- */ |
---|
429 | { |
---|
430 | rgb8 x0, xstep, ystep; |
---|
431 | |
---|
432 | x0.r = x0.g = x0.b = i0; |
---|
433 | xstep.r = xstep.g = xstep.b = 0; |
---|
434 | ystep.r = ystep.g = ystep.b = 1; |
---|
435 | |
---|
436 | set_rgb8matrix_param(m, i0, i1, j0, j1, x0, xstep, ystep); |
---|
437 | } |
---|
438 | /* ------------------------------------------------------------------------- */ |
---|
439 | IMAGE_EXPORT(void) set_rgbx8matrix_i(rgbx8 **m, int i0, int i1, int j0, int j1) |
---|
440 | /* ------------------------------------------------------------------------- */ |
---|
441 | { |
---|
442 | rgbx8 x, xstep, ystep; |
---|
443 | |
---|
444 | x.r = x.g = x.b = i0; x.x = 255; |
---|
445 | xstep.r = xstep.g = xstep.b = 0; xstep.x = 255; |
---|
446 | ystep.r = ystep.g = ystep.b = 1; ystep.x = 255; |
---|
447 | |
---|
448 | set_rgbx8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); |
---|
449 | } |
---|
450 | /* |
---|
451 | * -------------------- |
---|
452 | * --- set_matrix_j --- |
---|
453 | * -------------------- |
---|
454 | */ |
---|
455 | /* ----------------------------------------------------------------------- */ |
---|
456 | IMAGE_EXPORT(void) set_si8matrix_j(sint8 **m, int i0, int i1, int j0, int j1) |
---|
457 | /* ----------------------------------------------------------------------- */ |
---|
458 | { |
---|
459 | set_si8matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
460 | } |
---|
461 | /* ----------------------------------------------------------------------- */ |
---|
462 | IMAGE_EXPORT(void) set_ui8matrix_j(uint8 **m, int i0, int i1, int j0, int j1) |
---|
463 | /* ----------------------------------------------------------------------- */ |
---|
464 | { |
---|
465 | set_ui8matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
466 | } |
---|
467 | /* ------------------------------------------------------------------------- */ |
---|
468 | IMAGE_EXPORT(void) set_si16matrix_j(sint16 **m, int i0, int i1, int j0, int j1) |
---|
469 | /* ------------------------------------------------------------------------- */ |
---|
470 | { |
---|
471 | set_si16matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
472 | } |
---|
473 | /* ------------------------------------------------------------------------- */ |
---|
474 | IMAGE_EXPORT(void) set_ui16matrix_j(uint16 **m, int i0, int i1, int j0, int j1) |
---|
475 | /* ------------------------------------------------------------------------- */ |
---|
476 | { |
---|
477 | set_ui16matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
478 | } |
---|
479 | /* ------------------------------------------------------------------------- */ |
---|
480 | IMAGE_EXPORT(void) set_si32matrix_j(sint32 **m, int i0, int i1, int j0, int j1) |
---|
481 | /* ------------------------------------------------------------------------- */ |
---|
482 | { |
---|
483 | set_si32matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
484 | } |
---|
485 | /* ------------------------------------------------------------------------- */ |
---|
486 | IMAGE_EXPORT(void) set_ui32matrix_j(uint32 **m, int i0, int i1, int j0, int j1) |
---|
487 | /* ------------------------------------------------------------------------- */ |
---|
488 | { |
---|
489 | set_ui32matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
490 | } |
---|
491 | /* ------------------------------------------------------------------------- */ |
---|
492 | IMAGE_EXPORT(void) set_si64matrix_j(sint64 **m, int i0, int i1, int j0, int j1) |
---|
493 | /* ------------------------------------------------------------------------- */ |
---|
494 | { |
---|
495 | set_si64matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
496 | } |
---|
497 | /* ------------------------------------------------------------------------- */ |
---|
498 | IMAGE_EXPORT(void) set_ui64matrix_j(uint64 **m, int i0, int i1, int j0, int j1) |
---|
499 | /* ------------------------------------------------------------------------- */ |
---|
500 | { |
---|
501 | set_ui64matrix_param(m, i0, i1, j0, j1, j0, 1, 0); |
---|
502 | } |
---|
503 | /* ------------------------------------------------------------------------- */ |
---|
504 | IMAGE_EXPORT(void) set_f32matrix_j(float32 **m, int i0, int i1, int j0, int j1) |
---|
505 | /* ------------------------------------------------------------------------- */ |
---|
506 | { |
---|
507 | set_f32matrix_param(m, i0, i1, j0, j1, (float32)j0,(float32)1, (float32)0); |
---|
508 | } |
---|
509 | /* ------------------------------------------------------------------------- */ |
---|
510 | IMAGE_EXPORT(void) set_f64matrix_j(float64 **m, int i0, int i1, int j0, int j1) |
---|
511 | /* ------------------------------------------------------------------------- */ |
---|
512 | { |
---|
513 | set_f64matrix_param(m, i0, i1, j0, j1, j0,(float64)1, (float64)0); |
---|
514 | } |
---|
515 | /* ----------------------------------------------------------------------- */ |
---|
516 | IMAGE_EXPORT(void) set_rgb8matrix_j(rgb8 **m, int i0, int i1, int j0, int j1) |
---|
517 | /* ----------------------------------------------------------------------- */ |
---|
518 | { |
---|
519 | rgb8 x, xstep, ystep; |
---|
520 | |
---|
521 | x.r = x.g = x.b = j0; |
---|
522 | xstep.r = xstep.g = xstep.b = 1; |
---|
523 | ystep.r = ystep.g = ystep.b = 0; |
---|
524 | |
---|
525 | set_rgb8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); |
---|
526 | } |
---|
527 | /* ------------------------------------------------------------------------- */ |
---|
528 | IMAGE_EXPORT(void) set_rgbx8matrix_j(rgbx8 **m, int i0, int i1, int j0, int j1) |
---|
529 | /* ------------------------------------------------------------------------- */ |
---|
530 | { |
---|
531 | rgbx8 x, xstep, ystep; |
---|
532 | |
---|
533 | x.r = x.g = x.b = j0; x.x = 255; |
---|
534 | xstep.r = xstep.g = xstep.b = 1; xstep.x = 255; |
---|
535 | ystep.r = ystep.g = ystep.b = 0; ystep.x = 255; |
---|
536 | |
---|
537 | set_rgbx8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); |
---|
538 | }/* |
---|
539 | * -------------- |
---|
540 | * --- autres --- |
---|
541 | * -------------- |
---|
542 | */ |
---|
543 | /* ------------------------------------------------------------------------------------ */ |
---|
544 | IMAGE_EXPORT(void) set_ui8matrix_border1(uint8 **m,int i0, int i1, int j0, int j1, uint8 x) |
---|
545 | /* ------------------------------------------------------------------------------------- */ |
---|
546 | { |
---|
547 | int i; |
---|
548 | |
---|
549 | set_ui8vector(m[i0], j0, j1, x); |
---|
550 | |
---|
551 | for(i=i0+1; i<=i1-1; i++) { |
---|
552 | m[i][j0] = x; |
---|
553 | m[i][j1] = x; |
---|
554 | } |
---|
555 | |
---|
556 | set_ui8vector(m[i0], j0, j1, x); |
---|
557 | } |
---|
558 | /* --------------------------------------------------------------------------------------- */ |
---|
559 | IMAGE_EXPORT(void) set_ui8matrix_border(uint8 **m,int i0,int i1,int j0, int j1, int n, uint8 x) |
---|
560 | /* --------------------------------------------------------------------------------------- */ |
---|
561 | { |
---|
562 | int i, j; |
---|
563 | uint8 *Xi=NULL; |
---|
564 | |
---|
565 | for(i=i0; i<i0+n; i++) { |
---|
566 | Xi = m[i]; |
---|
567 | for(j=j0; j<=j1; j++) { |
---|
568 | Xi[j] = x; |
---|
569 | } |
---|
570 | } |
---|
571 | |
---|
572 | for(i=i0+n; i<i1; i++) { |
---|
573 | Xi = m[i]; |
---|
574 | for(j=0; j<n; j++) { |
---|
575 | Xi[j0+j] = x; |
---|
576 | Xi[j1-j] = x; |
---|
577 | } |
---|
578 | } |
---|
579 | |
---|
580 | for(i=i1-n+1; i<=i1; i++) { |
---|
581 | Xi = m[i]; |
---|
582 | for(j=j0; j<=j1; j++) { |
---|
583 | Xi[j] = x; |
---|
584 | } |
---|
585 | } |
---|
586 | } |
---|