Home > Software engineering >  [artwork is 8 bits BMP, use Cimage saved into a 32-bit, picture is too big! How to preserve into 8 b
[artwork is 8 bits BMP, use Cimage saved into a 32-bit, picture is too big! How to preserve into 8 b

Time:09-26

I have dozens of 8 bitmap in a memory DC spell became a larger image, use Cimage saved into a 32 bit, the volume is too big! GDI has no function in the original position deeply? Consult how to save to eight and no distortion?? What is the simplest way??

CodePudding user response:

Color Functions provides
The following functions provides are 2 with color.



AnimatePalette
CreateHalftonePalette
CreatePalette
GetColorAdjustment
GetNearestColor
GetNearestPaletteIndex
GetPaletteEntries
GetSystemPaletteEntries
GetSystemPaletteUse
HTUI_ColorAdjustment
HTUI_DeviceColorAdjustment
RealizePalette
ResizePalette
SelectPalette
SetColorAdjustment
SetPaletteEntries
SetSystemPaletteUse
UnrealizeObject
UpdateColors



CodePudding user response:

reference 1st floor zhao4zhong1 response:
Color Functions provides
The following functions provides are 2 with color.



AnimatePalette
CreateHalftonePalette
CreatePalette
GetColorAdjustment
GetNearestColor
GetNearestPaletteIndex
GetPaletteEntries
GetSystemPaletteEntries
GetSystemPaletteUse
HTUI_ColorAdjustment
HTUI_DeviceColorAdjustment
RealizePalette
ResizePalette
SelectPalette
SetColorAdjustment
SetPaletteEntries
SetSystemPaletteUse
UnrealizeObject
UpdateColors




I wanted to send a figure according to the original eight nondestructive output, so trouble?

CodePudding user response:

May, joining together, when is the 32-bit,
Spell a look first,

CodePudding user response:

reference schlafenhamster reply: 3/f
when possible, splicing, is the 32-bit,
Spell a look first,


if we can save into eight, I am not going to ask

CodePudding user response:

Use, BMP file, splicing, impossible, variable 32-bit
You are using the CDC patchwork?

CodePudding user response:

Give a direct file processing,
 
Void CPartialBitmapView: : MergePartialBmp (char * MergeFile, char * MergedFile)
{
//1 st get MergedFile 's bits.
The FILE * bmpDst=0;
BmpDst=fopen (MergedFile, "rb");
if(! BmpDst)
{
AfxMessageBox (" MergedFile Lost!" );
CreateEmptyMergedFile (MergedFile);
}
//reopen
BmpDst=fopen (MergedFile, "rb");
Fseek (bmpDst, 0 l, SEEK_END);
LONG filelenDst=ftell (bmpDst);
Fseek (bmpDst, 0 l, SEEK_SET);
BYTE * bufferDst=new BYTE [filelenDst];
Fread (bufferDst, sizeof (char), filelenDst, bmpDst);
The fclose (bmpDst);
//
LPBITMAPFILEHEADER pBMPfileDst=(LPBITMAPFILEHEADER bufferDst);
LPBITMAPINFOHEADER pBMPinfoDst=(LPBITMAPINFOHEADER) (bufferDst + sizeof (BITMAPFILEHEADER));
Int colord=0;//
If (pBMPinfoDst - & gt; BiBitCount==8)
{
Colord=256;
}
//width height and bits
WORD widDst=(WORD) pBMPinfoDst - & gt; BiWidth;//640
WORD heiDst=(WORD) pBMPinfoDst - & gt; BiHeight;//480
BYTE * bitsDstAt=bufferDst + sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + colord * sizeof (RGBQUAD);//=4;
RGBQUAD * rgbDst=(RGBQUAD *) (bufferDst + sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER));
////2 nd get MergeFile 's bits.///////////////////////////////////////////////
The FILE * bmpSrc=https://bbs.csdn.net/topics/0;
bmpSrc=https://bbs.csdn.net/topics/fopen (MergeFile, "rb");
if(! BmpSrc)
{//check "TMP. BMP
"AfxMessageBox (" No Source file!" );
SavePartialBmp (m_Tracker. M_rect. Left, m_Tracker. M_rect. Top, m_Tracker. M_rect. Right,
M_Tracker. M_rect. Bottom);
}
//reopen
bmpSrc=https://bbs.csdn.net/topics/fopen (MergeFile, "rb");
Fseek (bmpSrc, 0 l, SEEK_END);
LONG filelenSrc=https://bbs.csdn.net/topics/ftell (bmpSrc);//17462
Fseek (bmpSrc, 0 l, SEEK_SET);
BYTE * bufferSrc=https://bbs.csdn.net/topics/new BYTE [filelenSrc];
Fread (bufferSrc, sizeof (char), filelenSrc, bmpSrc);
The fclose (bmpSrc);
LPBITMAPFILEHEADER pBMPfileSrc=https://bbs.csdn.net/topics/(LPBITMAPFILEHEADER) bufferSrc;
LPBITMAPINFOHEADER pBMPinfoSrc=https://bbs.csdn.net/topics/(LPBITMAPINFOHEADER) (bufferSrc + sizeof (BITMAPFILEHEADER));
//merging pos
Int Xstart=pBMPfileSrc - & gt; BfReserved1;
Int Ystart=pBMPfileSrc - & gt; BfReserved2;
//afxDump & lt; Int colors=0;//
If (pBMPinfoSrc - & gt; BiBitCount==8)
{
Colors=256;
}
WORD widSrc=https://bbs.csdn.net/topics/(WORD) pBMPinfoSrc -> biWidth;//128
WORD heiSrc=https://bbs.csdn.net/topics/(WORD) pBMPinfoSrc -> biHeight;//128
WORD Xend=Xstart + widSrc;
WORD Yend=Ystart + heiSrc;
//afxDump & lt; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related