📄 mga_mtv.c
字号:
/* (c) HelDoRe Mtv unit ... v0.0.3 Supported formats :*/ #define VERMTV " unit v0.0.3"#include <stdio.h>#include "../mga_view.h"void help_mtv(){printf("MTV%s\n + 24 bpp\n",VERMTV);}int detect_mtv(){ int buff[100]; int ii,xx; ii=0; image_x=0; image_y=0; tempi=0; while ((ii !=(int)' ') && (ftell(plik)<20)){ ii=fgetc(plik); buff[tempi]=(char)ii; tempi++; } tempi--; buff[tempi]=(char)0; xx=1; for (ii=tempi;ii>0;ii--) {image_x+=((int)buff[ii-1]-48)*xx; xx=xx*10; } tempi=0; while ((ii !=10) && (ftell(plik)<20)){ ii=fgetc(plik); buff[tempi]=(char)ii; tempi++; } tempi--; buff[tempi]=(char)0; xx=1; for (ii=tempi;ii>0;ii--) {image_y+=((int)buff[ii-1]-48)*xx; xx=xx*10; } depth=24; xx=ftell(plik)+2; fseek(plik,0,SEEK_END); ii=ftell(plik); fseek(plik,-ii+xx,SEEK_CUR); xx--; if ((ii-xx) !=image_x*image_y*(depth/8)) return 1; if (check_image(image_x,image_y,depth)==3) return 3; printf("MTV ray tracer %s\n",VERMTV); printf("MTV detected : %ix%ix%i\n",image_x,image_y,depth); for (y=0;y<image_y;y++) { for (x=0;x<image_x;x++) { tabg[x+y*image_x]=fgetc(plik); tabb[x+y*image_x]=fgetc(plik); tabr[x+y*image_x]=fgetc(plik); } } return 0; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -