tc 怎么插入图片?
自己去研究研究吧,我只能做到这了,只能显示16位图
#include "stdio.h"
#include "graphics.h"
#include "alloc.h"
#include "stdlib.h"
#include "math.h"
/*头部*/
typedef struct tagBITMAPFILEHEADER
{
unsigned int bfType;
unsigned long bfSize;
unsigned int bfReserved1;
unsigned int bfReserved2;
unsigned long bfOffBits;
}BITMAPFILEHEADER;
/*头部信息*/
typedef struct tagBITMAPINFOHEADER
{
unsigned long biSize;
long biWidth;
long biHeight;
unsigned int biPanes;
unsigned int biBitCount;
unsigned long biCompression;
unsigned long biSizeImage;
long biXPelsPerMeter;
long biYPelsPerMeter;
unsigned long biClrUsed;
unsigned long biClrImportant;
}BITMAPINFOHEADER;
/*颜色*/
typedef struct tagRGBQUAD
{
unsigned char rgbBlue;
unsigned char rgbGreen;
unsigned char rgbRed;
unsigned char rgbReserved;
}RGBQUAD;
/*头部组成*/
typedef struct tagBITMAPINFO
{
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[];
}BITMAPINFO;
int xmax;
int ymax;
void InitGraph()/*图形系统初始化*/
{
int mod=EGA;
int dr=EGAHI;
initgraph(&mod,&dr,"");
xmax=getmaxx();
ymax=getmaxy();
}
void CloseGraph()/*关闭图形系统*/
{
closegraph();
}
void Exit(char *ErrorCode)
{
printf("%s",ErrorCode);
getch();
exit(0);
}
long WidthBytes(long Width,int BitCount) /*宽度(字节)*/
{
long WBytes;
WBytes=(Width*BitCount+31)/8;
WBytes=WBytes/4*4;
return WBytes;
}
unsigned char SetPalette(int Colors,unsigned char data)
{
switch(Colors)
{
case 16:
switch(data)
{
case 1:
return 4;
case 4:
return 1;
case 3:
return 6;
case 6:
return 3;
case 9:
return 12;
case 12:
return 9;
case 11:
return 14;
case 14:
return 11;
default:
return data;
}
case 2:
if(data==1)
return 15;
else
return 0;
}
}
void main()
{
long i,j;
long WBytes;
int Colors;
long Height,Width;
FILE *fp;
void *Temp=NULL;
BITMAPFILEHEADER bfh;
BITMAPINFOHEADER bih;
unsigned char Srcdata,data;
InitGraph();
if((fp=fopen("1.bmp","rb"))==NULL)
{
Exit("Can Not Open The File.\
");
}
fread(&bfh,sizeof(BITMAPFILEHEADER),1,fp);
if(bfh.bfType!='M'*256+'B')
{
Exit("This Is Not A Bmp File.\
");
}
fread(&bih,sizeof(BITMAPINFOHEADER),1,fp);
Height=bih.biHeight;
Width=bih.biWidth;
WBytes=WidthBytes(Width,bih.biBitCount);
Colors=1<<bih.biBitCount;
if(!(Colors==16||Colors==2))
{
Exit("This Programme Only For 16 Colors Bitmap.\
");
}
fread(Temp,sizeof(RGBQUAD),Colors,fp);
printf("%d %d",'\\f','\');
for(i=Height-1;i>=0;i--)
{
fseek(fp,54+Colors*sizeof(RGBQUAD)+i*WBytes,SEEK_SET);
for(j=0;j<Width;j++)
{
switch(Colors)
{
case 16:
if(j%2==0)
{
fread(&SrcData,1,1,fp);
data=SetPalette(Colors,SrcData/16);
putpixel(j,Height-1-i,data);
}
else
{
data=SetPalette(Colors,SrcData%16);
putpixel(j,Height-1-i,data);
}
break;
case 2:
if(j%8==0)
{
fread(&SrcData,1,1,fp);
data=SetPalette(Colors,(SrcData>>7)%2);
putpixel(j,Height-1-i,data);
}
else
{
data=SetPalette(Colors,(SrcData>>(7-j%8))%2);
putpixel(j,Height-1-i,data);
}
}
}
}
getch();
CloseGraph();
}
在图上点右键会出现“插入一张图片”
不知道你说的是不是这个
我曾经有过这种想法,后来发现要想这么做就得在TC里画图。那太恶心了……
你搜一下Tc图片文件吧,应该有。
崇斌强的: 可以,bgi,进入图形模式,就可以
沛县17557903653: TC如何载入BMP或jpg的图片,希望能给出代码~~~ - ?
崇斌强的: int write_jpeg(char *filename,unsigned char *buf,int quality,int width, int height, int gray) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; FILE *fp; int i; unsigned char *line; int line_length; if (NULL == (fp = fopen(filename,"w"))) { printf...
沛县17557903653: TC可以在界面上设置图片吗? - ?
崇斌强的: picture.setpicture("图片框0","D:\\test.bmp")
沛县17557903653: 高温线 炉温测试,无铅回流焊炉温测试仪,炉温测试仪怎样使用TC - 60K - ?
崇斌强的: 可连续测试256组温度曲线的温度测试仪!准确的炉温曲线测试,专业分析软件,为波峰焊及回流焊炉温曲线测试分析提供准确的工艺指标判定和优化.该温度测试仪广泛用于电子行业SMT贴装和插件PCB焊接工艺的温度考量,同时适用于其它...
沛县17557903653: c语言怎么添加图片或音乐?给个例子也可以的 - ?
崇斌强的: JPG是压缩格式,我不会,我只会BMP的, 之前刚好完成课程设计做了一份 #include "stdlib.h" #include "graphics.h" #include "stdio.h"#define WIDTH 120 #define HEIGHT 120 用一个二维数组保存的图片,这里图片长高必须是4的倍数...
沛县17557903653: WORD中如何用域编辑目录2003版 - ?
崇斌强的: 创建目录的方法,但有时我们需要目录中显示文档中的特殊段落、图例、图片等对象的标志信息,用前面几种方法就不行了.为解决此问题,Word专门准备了“目录项域”.用目录项域编制目录可按以下步骤进行: ...
沛县17557903653: C语言控制台程序(dos界面)如何实现改变运行时窗口出现的位置,在窗口里绘图.导入图片等. - ?
崇斌强的: 真的很想认真在windows平台上写程序,了解windows窗口与消息机制是必须的 win32 sdk编程去看看吧 easyx使用了win32 sdk编程,方便各位的使用
沛县17557903653: TC如何更改logo登陆图片? - ?
崇斌强的: 1.将.jar 文件中的图形替换为具有相同文件名的定制图形.• 闪屏窗口 要定制启动Teamcenter 时显示的闪屏窗口,则打开 com.teamcenter.rac.aifrcp_version.jar 文件,并将当前splash.bmp 文件替换为一个包含已定制闪屏窗口图形的新splash....
沛县17557903653: c语言中如何导入图片? - ?
崇斌强的: 如果要显示图片,关键是要了解这些存储格式的内容和含义, 用函数initgraphs(int Vmode)完成(也就是利用bios中的int 10中断来实现), 主要要把色表(color map)按BMP格式添好,就OK了!有关图象格式的内容要查相关内容, 其中还要涉及显卡内部的寄存器有关知识. 所以比较复杂
沛县17557903653: 标记目录项不按Alt+Shift+O 在哪里可以找到 - ?
崇斌强的: 我一般用Alt+Shift+O 这个是网上的1.将插入点置于所要标记对象的前面. 2.执行“插入”→“域”,打开“域”对话框,在左侧“域名”列表框中找到“TC”域并单击选择. 3.在“文字项”框中输入要显示在目录中的文字.对于段落、图片等...