100分怎样用VC编写一个程序,能实现读取一个BMP图片,改变大小后,保存为新的BMP图片
100分求教:怎样用VC编写一个程序,能实现读取一个BMP图片,改变大小后,保存为新的BMP图片!
要求将352*288象素的BMP图片变成288*176的!
------解决方案--------------------
希望这个对你有帮助:
http://mti.xidian.edu.cn/multimedia/multi/course1-6-1.html
------解决方案--------------------
还有这个:
http://dev.yesky.com/164/2291664.shtml
------解决方案--------------------
核心函数:StretchBlt
剩下的步骤也不难,去找找资料吧,如果用gdi+就更简单了。
ps,如果用c#,估计10行左右的代码就可以完成。vc如果不用gdi+估计得100行。
------解决方案--------------------
基础类中已回答你问题了 还是说 如果外挂程序 用VB比较适合.
------解决方案--------------------
http://download.****.net/source/172443这里有代码下载的
------解决方案--------------------
接分...百度..
------解决方案--------------------
用vc吧,就是图象缩放的问题哈~~~
主要用StretchBlt函数~~
当然前面你得弄清如何打开个图象~~
------解决方案--------------------
StretchBlt
不行吗?
还是图象处理的算法??
------解决方案--------------------
/*************************************/
CShrink.h
/***************************************/
#if !defined(AFX_SHRINKER_H__9C214094_0019_4DF9_AC6E_9E22F34E70D6__INCLUDED_)
#define AFX_SHRINKER_H__9C214094_0019_4DF9_AC6E_9E22F34E70D6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Shrinker.h : header file
typedef struct {
WORD x,y; // dimensions
WORD l; // bytes per scan-line (32-bit allignment)
BYTE *b; // bits of bitmap,3 bytes/pixel, BGR
} tWorkBMP; // 24-bit working bitmap*/
typedef struct tagpels1{
BYTE bred;
BYTE bgreen;
BYTE bblue;
}pels3;
typedef struct tagpels2{
BYTE data1;
BYTE data2;
}pels2;
//#define SHRBPATH "./pic_temp/shrbmp.bmp "
#define Alloc(p,t) (t *)malloc((p)*sizeof(t))
#define For(i,n) for ((i)=0;(i) <(n);(i)++)
#define iFor(n) For (i,n)
#define jFor(n) For (j,n)
class CShrinker
{
public:
CShrinker();
~CShrinker();
private:
WORD shrwith; //缩放宽
WORD shrhith; //缩放长
BITMAPFILEHEADER bf; //BMP 文件头
BITMAPINFOHEADER bmpHeader;//BMP 信息头
public:
// Operation
// HBITMAP CreateEmptyBitmap (WORD dx,WORD dy);
void SaveWorkingBitmap (tWorkBMP *w,HBITMAP b);
void ShrinkWorkingBitmap (tWorkBMP *a,tWorkBMP *b,WORD bx,WORD by);
void CreateBitmap (WORD dx,WORD dy,tWorkBMP *w);
//void SetBMIHeader (BITMAPINFO *b,short dx,short dy);
BOOL ShrinkPath(char *srcpath, char *destpath,WORD pwith,WORD phith,BYTE *content);
void CreateWorkingBitmap (WORD dx,WORD dy,tWorkBMP *w);
BOOL SaveOutFile(char *BmpFileName1,tWorkBMP *out);
//CString FindExtension(const CString& name);
//int FindFormat(const CString& ext);
public:
};
#endif
/***************************************
CShrink.cpp
/****************************************/
// Shrinker.cpp : implementation file
//
#include "stdafx.h "
#include "Shrinker.h "
CShrinker::CShrinker()
{
shrwith=128;
shrhith=128;
}
要求将352*288象素的BMP图片变成288*176的!
------解决方案--------------------
希望这个对你有帮助:
http://mti.xidian.edu.cn/multimedia/multi/course1-6-1.html
------解决方案--------------------
还有这个:
http://dev.yesky.com/164/2291664.shtml
------解决方案--------------------
核心函数:StretchBlt
剩下的步骤也不难,去找找资料吧,如果用gdi+就更简单了。
ps,如果用c#,估计10行左右的代码就可以完成。vc如果不用gdi+估计得100行。
------解决方案--------------------
基础类中已回答你问题了 还是说 如果外挂程序 用VB比较适合.
------解决方案--------------------
http://download.****.net/source/172443这里有代码下载的
------解决方案--------------------
接分...百度..
------解决方案--------------------
用vc吧,就是图象缩放的问题哈~~~
主要用StretchBlt函数~~
当然前面你得弄清如何打开个图象~~
------解决方案--------------------
StretchBlt
不行吗?
还是图象处理的算法??
------解决方案--------------------
/*************************************/
CShrink.h
/***************************************/
#if !defined(AFX_SHRINKER_H__9C214094_0019_4DF9_AC6E_9E22F34E70D6__INCLUDED_)
#define AFX_SHRINKER_H__9C214094_0019_4DF9_AC6E_9E22F34E70D6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Shrinker.h : header file
typedef struct {
WORD x,y; // dimensions
WORD l; // bytes per scan-line (32-bit allignment)
BYTE *b; // bits of bitmap,3 bytes/pixel, BGR
} tWorkBMP; // 24-bit working bitmap*/
typedef struct tagpels1{
BYTE bred;
BYTE bgreen;
BYTE bblue;
}pels3;
typedef struct tagpels2{
BYTE data1;
BYTE data2;
}pels2;
//#define SHRBPATH "./pic_temp/shrbmp.bmp "
#define Alloc(p,t) (t *)malloc((p)*sizeof(t))
#define For(i,n) for ((i)=0;(i) <(n);(i)++)
#define iFor(n) For (i,n)
#define jFor(n) For (j,n)
class CShrinker
{
public:
CShrinker();
~CShrinker();
private:
WORD shrwith; //缩放宽
WORD shrhith; //缩放长
BITMAPFILEHEADER bf; //BMP 文件头
BITMAPINFOHEADER bmpHeader;//BMP 信息头
public:
// Operation
// HBITMAP CreateEmptyBitmap (WORD dx,WORD dy);
void SaveWorkingBitmap (tWorkBMP *w,HBITMAP b);
void ShrinkWorkingBitmap (tWorkBMP *a,tWorkBMP *b,WORD bx,WORD by);
void CreateBitmap (WORD dx,WORD dy,tWorkBMP *w);
//void SetBMIHeader (BITMAPINFO *b,short dx,short dy);
BOOL ShrinkPath(char *srcpath, char *destpath,WORD pwith,WORD phith,BYTE *content);
void CreateWorkingBitmap (WORD dx,WORD dy,tWorkBMP *w);
BOOL SaveOutFile(char *BmpFileName1,tWorkBMP *out);
//CString FindExtension(const CString& name);
//int FindFormat(const CString& ext);
public:
};
#endif
/***************************************
CShrink.cpp
/****************************************/
// Shrinker.cpp : implementation file
//
#include "stdafx.h "
#include "Shrinker.h "
CShrinker::CShrinker()
{
shrwith=128;
shrhith=128;
}