-
Notifications
You must be signed in to change notification settings - Fork 0
/
jio.c
52 lines (42 loc) · 910 Bytes
/
jio.c
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
#include <stdio.h>
#include "julia.h"
unsigned long mat[MAXX][MAXY];
unsigned long *mp;
void ppmwrite(FILE *f, FN *re, FN *im, char *s)
{
int i, N;
f=fopen(s, "w");
fprintf(f, "P6\n# Created by Eidon ([email protected]), 2018. re(x,y)=%s, im(x,y)=%s\n",
fn(re), fn(im));
fprintf(f, "%d %d\n255\n", MAXX, MAXY);
N=MAXX*MAXY;
mp=(unsigned long *)mat;
for (i=0; i<N; i++, mp++) {
fputc ( (int) *mp & 0xff , f );
*mp >>= 8;
fputc ( (int) *mp & 0xff , f );
*mp >>= 8;
fputc ( (int) *mp & 0xff , f );
}
}
void pset(int col)
{
static unsigned long *mpi = &mat[0][0];
/*
static unsigned long *mpf = &mat[MAXX-1][MAXY-1];
*/
*mpi++ = col;
}
void psetcol(int i, int j, int col)
{
if(i<MAXX && i<MAXY)
mat[i][j] = (unsigned char)col;
else
printf("Errore in psetcol: i=%d,j=%d\n", i, j);
}
void azzera_mat()
{
int N=MAXX*MAXY;
mp=(unsigned long *)mat;
while (N--) *mp++ = 16777215;
}