-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpopulatearray.c
More file actions
53 lines (47 loc) · 1.25 KB
/
populatearray.c
File metadata and controls
53 lines (47 loc) · 1.25 KB
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
53
#include <stdio.h>
#include "populatearray.h"
#include "main.h"
int readimage(FRAMECHAR *CurrentFrame, int g)
{
CurrentFrame->width = Widths;
CurrentFrame->height = Heights;
CurrentFrame->position = g;
int i,j,k;
k = 2;
if(k == 1)
{
for(i=0;i<Heights;i++)
{
for(j=0;j<Widths*3;j++)
{
if(j%3==0)
{
CurrentFrame->framebits[i][j] = i*2;
}
else
{
CurrentFrame->framebits[i][j] = 100;
}
}
}
}
else
{
unsigned char buffer[Widths*3];
FILE* infile;
char buffers[50];
sprintf(buffers,"SDCard/Video/%d.bmp",g);
infile = fopen(buffers,"rb");
unsigned int row, col;
for(row = 0;row < Heights; row++) {
fseek(infile,-(3*Widths*(row + 1)),SEEK_END);
//Read row from matrix
fread(buffer, 1,Widths*3, infile);
for(col = 0; col < Widths*3; col++) {\
// printf("%d - %d \n",buffer[col], buffer[col]-128);
CurrentFrame->framebits[row][col] = buffer[col];
}
}
}
return (0);
}