sahar15125
دوشنبه 27 اردیبهشت 1389, 09:56 صبح
لطفا هركس مي دونه چطور مي شه يك تصوير .gif يا .bmp  را در c يا c# پيمايش و نمايش بديم كدشو بذاره 
فقط سرييييييييع توروخدا :گریه::افسرده:
مصطفی ساتکی
دوشنبه 27 اردیبهشت 1389, 10:02 صبح
نمایش تو c با نمایش تو C# زمین تا آسمون فرق داره. نمایش بازم یه چیزی پیمایش کنه چه کاریی رو انجام بده
tdkhakpur
دوشنبه 27 اردیبهشت 1389, 11:20 صبح
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
#include <stdlib.h>
void showBmp(int x,int y,char *fname){
int   PalTable[16] =
 {0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63};
FILE    *fp;
unsigned char i,j,m,n,o , a[220];
unsigned int     t1,t2,xlen,ylen;
char Pal[16][3];
   if( (fp= fopen(fname,"rb"))== NULL)
  exit(0);
   rewind(fp);
   fseek(fp,18L,SEEK_SET);
   j=fgetc(fp);
   i=fgetc(fp);
   xlen=(j)+(i) *256;
   fseek(fp,22L,SEEK_SET);
   j=fgetc(fp);
   i=fgetc(fp);;
   ylen=(int)(j+i*256);
   if ((xlen % 8 )!= 0)  xlen=xlen+8-xlen  % 8 ;
   fseek(fp,54L,SEEK_SET);
   for (t1=0 ; t1<16;t1++)
   {
   m=fgetc(fp);
   n=fgetc(fp);
   o=fgetc(fp);
   i=fgetc(fp);
   Pal[t1][0]=m / 4;Pal[t1][1]=n / 4;
   Pal[t1][2]=o /4;
   }
   for (t1=0 ; t1<16;t1++)
    setrgbpalette(PalTable[t1], Pal[t1][2],Pal[t1][1],Pal[t1][0]);
   fseek(fp,118L,SEEK_SET);
   t2=y ;
  for(t2=0; t2<ylen; ++t2)
   {
      fread( a , 1 , 204 , fp );
      for (t1=0 ;t1< (xlen / 2);t1++)
      {
      m=inport(0x60) ;
      if(m==1)
       {
 fclose(fp) ;
 return ;
       }
    putpixel((x+2*t1)  ,y,  (a[t1] / 16) );
    putpixel((x+2*t1)+1,y,  (a[t1] % 16) );
      }
      y--;
   }
   fclose(fp) ;
}
//================================================== =======================
void main(void)
{
int gdriver = VGA, gmode = VGAHI, errorcode,ret,repeat,lens,nextx,nexty ,i;
struct palettetype pal;
    initgraph(&gdriver, &gmode, "g:\\borlandc\\bgi") ;
    showBmp(1,1,"pic.bmp") ;
    scanf("%c");
    closegraph() ;
}
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.