Click here to Skip to main content
15,880,392 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How i can Save Cimage file+ shapes & text on it? Pin
humais1-Jul-10 19:38
humais1-Jul-10 19:38 
GeneralRe: How i can Save Cimage file+ shapes & text on it? Pin
Alan Balkany6-Jul-10 3:23
Alan Balkany6-Jul-10 3:23 
QuestionDrawing on 8bpp grayscale bitmap (unmanaged) Pin
Alan Balkany29-Jun-10 4:52
Alan Balkany29-Jun-10 4:52 
AnswerRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Code-o-mat29-Jun-10 5:46
Code-o-mat29-Jun-10 5:46 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Alan Balkany29-Jun-10 5:53
Alan Balkany29-Jun-10 5:53 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Code-o-mat29-Jun-10 6:07
Code-o-mat29-Jun-10 6:07 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Alan Balkany29-Jun-10 8:21
Alan Balkany29-Jun-10 8:21 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Code-o-mat29-Jun-10 9:37
Code-o-mat29-Jun-10 9:37 
Am not sure where you are going wrong, i did a quick proggie to check and it produced a correct bitmap:
BITMAPINFO *bmi = (BITMAPINFO *)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
BITMAPINFOHEADER &bih(bmi->bmiHeader);

bih.biSize = sizeof (BITMAPINFOHEADER);
bih.biWidth         = 200;
bih.biHeight        = -200;
bih.biPlanes        = 1;
bih.biBitCount      = 8;
bih.biCompression   = BI_RGB;
bih.biSizeImage     = 0;
bih.biXPelsPerMeter = 14173;
bih.biYPelsPerMeter = 14173;
bih.biClrUsed       = 0;
bih.biClrImportant  = 0;

for (int I = 0; I < 255; I++)
{
  bmi->bmiColors[I].rgbBlue = bmi->bmiColors[I].rgbGreen = bmi->bmiColors[I].rgbRed = (BYTE)I;
  bmi->bmiColors[I].rgbReserved = 0;
}

void *Pixels;
HBITMAP hbmp = CreateDIBSection(NULL, bmi, DIB_RGB_COLORS, &Pixels, NULL, 0);

//fill the bitmap so it wil display a gradient to check if the palette is correctly used...
BYTE *Pix = (BYTE *)Pixels;
for (int Y = 0; Y < abs(bih.biHeight); Y++)
  for (int X = 0; X < bih.biWidth; X++, Pix++)
    *Pix = (BYTE)Y;

free(bmi);

CImage Image;
Image.Attach(hbmp);
Image.Save(_T("r:\\test.bmp"), Gdiplus::ImageFormatBMP);

DeleteObject(hbmp);

> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Code-o-mat29-Jun-10 9:46
Code-o-mat29-Jun-10 9:46 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Alan Balkany29-Jun-10 9:47
Alan Balkany29-Jun-10 9:47 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Code-o-mat29-Jun-10 9:55
Code-o-mat29-Jun-10 9:55 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Alan Balkany1-Jul-10 4:50
Alan Balkany1-Jul-10 4:50 
GeneralRe: Drawing on 8bpp grayscale bitmap (unmanaged) Pin
Code-o-mat1-Jul-10 5:57
Code-o-mat1-Jul-10 5:57 
QuestionShaving a section from a dialog. Pin
Spawn@Melmac29-Jun-10 4:46
Spawn@Melmac29-Jun-10 4:46 
AnswerRe: Shaving a section from a dialog. Pin
Code-o-mat29-Jun-10 5:13
Code-o-mat29-Jun-10 5:13 
GeneralRe: Shaving a section from a dialog. Pin
David Crow29-Jun-10 5:32
David Crow29-Jun-10 5:32 
GeneralRe: Shaving a section from a dialog. Pin
Code-o-mat29-Jun-10 5:34
Code-o-mat29-Jun-10 5:34 
GeneralRe: Shaving a section from a dialog. Pin
Spawn@Melmac29-Jun-10 5:51
Spawn@Melmac29-Jun-10 5:51 
GeneralRe: Shaving a section from a dialog. Pin
Code-o-mat29-Jun-10 5:58
Code-o-mat29-Jun-10 5:58 
AnswerRe: Shaving a section from a dialog. Pin
David Crow29-Jun-10 5:37
David Crow29-Jun-10 5:37 
GeneralRe: Shaving a section from a dialog. Pin
Spawn@Melmac29-Jun-10 5:55
Spawn@Melmac29-Jun-10 5:55 
GeneralRe: Shaving a section from a dialog. Pin
David Crow29-Jun-10 6:11
David Crow29-Jun-10 6:11 
GeneralRe: Shaving a section from a dialog. Pin
Spawn@Melmac29-Jun-10 6:43
Spawn@Melmac29-Jun-10 6:43 
AnswerRe: Shaving a section from a dialog. Pin
Maximilien29-Jun-10 5:55
Maximilien29-Jun-10 5:55 
QuestionDateTime PIcker Control Pin
AbhiHcl29-Jun-10 4:43
AbhiHcl29-Jun-10 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.