باشه چشم این تصویر که گذاشتی می خوای به صورت تصویر چاپ بشه یا کارکتر اسکی اگه تصویر دوست داری چاپ بشه با بورلند میشه اینجور چاپش کرد تو ویژالم که دیگه آب خوردن با api های ویندوز:
#include <iostream.h>
#include <graphics.h>
#include <fstream.h>
#include <conio.h>
#include <stdlib.h>
#include <dos.h>
#include <stdio.h>
struct U{
unsigned char magic[2];
}mag;
struct master {
// word bftype;
unsigned long Size;
unsigned short Reserved;
unsigned short Reserved2;
unsigned long BitsOffset;
} HEADER;
class info {public:
unsigned long header_sz;
unsigned long width;
unsigned long height;
unsigned short nplanes;
unsigned short bitspp;
unsigned long compress_type;
unsigned long bmp_bytesz;
unsigned long hres;
unsigned long vres;
unsigned long ncolors;
// unsigned long nimpcolors;
} INFOHEADER;
huge DetectSvga()
{
return 2;
}
void Show(char* filename,int xcor,int ycor)
{
fstream File;
File.open(filename,ios::in);
char Ch;
File.read((char*)&mag,2);// read te 2 frist byte for know file
/*if (mag.magic!="BM"){
printf("file not a bitmap");
exit(0);
}*/
File.read((char*)&HEADER,12); //read for get offst bye of bitmap data
File.read((char*)&INFOHEADER,40); //read for width , heght and know 8 bit
unsigned int i;
File.seekg(HEADER.BitsOffset);
for(i=0;i<INFOHEADER.height;i++) //This for loop is used to display the bitmap.
{
for(int j=0;j<INFOHEADER.width;j++)
{
File.read(&Ch,1); // Here Ch reads the color of your bitmap.
putpixel(xcor+j,ycor+INFOHEADER.height-i,Ch);//write pixel to screen
}
}
File.close();
}
void main()
{
clrscr();
int gd = DETECT, md, a;
initgraph(&gd,&md,"..\\bgi");
installuserdriver("svga256",&DetectSvga);
char msg[15];
char* k;
cout<<"plz write adress of 8-bit bitmap format file: (example: c:/test.bmp)"<<endl;
cin>>k;
Show(k,100,100);
getch();
}
البته اینو من قدیما برای نوشتن فایل های بیتمپ 8 بیتی نوشته بودم
در ضمن میشه تبدیلشم کرد به کارکتر اسکی یک خطشو باید تغییر داد فقط فرمت jpg رو نمی دونم چطوری باید خوند که comppress شده ... میشه ها ولی یکم سخته خدا پدر مایکروسافت را بیامورزه با این api های خوب که سه سوته تصویرو نمایش میده