/* display jpeg door */ int display_jpeg_door(const char *jpegname, fb_info fb_inf) { fb_info jpeg_inf; int yres; int xloop; u8_t *buf24 = decode_jpeg(jpegname, &jpeg_inf); u8_t *scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); for (xloop = 0; xloop < fb_inf.w / 2; xloop++) { for(yres = 0; yres < fb_inf.h; yres++) { fb_pixel(fb_inf, fb_inf.w / 2 - xloop, yres, buf32[fb_inf.w / 2 - xloop + (yres * fb_inf.w)]); fb_pixel(fb_inf, fb_inf.w / 2 + xloop, yres, buf32[fb_inf.w / 2 + xloop + (yres * fb_inf.w)]); } usleep(1); } free(buf24); free(scale_buf); free(buf32); return 0; }
/* display jpeg down */ int display_jpeg_down(const char *jpegname, fb_info fb_inf) { fb_info jpeg_inf; int xres; int yres; int yloop; u8_t *buf24 = decode_jpeg(jpegname, &jpeg_inf); u8_t *scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); for (yloop = 0; yloop < fb_inf.h / 2; yloop += 2) { for (yres = 0; yres < yloop; yres++) { for (xres = 0; xres < fb_inf.w / 2; xres++) { fb_pixel(fb_inf, xres, yres + 2, buf32[xres + ((fb_inf.h / 2 - yloop + yres) * fb_inf.w)]); fb_pixel(fb_inf, fb_inf.w / 2 + xres, yres + 2, buf32[fb_inf.w / 2 + xres + ((fb_inf.h / 2 - yloop + yres) * fb_inf.w)]); fb_pixel(fb_inf, xres, fb_inf.h - 2 - yloop + yres, buf32[xres + ((fb_inf.h / 2 + yres) * fb_inf.w)]); fb_pixel(fb_inf, fb_inf.w / 2 + xres, fb_inf.h - 2 - yloop + yres, buf32[fb_inf.w / 2 + xres + ((fb_inf.h / 2 + yres) * fb_inf.w)]); } } } free(buf24); free(scale_buf); free(buf32); return 0; }
int moveline2(char *filename, fb_info fb_inf) { fb_info jpeg_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); int i, j, n; for(n = 0; n <= fb_inf.w/2; n++) { for(j = 0; j < fb_inf.h; j++) { for(i = 0; i <= n; i++) fb_pixel(fb_inf, i , j, buf32[j*fb_inf.w + i]); for(i = 0; i <= n; i++) fb_pixel(fb_inf, i + fb_inf.w - n , j , buf32[j*fb_inf.w + i + fb_inf.w - n]); } usleep(10); } free(buf24); free(scale_buf); free(buf32); return 0; }
int display_four(const char *filename, fb_info fb_inf) { fb_info jpeg_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); int i, j, n, m; for(i=0, j=0; i<=fb_inf.h/2 || j<=fb_inf.w/2; i= i + 6, j = j + 8) { for(n=0; n<=i; n++) { for(m=0; m<=j; m++) { if(*status_p == 0) goto biao3; fb_pixel(fb_inf, m, n, buf32[fb_inf.w * (fb_inf.h/2 -i + n) + fb_inf.w/2 - j + m]); fb_pixel(fb_inf, m, fb_inf.h - n - 1, buf32[fb_inf.w * (fb_inf.h/2 + i - n) + fb_inf.w/2 - j + m]); fb_pixel(fb_inf, fb_inf.w - m, n, buf32[fb_inf.w * (fb_inf.h/2 -i + n) + fb_inf.w/2 + j - m]); fb_pixel(fb_inf, fb_inf.w - m, fb_inf.h - n - 1, buf32[fb_inf.w * (fb_inf.h/2 +i -n) + fb_inf.w/2 +j - m]); } } } biao3: free(buf24); free(scale_buf); free(buf32); return 0; }
int fb_left_half_cirle(fb_info fb_inf, int x0, int y0, int r, u32_t color) { int x = 0; int y = r; int p = 3 - 2*r; while(y >= x) { // fb_pixel(fb_inf, x0+x, y0+y, color); // fb_pixel(fb_inf, x0+y, y0+x, color); fb_pixel(fb_inf, x0-x, y0+y, color); // fb_pixel(fb_inf, x0+x, y0-y, color); fb_pixel(fb_inf, x0-y, y0+x, color); fb_pixel(fb_inf, x0-x, y0-y, color); // fb_pixel(fb_inf, x0+y, y0-x, color); fb_pixel(fb_inf, x0-y, y0-x, color); if(p >= 0) { y --; p += (4*(x-y) + 10); } else { p += (4*x + 6); } x++; } return 0; }
int grain(char *filename, fb_info fb_inf) { fb_info jpeg_inf; buf24 = decode_jpeg(filename, &jpeg_inf); scale_buf = scale24(buf24, fb_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, fb_inf); int i, j, count = 0, temp, tcount = 0; int assigned[3072] = {0}; srand((unsigned)time(NULL)); while(count < 3072) { temp = rand() % 3072; tcount++; if(!assigned[temp]) { assigned[temp] = 1; for(i = temp/64 * 16; i < temp/64 * 16 + 16; ++i) { for (j = temp%64 * 16; j < temp%64 * 16 + 16; ++j) { fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); } } count++; delay(1); if(msg[0] == 2) return 1; } if(count > 2500) { for(i = 0; i < fb_inf.h; ++i) { for (j = 0; j < fb_inf.w; ++j) { fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); } } if(msg[0] == 2) return 1; break; } if(tcount == 10000) { srand((unsigned)time(NULL)); tcount = 0; } } free(buf24); free(scale_buf); free(buf32); return 0; }
int display_line(u32_t *buf32, fb_info fb_inf, int x1, int y1, int x2, int y2) { int dx = x2 - x1; int dy = y2 - y1; int inc = ((dy * dx > 0) ? 1 : -1); if (abs(dx) > abs(dy)) { if(dx < 0) { swap(&x1, &x2); swap(&y1, &y2); dx = -dx; dy = -dy; } dy = abs(dy); int p = 2 * dy - dx; while (x1 <= x2) { fb_pixel(fb_inf,x1, y1, buf32[x1+y1*fb_inf.w]); x1++; if (p < 0) p += 2 * dy; else { p += 2 * (dy - dx); y1 += inc; } } } else { if(dy < 0) { swap(&x1, &x2); swap(&y1, &y2); dx = -dx; dy = -dy; } dx = abs(dx); int p = 2 * dx - dy; while (y1 <= y2) { //fb_one_piexl(x1, y1, color); fb_pixel(fb_inf,x1, y1, buf32[x1+y1*fb_inf.w]); y1++; if (p < 0) p += 2 * dx; else { p += 2 * (dx - dy); x1 += inc; } } } return 0; }
int roll(char *filename,char *filename1, fb_info fb_inf) { fb_info jpeg_inf; fb_info jpeg_inf1; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); u8_t *buf241 = decode_jpeg(filename1, &jpeg_inf1); u8_t * scale_buf1 = scale24(buf241, fb_inf, jpeg_inf1); u32_t *buf321 = rgb24to32(scale_buf1, fb_inf); int i, j, n, m; // x, y is a point of the roll picture // w, h is the wide and high of the pictrue int x, y, x1, y1, w, h; x = fb_inf.w/8; y = fb_inf.h/2; w = 325; h = 455; x1 = 40; y1 = 205; for(j = 0; j < fb_inf.h; j++) for(i = 0; i < fb_inf.w; i++) fb_pixel(fb_inf, i, j, buf32[j*fb_inf.w + i]); for(j = 0; j < h - 15; j++) { for(n = 0 , m = 15; n <= j; n++, m--) { if(m > 0) for(i = 0; i < w; i++) fb_pixel(fb_inf, i + x1, y1 + m, buf321[(y1 + h - j + 15 - m - 10)*fb_inf.w + i + x1]); for(i = 0; i < w; i++) { // if(n < h/10&& m > 0) // fb_pixel(fb_inf, i + x1, y1 + n - 15, buf321[(y1 + h - j + n - m+ h/10 - 50 )*fb_inf.w + i + x1]); fb_pixel(fb_inf, i + x1, y1 + 15 + n, buf321[(y1 + h - j + n)*fb_inf.w + i + x1]); } } usleep(10000); } free(buf24); free(scale_buf); free(buf32); free(buf241); free(scale_buf1); free(buf321); return 0; }
int turn2(char *filename, char*filename1, fb_info fb_inf) { fb_info jpeg_inf; fb_info jpeg_inf1; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t *buf241 = decode_jpeg(filename1, &jpeg_inf1); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u8_t * scale_buf1 = scale24(buf241, fb_inf, jpeg_inf1); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); u32_t *buf321 = rgb24to32(scale_buf1, fb_inf); int i, j, h, w, new_h, new_w, m, n; new_h = fb_inf.h; n = m = 0; while(new_h>0) { for(j = 0; j < new_h; j++) { new_w = fb_inf.w -m + m*(n++)/new_h; h = j*fb_inf.h/new_h; for(i = 0; i < new_w; i++) { w = i*fb_inf.w/new_w; if(i + (fb_inf.w - new_w)/2 > 0 && i + (fb_inf.w - new_w)/2 < fb_inf.w && j + fb_inf.h - new_h > 0&& j + fb_inf.h - new_h < fb_inf.h) fb_pixel(fb_inf, i + (fb_inf.w - new_w)/2, j + fb_inf.h - new_h, buf32[h*fb_inf.w + w]); } } n = 0; for(j = 0; j < new_h; j++) { new_w = fb_inf.w -m + m*(n++)/new_h; for(i = 0; i < fb_inf.w; i++ ) if(i < (fb_inf.w - new_w)/2 || i > new_w + (fb_inf.w - new_w)/2 ) if(i > 0 && i < fb_inf.w && j + (fb_inf.h - new_h)/2 > 0 && j + (fb_inf.h - new_h) < fb_inf.h) fb_pixel(fb_inf, i, j + (fb_inf.h - new_h), buf321[(j + (fb_inf.h - new_h))*fb_inf.w + i]); } for(j = 0; j < fb_inf.h - new_h; j++) for(i = 0; i < fb_inf.w; i++) fb_pixel(fb_inf, i, j, buf321[j*fb_inf.w + i]); m += 2; n = 0; new_h -= 5; usleep(10000); } free(buf24); free(scale_buf); free(buf32); return 0; }
int fly_multi(char *filename, fb_info fb_inf) { fb_info jpeg_inf; buf24 = decode_jpeg(filename, &jpeg_inf); scale_buf = scale24(buf24, fb_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, fb_inf); //float gama = fb_inf.w / fb_inf.h; int i, j, k; for(k = 0; k <= fb_inf.w / 2; k+=5) { for(i = 0; i <= fb_inf.h / 2; ++i) { for (j = fb_inf.w / 2 - k; j <= fb_inf.w / 2; ++j) { fb_pixel(fb_inf, j + k - fb_inf.w / 2, i, buf32[j + i * fb_inf.w]); } } for(i = fb_inf.h / 2; i <= fb_inf.h; ++i) { for (j = fb_inf.w - 1 ; j >= fb_inf.w - k; --j) { fb_pixel(fb_inf, j , i, buf32[j + i * fb_inf.w]); } } if(msg[0] == 2) return 1; } for(k = 0; k <= fb_inf.h / 2; k+=5) { for(i = fb_inf.h / 2 - k; i < fb_inf.h / 2; i++) { for(j = fb_inf.w / 2; j < fb_inf.w; j++) fb_pixel(fb_inf, j , i + k - fb_inf.h / 2, buf32[j + i * fb_inf.w]); } for(i = fb_inf.h - 1; i >= fb_inf.h - k; i--) { for(j = 0; j <= fb_inf.w / 2; j++) fb_pixel(fb_inf, j , i, buf32[j + i * fb_inf.w]); } if(msg[0] == 2) return 1; } for(i = 0; i < fb_inf.h; ++i){ for (j = 0; j < fb_inf.w; ++j){ fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); } } free(buf24); free(scale_buf); free(buf32); return 0; }
int opend_cant1(char *filename, fb_info fb_inf) { int yres ; int xres1 ; int xres2; int xres; int iloop; int jloop; float x1 = 512.00; float y1 = 384.00; float k ; fb_info jpeg_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t *scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); for(jloop = 0;jloop < fb_inf.h/2;jloop++) { for(iloop =fb_inf.w/2;iloop < fb_inf.w;iloop++) { k = (iloop -x1)/(y1 -jloop); yres = k*(iloop - fb_inf.w/2); xres1 = iloop; xres2 = fb_inf.w -iloop-1; if(yres <fb_inf.h) { fb_pixel(fb_inf, xres1, yres, buf32[xres1 + (yres * fb_inf.w)]); fb_pixel(fb_inf, xres2,(fb_inf.h- yres-1), buf32[xres2 + (fb_inf.h- yres-1) * fb_inf.w]); } } usleep(10); } for(yres =fb_inf.w/2;yres >= 0;yres--) { for(xres = 0;xres < fb_inf.h;xres++) { fb_pixel(fb_inf, yres, xres, buf32[yres + (xres * fb_inf.w)]); fb_pixel(fb_inf, fb_inf.w -1-yres, xres, buf32[(fb_inf.w -1 -yres) + (xres * fb_inf.w)]); } usleep(10); } free(buf24); free(scale_buf); free(buf32); usleep(10); return 0; }
int display(info_t*fb, int x, int y,info_t *jpeg_size,char *filename) { info_t jpeg; u8_t *buf = decode_jpeg(filename,&jpeg); u8_t *buf24=scale24(buf,jpeg_size,&jpeg); u32_t *buf32=rgb24to32(buf24,jpeg_size); int i,j; for(j=0;j<jpeg_size->h/8;++j) { for(i = 0;i< jpeg_size->w; ++i) { int n = jpeg_size->h/8; fb_pixel(fb, i+x, y+j,buf32[i+j*jpeg_size->w]); fb_pixel(fb, i+x, y+n+j,buf32[i+(j+n)*jpeg_size->w]); fb_pixel(fb, i+x, y+2*n+j,buf32[i+(j+2*n)*jpeg_size->w]); fb_pixel(fb, i+x, y+3*n+j,buf32[i+(j+3*n)*jpeg_size->w]); fb_pixel(fb, i+x, y+4*n+j,buf32[i+(j+4*n)*jpeg_size->w]); fb_pixel(fb, i+x, y+5*n+j,buf32[i+(j+5*n)*jpeg_size->w]); fb_pixel(fb, i+x, y+6*n+j,buf32[i+(j+6*n)*jpeg_size->w]); fb_pixel(fb, i+x, y+7*n+j,buf32[i+(j+7*n)*jpeg_size->w]); } usleep(1000); } free(buf); free(buf24); free(buf32); return 0; }
int display_screen(char *filename, fb_info old_inf,int k) { fb_info jpeg_inf; fb_info fb_inf; int x = 0; int y = 0; fb_inf.h = (int)(old_inf.h/1.46); fb_inf.w = (int)(old_inf.w/1.46); u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *bufs32 = rgb24to32(scale_buf, fb_inf); int i, j; if(k == 10) { x = (int)(old_inf.w/4.76); y = (int)(old_inf.h/15.36); for (j = 0; j < fb_inf.w; ++j){ for(i = 0; i < fb_inf.h; ++i){ fb_pixel(old_inf, x+j, y+i, bufs32[j + i * fb_inf.w]); } } } if(k != 10) { x = (int)(old_inf.w/4.76 + fb_inf.w/3*(k%3)); y = (int)(old_inf.h/15.36 + fb_inf.h/3*(k/3)); for (j = 0; j < fb_inf.w/3; ++j){ for(i = 0; i < fb_inf.h/3; ++i){ //fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); fb_pixel(old_inf, x+j, y+i, bufs32[3*j + 3*i * fb_inf.w]); } } } free(buf24); free(scale_buf); free(bufs32); return 0; }
int display_xie1(const char *filename, fb_info fb_inf) { fb_info jpeg_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); int i, j, n, m; for(i=0, j=0; i<= fb_inf.h || j<= fb_inf.w; i= i + 6, j = j + 8) { for(n=0; n<i; n++) for(m=0; m<j; m++) { if(*status_p == 0) goto biao2; fb_pixel(fb_inf, m, n, buf32[fb_inf.w * (fb_inf.h -i + n) + fb_inf.w - j + m]); } } biao2: free(buf24); free(scale_buf); free(buf32); return 0; }
int turn(char *filename, fb_info fb_inf) { fb_info jpeg_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); int i, j, w, h, m, n; n = 1024; m = 1024*5/7; while(n > 0) { for(j = 0; j < fb_inf.h; j++ ) for(i = 0; i < fb_inf.w; i++) { w = i*n/1024; h = j*m/768; fb_pixel(fb_inf, i, j, buf32[h*fb_inf.w + w]); } n += 7; m += 5; usleep(10000); } free(buf24); free(scale_buf); free(buf32); return 0; }
int disp_expand(char *filename, fb_info fb_inf) { fb_info jpeg_inf; int i, j, k, l; buf24 = decode_jpeg(filename, &jpeg_inf); scale_buf = scale24(buf24, fb_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, fb_inf); for(l = 1; l <= 16; l++) { for(k = 0;k < fb_inf.w / 32 * fb_inf.h / 32; k++) { for(i = k / (fb_inf.w / 32) * 32 + 16 - l; i < k / (fb_inf.w / 32) * 32 + 16 + l; ++i) { for (j = k % (fb_inf.w / 32) * 32 + 16 - l; j < k % (fb_inf.w / 32) * 32 + 16 + l; ++j) { fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); } } } if(msg[0] == 2) return 1; usleep(100000); } free(buf24); free(scale_buf); free(buf32); return 0; }
int fly_left_right(char *filename, fb_info fb_inf) { fb_info jpeg_inf; buf24 = decode_jpeg(filename, &jpeg_inf); scale_buf = scale24(buf24, fb_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, fb_inf); //float gama = fb_inf.w / fb_inf.h; int i, j, k; for(k = 0; k < fb_inf.w; k+=10) { for(i = 0; i < fb_inf.h; ++i) { for (j = fb_inf.w - k; j < fb_inf.w; ++j) { fb_pixel(fb_inf, j + k - fb_inf.w, i, buf32[j + i * fb_inf.w]); } } if(msg[0] == 2) return 1; } free(buf24); free(scale_buf); free(buf32); return 0; }
/* display jpeg mosaic*/ int display_jpeg_mosaic(const const char *jpegname, fb_info fb_inf, int size) { fb_info jpeg_inf; int xres; int yres; u8_t *buf24 = decode_jpeg(jpegname, &jpeg_inf); u8_t *scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); for (;size > 1; size--) { for (yres = 0; yres < fb_inf.h; yres++) { for (xres = 0; xres < fb_inf.w; xres++) { fb_pixel(fb_inf, xres, yres, buf32[(xres / size) * size + size / 2 + (((yres / size) * size + size / 2) * fb_inf.w)]); } } usleep(300000); } free(buf24); free(scale_buf); free(buf32); return 0; }
/* display jpeg blind x */ int display_jpeg_blind_x(const char *jpegname, fb_info fb_inf) { fb_info jpeg_inf; int xres; int yres; int xloop; u8_t *buf24 = decode_jpeg(jpegname, &jpeg_inf); u8_t *scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); for(xloop = 0; xloop < fb_inf.w / 5; xloop++) { for (xres = xloop; xres < fb_inf.w; xres += fb_inf.w / 5) { for(yres = 0; yres < fb_inf.h; yres++) { fb_pixel(fb_inf, xres, yres, buf32[xres + (yres * fb_inf.w)]); } } usleep(1); } free(buf24); free(scale_buf); free(buf32); return 0; }
int display1(info_t*fb,int x,int y,info_t *jpeg_size, char*filename) { info_t jpeg; u8_t *buf = decode_jpeg(filename,&jpeg); u8_t *buf24 = scale24(buf,jpeg_size,&jpeg); u32_t *buf32 = rgb24to32(buf24,jpeg_size); int i,j,t; for(t=680;t>0;t--) { for(j=0;j<jpeg_size->h;j++) { for(i=0;i<jpeg_size->w;i++) { if((i-jpeg_size->w/2)*(i-jpeg_size->w/2)+(j-jpeg_size->h/2)*(j-jpeg_size->h/2)>=t*t) {fb_pixel(fb,i+x,j+y,buf32[i+j*jpeg_size->w]);} } } usleep(100); } free(buf); free(buf24); free(buf32); return 0; }
/* display jpeg right */ int display_jpeg_right(const char *jpegname, fb_info fb_inf) { fb_info jpeg_inf; int xres; int yres; int xloop; u8_t *buf24 = decode_jpeg(jpegname, &jpeg_inf); u8_t *scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); for (xloop = 0; xloop < fb_inf.w; xloop++) { for (xres = 0; xres <= xloop; xres++) { for (yres = 0; yres < fb_inf.h; yres++) { fb_pixel(fb_inf, xres, yres, buf32[fb_inf.w - 1 - xloop + xres + yres * fb_inf.w]); // fb_pixel(fb_inf, xres, fb_inf.h - 1 - yloop + yres, buf32[xres + ((fb_inf.h / 2 + yres) * fb_inf.w)]); } } } free(buf24); free(scale_buf); free(buf32); return 0; }
int display_muspic(char *filename, fb_info old_inf) { fb_info jpeg_inf; fb_info fb_inf; int x = 0; int y = 0; fb_inf.h = (int)(old_inf.h/2.5); fb_inf.w = (int)(old_inf.w/5); u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *bufs32 = rgb24to32(scale_buf, fb_inf); int i, j; x = (int)(old_inf.w/7*5); y = (int)(old_inf.h/10*1); for (j = 0; j < fb_inf.w; ++j){ for(i = 0; i < fb_inf.h; ++i){ //fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); fb_pixel(old_inf, x+j, y+i, bufs32[j + i * fb_inf.w]); } } free(buf24); free(scale_buf); free(bufs32); return 0; }
int display_part(char *filename,int x, int y, fb_info fb_inf) { fb_info jpeg_inf; fb_info new_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); new_inf.w = jpeg_inf.w*fb_inf.w/1024; new_inf.h = jpeg_inf.h*fb_inf.h/768; u8_t * scale_buf = scale24(buf24, new_inf, jpeg_inf); u32_t *bufe32 = rgb24to32(scale_buf, new_inf); int i, j; for (j = 0; j < new_inf.w; ++j){ for(i = 0; i < new_inf.h; ++i){ if(bufe32[j + i*new_inf.w] > 0x020000) fb_pixel(fb_inf, x+j, y+i, bufe32[j + i * new_inf.w]); } } free(scale_buf); free(buf24); free(bufe32); return 0; }
void fb_hline(unsigned short *fbmem,int w, int x1,int y,int x2,int color) { int i; for (i = x1; i < x2; i++) fb_pixel(fbmem,w,i,y,color); }
int push(char *filename, fb_info fb_inf) { fb_info jpeg_inf; fb_info scale_inf; int i, j, k; scale_inf = fb_inf; buf24 = decode_jpeg(filename, &jpeg_inf); for(k = 95; k >= 0; k--) { scale_inf.w = fb_inf.w - (fb_inf.w / 100) * k; scale_inf.h = fb_inf.h - (fb_inf.h / 100) * k; scale_buf = scale24(buf24, scale_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, scale_inf); for(i = 0; i < scale_inf.h; ++i) { for (j = 0; j < scale_inf.w; ++j) { fb_pixel(fb_inf, j + (fb_inf.w - scale_inf.w) / 2, i + (fb_inf.h - scale_inf.h) / 2, buf32[j + i * scale_inf.w]); } } if(msg[0] == 2) return 1; free(scale_buf); free(buf32); usleep(10000); } free(buf24); return 0; }
int display_jpeg(char *filename, fb_info fb_inf) { fb_info jpeg_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, fb_inf); int i, j; for (j = 0; j < fb_inf.w; ++j){ for(i = 0; i < fb_inf.h; ++i){ fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); } } //for (j = 0; j < jpeg_inf.w/2; ++j){ //for(i = 0; i < jpeg_inf.h/2; ++i){ ////fb_pixel(fb_inf, j, i, buf32[j + i * fb_inf.w]); //fb_pixel(fb_inf, j, i, buf32[2*j + 2*i * fb_inf.w]); //} //usleep(2000); //} free(buf24); free(scale_buf); free(buf32); return 0; }
int mosaic(char *filename, fb_info fb_inf) { fb_info jpeg_inf; int i, j, k; buf24 = decode_jpeg(filename, &jpeg_inf); scale_buf = scale24(buf24, fb_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, fb_inf); for(k = 32; k > 1; k-=2) { for(i = 0; i < fb_inf.h; ++i) { for (j = 0; j < fb_inf.w; ++j) { fb_pixel(fb_inf, j, i, buf32[j + (i / k) * k * fb_inf.w]); } } if(msg[0] == 2) return 1; usleep(40000 - 1000 * k); } free(buf24); free(scale_buf); free(buf32); return 0; }
int shutter(char *filename, fb_info fb_inf) { fb_info jpeg_inf; int i, j, k; buf24 = decode_jpeg(filename, &jpeg_inf); scale_buf = scale24(buf24, fb_inf, jpeg_inf); buf32 = rgb24to32(scale_buf, fb_inf); for(i = 0; i < fb_inf.h / 20; ++i) { for(k = 0; k < 20; k++) { for (j = 0; j < fb_inf.w; ++j) { fb_pixel(fb_inf, j, i+ fb_inf.h / 20 * k, buf32[j + (i + fb_inf.h / 20 * k) * fb_inf.w]); } } if(msg[0] == 2) return 1; usleep(10000); } free(buf24); free(scale_buf); free(buf32); return 0; }
void fb_vline(unsigned short *fbmem,int w, int x,int y1,int y2,int color) { int i; for (i = y1; i < y2; i++) fb_pixel(fbmem,w,x,i,color); }
int show(char *filename, fb_info fb_inf) { fb_info jpeg_inf; u8_t *buf24 = decode_jpeg(filename, &jpeg_inf); u8_t * scale_buf = scale24(buf24, fb_inf, jpeg_inf); u32_t *buf32 = rgb24to32(scale_buf, fb_inf); int i, j, x, y, r; r = 0; x = fb_inf.w/2; y = fb_inf.h/2; while(r < 700) { for(j = 0; j < fb_inf.h; j++) for(i = 0; i < fb_inf.w; i++) if((x - i)*(x - i) + (y - j)*(y - j) <= r*r) fb_pixel(fb_inf, i, j, buf32[i + j * fb_inf.w]); r++; // usleep(100); } free(buf24); free(scale_buf); free(buf32); return 0; }