将HDC写入FILE而不是位图。 [英] Write HDC to FILE and not bitmap.

查看:71
本文介绍了将HDC写入FILE而不是位图。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我在HDC中有一个对象。

我已经能够循环并获得COLORREF。

而不是将其保存为位图或纯文本,我还有其他选择吗?

大小约为25 x 25.



任何人都可以提出建议,如果可能的话,更愿意写信给注册表。



提前感谢您的帮助。



我的尝试:



我已经能够将它保存为位图和纯文本。

纯文本文件太大。

解决方案

通常编写位图是最佳解决方案,因为其他程序可以轻松处理这些数据。



您还可以在文件中写入每个COLORREF。 COLORREF是一个4字节大小的DWORD。



 CFile cfile; 
cfile.Open(_T( picture.dat),CFile :: modeCreate |的CFile :: modeReadWrite);
// 循环浏览所有数据
// 将每个值写为二进制文件
cfile.Write(& colorref,的sizeof (COLORREF));
// end loop
cfile.Flush();


Hello,

I have an object in HDC.
I have been able to loop through and get the COLORREF.
Instead of saving it as a bitmap or plain text, what other options do I have?
The size is about 25 x 25.

Can anyone please suggest something, would prefer to write to the registry if possible.

Thank you in advance for any help.

What I have tried:

I have been able to save it as a bitmap and plain text.
Plain text file is too large.

解决方案

Normally is writing as a bitmap the best solution, because other programs can easily work with that data.

You can also write every COLORREF in a file. A COLORREF is a DWORD with 4 byte size.

CFile cfile;
cfile.Open(_T("picture.dat"), CFile::modeCreate |  CFile::modeReadWrite);
//do you loop through all data
  //write every value as binary
  cfile.Write(&colorref, sizeof(COLORREF));
//end loop 
cfile.Flush();


这篇关于将HDC写入FILE而不是位图。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆