Click here to Skip to main content
15,908,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
Posted
Updated 31-Aug-16 20:14pm
Comments
enhzflep 31-Aug-16 16:59pm    
What are you actually trying to achieve? What advantage do you hope to gain by performing a standard action in an entirely unconventional manner?
FISH786 31-Aug-16 21:26pm    
Instead of saving it as a bitmap, I was hoping to save it in the registry.
This way, I don't have to worry about the bitmaps.
Philippe Mori 31-Aug-16 20:30pm    
How can you save an image as text?
25x25 is very small so a bitmap should not be a problem.
FISH786 31-Aug-16 21:29pm    
I am sorry, when I said plain text should have said as colorref from the pixels.

1 solution

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.

C++
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();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900