Click here to Skip to main content
15,921,841 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why don't run the same programe code on vc++ compiler Pin
sunjohn3-Jun-03 20:23
sunjohn3-Jun-03 20:23 
GeneralRe: Why don't run the same programe code on vc++ compiler Pin
Christian Graus3-Jun-03 20:25
protectorChristian Graus3-Jun-03 20:25 
GeneralRe: Why don't run the same programe code on vc++ compiler Pin
sunjohn3-Jun-03 20:51
sunjohn3-Jun-03 20:51 
GeneralA question about GDI+ Pin
Anonymous3-Jun-03 13:53
Anonymous3-Jun-03 13:53 
GeneralRe: A question about GDI+ Pin
ucs3-Jun-03 23:56
ucs3-Jun-03 23:56 
GeneralRe: A question about GDI+ Pin
Anonymous4-Jun-03 4:22
Anonymous4-Jun-03 4:22 
GeneralOne more question Pin
Anonymous4-Jun-03 6:02
Anonymous4-Jun-03 6:02 
GeneralRe: One more question Pin
ucs4-Jun-03 12:46
ucs4-Jun-03 12:46 
you can use this code (with some -fast- asm)

{
Bitmap* pDstBmp = Convert_Bmp32_Bmp8( pSrcBmp );
}


Bitmap* CMdiPrjDoc::Convert_Bmp32_Bmp8( Bitmap *mBmpSrc )
{
int x = mBmpSrc->GetWidth();
int y = mBmpSrc->GetHeight();

Bitmap* mBmpDest = new Bitmap(
x,
y,
PixelFormat8bppIndexed );

SetPaletteGrayScale(mBmpDest);

BitmapData bitmapData, tBitmapData;
Rect rect(0, 0, x, y);
BYTE *pixels;
DWORD *tPixels;
mBmpDest->LockBits(
&rect,
ImageLockModeWrite,
PixelFormat8bppIndexed,
&bitmapData);
mBmpSrc->LockBits(
&rect,
ImageLockModeRead,
PixelFormat32bppARGB,
&tBitmapData);

pixels = (BYTE*)bitmapData.Scan0;
tPixels = (DWORD*)tBitmapData.Scan0;

DWORD rD;
int iLineJmp, iTLineJmp;
for(UINT yi=0; yi<y; yi++)
="" {
="" ilinejmp="yi" *="" bitmapdata.stride;
="" itlinejmp="(yi" tbitmapdata.stride)="" 4;
="" for(uint="" xi="0;" xi<x;="" xi++)
="" rd="tPixels[" +="" xi];
="" __asm
="" xor="" ebx,="" ebx;
="" mov="" eax,="" rd;
="" bl,="" al;
="" shr="" ax,="" 8;
="" add="" bx,="" ax;
="" 16;
="" and="" 00ffh;
="" rd,="" }
="" pixels[="" xi]="(BYTE)(rD/3);
" mbmpsrc-="">UnlockBits(&tBitmapData);
mBmpDest->UnlockBits(&bitmapData);

return mBmpDest;
}


void SetPaletteGrayScale(Bitmap* pBmp)
{
if(!pBmp) return;
ColorPalette* cp = (ColorPalette*)malloc(sizeof(ColorPalette)+256*4);
cp->Flags = PaletteFlagsGrayScale;
cp->Count = 256;
DWORD argb;
BYTE b;
for(int i=0; i<256; i++)
{
b = i;
_asm
{
mov ah, 255
mov al, b
shl eax, 16
mov ah, b
mov al, b
mov argb, eax
}
cp->Entries[i] = argb;
}
pBmp->SetPalette(cp);
free (cp);
}
GeneralRegistry HELP Pin
yoshi113-Jun-03 13:19
yoshi113-Jun-03 13:19 
GeneralRe: Registry HELP Pin
valikac3-Jun-03 13:27
valikac3-Jun-03 13:27 
GeneralRe: Registry HELP Pin
olinn3-Jun-03 17:14
olinn3-Jun-03 17:14 
GeneralTimer Pin
act_x3-Jun-03 12:35
act_x3-Jun-03 12:35 
GeneralRe: Timer Pin
valikac3-Jun-03 13:29
valikac3-Jun-03 13:29 
GeneralCSocket possible bug on win2k Pin
ucs3-Jun-03 12:32
ucs3-Jun-03 12:32 
GeneralRe: CSocket possible bug on win2k Pin
olinn3-Jun-03 17:30
olinn3-Jun-03 17:30 
GeneralRe: CSocket possible bug on win2k Pin
ucs3-Jun-03 23:57
ucs3-Jun-03 23:57 
GeneralRe: CSocket possible bug on win2k Pin
olinn4-Jun-03 0:59
olinn4-Jun-03 0:59 
GeneralEdit controls and fonts Pin
Steven M Hunt3-Jun-03 11:41
Steven M Hunt3-Jun-03 11:41 
GeneralRe: Edit controls and fonts Pin
Michael Pauli3-Jun-03 13:15
Michael Pauli3-Jun-03 13:15 
GeneralThanks! Pin
Steven M Hunt3-Jun-03 14:33
Steven M Hunt3-Jun-03 14:33 
GeneralTrouble reading from a file. Pin
rassad3-Jun-03 11:33
rassad3-Jun-03 11:33 
GeneralRe: Trouble reading from a file. Pin
Peter Weyzen3-Jun-03 11:44
Peter Weyzen3-Jun-03 11:44 
GeneralRe: Trouble reading from a file. Pin
Dean Goodman3-Jun-03 11:51
Dean Goodman3-Jun-03 11:51 
GeneralRe: Trouble reading from a file. Pin
Anonymous3-Jun-03 13:07
Anonymous3-Jun-03 13:07 
QuestionWhat is Callback Function? Pin
Anonymous3-Jun-03 10:43
Anonymous3-Jun-03 10: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.