Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

ucs

@ucs
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • A question about GDI+
    U ucs

    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; yiUnlockBits(&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); }

    C / C++ / MFC question winforms graphics

  • CSocket possible bug on win2k
    U ucs

    Hello I tested some apps like CHATSRVR/CHATTER (vc++ sample) under win98, winxp and win2k (with mfc70 and mfc71). on win2k CSocket::OnReceive() receives only 5 to 10 messages, then nothing will be captured. but if we build the same apps with vc++ 6.0 (mfc42), it will be ok. thank you.

    C / C++ / MFC help question

  • A question about GDI+
    U ucs

    Hi if you want to make a simple rotation (90, 180, 270 or flip), you can use : pBmp->RotateFlip(Rotate180FlipNone); // Rotate180FlipNone is an exemple if you want to rotate it, use this Bitmap* Rotate ( Bitmap* pSrcBmp, REAL rRot ) { int w = pSrcBmp->GetWidth(); int h = pSrcBmp->GetHeight(); Bitmap* pDstBmp = new Bitmap( (w+h)*2, (w+h)*2, PixelFormat32bppARGB ); // (w+h)*2 max width and height, you can optimize it(?) Graphics graphics(pDstBmp); graphics.Clear(Color(0,255,255,255)); Pen pen(Color(255, 255, 0, 0)); graphics.TranslateTransform((REAL)w+h, (REAL)w+h); graphics.RotateTransform(rRot); graphics.DrawImage(pSrcBmp, 0, 0); return pDestBmp; } save this image with { GetCodecClsid(L"image/tiff", &mClsid); // you can use L"image/jpeg", L"image/gif", ... pBmp->Save(L"img.tif", &mClsid); } int GetCodecClsid(const WCHAR* format, CLSID* pClsid) { UINT num = 0; // number of image encoders UINT size = 0; // size of the image encoder array in bytes ImageCodecInfo* pImageCodecInfo = NULL; GetImageEncodersSize(&num, &size); if(size == 0) return -1; // Failure pImageCodecInfo = (ImageCodecInfo*)(malloc(size)); if(pImageCodecInfo == NULL) return -1; // Failure GetImageEncoders(num, size, pImageCodecInfo); for(UINT j = 0; j < num; ++j) { if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 ) { *pClsid = pImageCodecInfo[j].Clsid; return j; // Success } } // for return -1; // Failure }

    C / C++ / MFC question winforms graphics

  • What is Callback Function?
    U ucs

    http://www.codeproject.com/cpp/callbacks.asp?target=callback|mfc

    C / C++ / MFC question tutorial

  • CSocket possible bug on win2k
    U ucs

    Hello CSocket of mfc70 and mfc71 works properly under Win98 and WinXP, but have a bug with CSocket::OnReceive() under Win2k. is there any solution ? thank you.

    C / C++ / MFC help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups