Step 1: save your image in a stream with the function below: Image::Save(IStream*, CLSID*, EncoderParameters*) Step 2: read some bytes from the stream with the function below: ISequentialStream::Read(void* pv, ULONG cb, ULONG* pcbRead)Now you have got the binery date in the buffer pv.As the same, you can use the function below to write some bytes to a stream: ISequentialStream::Read( void const* pv, ULONG cb, ULONG* pcbWritten)So, that is it. Help yourself.
Excuse me, the last function I mean this: ISequentialStream::Write( void const* pv, ULONG cb, ULONG* pcbWritten)
img 为内存中的对像。只要能保存为二进制就行。。
不能把它存为文件再转二进制,我想直接通过什么操作。。就可以达那种到目的的。。呵呵
Image::Save(IStream*, CLSID*, EncoderParameters*) Step 2: read some bytes from the stream with the function below:
ISequentialStream::Read(void* pv, ULONG cb, ULONG* pcbRead)Now you have got the binery date in the buffer pv.As the same, you can use the function below to write some bytes to a stream:
ISequentialStream::Read( void const* pv, ULONG cb, ULONG* pcbWritten)So, that is it. Help yourself.
ISequentialStream::Write( void const* pv, ULONG cb, ULONG* pcbWritten)
Bitmap img(L"pathname"));
COleStreamFile img_stream ;
img_stream.CreateMemoryStream(NULL); //存在这里可不可以??
img.Save(img_stream.GetStream(), Gdiplus::ImageFormatBMP);//是不是这样然后对image_stream文件操作存入数据库中?但编译通不过?
接下去怎么写。分可以再加。。
OleLoadPicture
CBitmap Bitmap;
Bitmap.LoadBitmap (IDB_BITMAP1);
BYTE BmpData[200][26];
for(int i=0;i<200;i++)
for(int j=0;j<25;j++)
if(i%10<5)
BmpData[i][j]=0xFF;
else
BmpData[i][j]=0x00;
Bitmap.SetBitmapBits (200*26,BmpData);