㈠ 怎么用c语言读取gif图片内容文件
分类: 电脑/网络 >> 程序设计 >> 其他编程语言
问题描述:
怎么用C语言读取贺拆备gif图片内容文件 假如文件中有6个gif图片,只读取第一个图片;读完后写入一个空文件中
解析:
用二进制文件方法打开。
(1)读gif_id,输出gif_id, 6 bytes
(2)读logical_screen_descriptor(结构),并输出
(3)如果 ScrHd.flag_GC_table == 1,
则有全局色表,则读全局色表,并输出
(4)循环,
检查gif块的类御卖型,按块的类型读块,并输出
若:
case: 0x2c -- 它是,Image Descriptor(结构),读块并输出
判断有无色表,有则读块并输出,
下面 1 byte 表示 lZW min Code Size,读并输出
子块 (include size, bytes*size data) 读块并输出
子块 (include size, bytes*size data) 读块并输出
可能有很多子块,读块并输出
直到 0x00 读块并输出,
break;
若case: 0x21 0xf9 -- 控制块,读到 0x00, 并输出
break;
若case: 0x21 0xFe -- 注解块,读到 0x00,并输出
break;
若case: 0x21 0x01 -- 普通禅毁文本块,读到 0x00,并输出
break;
若case: 0x21 0xff -- 应用程序块,读到 0x00,并输出
break;
若case: 0x3B -- END 第一个图片完毕的标识,并输出
break;
default: 打印“文件错误”break;
(5)关闭文件。
㈡ C语言设计一个简单的图形动画,用turboc2运行,怎样编写使图形动起来的代码
1、首先,打开vc6.0,建立程序编写页面,建立C语言环境,声明两个整数型变量。
㈢ c语言中如何输出图像
lz需要弄清楚,你要输出什么格式的图像,bmp,JPG。。。不同格式的图像的数据内部结构是不一样的,弄清楚不同格式图片的数据结构组成,直接采用相应地算法,用C语言文件输出函数(fopen,fprintf……那几个函数,具体我也忘了怎么用了)将数据点写入文件就行了。
㈣ 用C语言编写程序,输出如下图形.要求:程序必须能够根据输入的层数动态输出相应的图形
#include<宴和stdio.h>
int main()
{int n,i,j;
printf("请输入层数:");
scanf("%d",&芦祥中n);
for(i=0;i<n;i++)
{for(j=0;j<n-i;j++)
printf(" ");
for(j=0;j<2*i+1;j++)
printf("%d ",2*i+1);
printf("陪山 ");
}
return 0;
}
㈤ C语言中如何输出图形
你可以采用循环的方法来做,需要输出A的位置的时候就输出A,其他地方就输出空格,就行了
#include<stdio.h>
voidmain()
{
inti,j,n;
printf("请输入要输出几行: ");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
for(j=0;j<n-i;j++)//每行前的空格控制
printf("");
for(intk=0;k<=2*i-1;k++)输出字母
{
if(k==0||k==2*i-2)输出A
printf("A");
else
printf("");
}
printf(" ");//换行
}
}
㈥ 如何用c语言以二进制流的方式读取并显示gif文件
二进制打开文谈枣件fopen(filename,"rd")
二进制读可以用 fscanf()
#include <启老stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
FILE * fp;
char * filename = "悄侍升test.dat";
int i;
char str[128];
if( (fp=fopen(filename,"rb"))== NULL )
{
㈦ 有人知道如何用C/C++/C#将.GIF格式的图片读取并且显示出来
c#picture可以直接显示gif
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace WindowsApplication1
{
/// <summary>
/// Form8 的摘要说明。
/// </summary>
public class animateImage : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
Bitmap animatedImage = new Bitmap("1.gif");
bool currentlyAnimating = false;
public animateImage()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在中差斗 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑卖磨器庆差修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
//
// Form8
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(536, 438);
this.Name = "Form8";
this.Text = "Form8";
this.Load += new System.EventHandler(this.Form8_Load);
}
#endregion
// [STAThread]
// static void Main()
// {
// Application.Run(new Form2());
// }
private void Form8_Load(object sender, System.EventArgs e)
{
//This method begins the animation.
}
public void AnimateImage()
{
if (!currentlyAnimating)
{
//Begin the animation only once.
ImageAnimator.Animate(animatedImage, new EventHandler(this.OnFrameChanged));
currentlyAnimating = true;
}
}
private void OnFrameChanged(object o, EventArgs e)
{
//Force a call to the Paint event handler.
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint,true);
this.SetStyle(ControlStyles.DoubleBuffer,true);
//Begin the animation.
AnimateImage();
//Get the next frame ready for rendering.
ImageAnimator.UpdateFrames();
//Draw the next frame in the animation.
e.Graphics.DrawImage(this.animatedImage, new Point(0, 0));
e.Graphics.DrawString("哈哈",new Font("Tahoma",12),new SolidBrush(Color.Red),10,10);
}
// public static void Main()
// {
// Application.Run(new animateImage());
// }
}
}
㈧ 用C语言编写的CGI如何输出图像文件
要制定输出厅姿的是图形,需要输出http数据的扮型绝头部指租锋示的。而不是默认的plant/text这样的
㈨ c语言如何输出图案
在C语言中要输出一个图案还是比较方便的,主要要看清楚它是由多少行组成的,然后外循环就循环多少次。在每一次的外循环中完成一行的输出,这时要看清楚他有没有几个空格,然后再输出指定的若干个字符。等到这一行输出完成以后就换行。