目前分類:Programming (17)

瀏覽方式: 標題列表 簡短摘要

從網路上找的...


Joh 發表在 痞客邦 留言(0) 人氣()

1. 在Create() 時的Style要加上 BS_OWNERDRAW

2. 在Class中加上 virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);

Joh 發表在 痞客邦 留言(0) 人氣()

#include <windows.h>

#pragma comment( lib, "gdiplus.lib" )
#include <gdiplus.h>

using namespace Gdiplus;

int GetEncoderClsid(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;
         free(pImageCodecInfo);
         return j;  // Success
      }   
   }

   free(pImageCodecInfo);
   return -1;  // Failure
}

void Filter( Bitmap* src, Bitmap* dst )
{
    int            w, h;
    w = src->GetWidth();
    h = src->GetHeight();

    for( int y=0; y<h; y++ ) {
        for( int x=0; x<w; x++ ) {
            Color c;
            c = src->GetPixel( x, y );

            // do something interesting here!
       
            dst->SetPixel( x, y, c );
        }
    }
}

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR sCmdLine, int nCmdShow )
{
    GdiplusStartupInput gdiplusStartupInput;
    ULONG_PTR gdiplusToken;
    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

    Bitmap*    pBitmapIn = new Bitmap( L"input.jpg" );

    Bitmap*    pBitmapOut = new Bitmap( pBitmapIn->GetWidth(), pBitmapIn->GetHeight(), PixelFormat32bppRGB );

    Filter( pBitmapIn, pBitmapOut );

    CLSID   encoderClsid;
    GetEncoderClsid(L"image/jpg", &encoderClsid);
    pBitmapOut->Save( L"output.jpg", &encoderClsid, 0 );

    GdiplusShutdown(gdiplusToken);
    return 0;
}

Joh 發表在 痞客邦 留言(0) 人氣()

 

LPPICTURE gpPicture;

Joh 發表在 痞客邦 留言(0) 人氣()

簡單小記一下

 

Joh 發表在 痞客邦 留言(0) 人氣()

1. 先要有 webbrowser2.cpp/.h 檔

 

Joh 發表在 痞客邦 留言(0) 人氣()

這篇也是寫給我自已看的...

 

Joh 發表在 痞客邦 留言(1) 人氣()

跟 c++ 比較不一樣 QQ"

或許是我對Java不了解 ~ 應該還有別的用法

Joh 發表在 痞客邦 留言(0) 人氣()

這也是寫給我自已看的 XDD

 

Joh 發表在 痞客邦 留言(0) 人氣()

Picture control 中顯示 bitmap 的用法 (寫給我自已看的...)

 

Joh 發表在 痞客邦 留言(1) 人氣()

如何在 MFC 中建立一個日曆

 

Joh 發表在 痞客邦 留言(0) 人氣()

取得 ComboBox中選擇項目的用法 (for myself)

 

Joh 發表在 痞客邦 留言(0) 人氣()

Parse 特定字元的懶人用法 (for myself)

 

Joh 發表在 痞客邦 留言(0) 人氣()

建立資料夾的懶人用法 (for myself)

 

Joh 發表在 痞客邦 留言(0) 人氣()

Thread 的懶人用法 (這是寫給我自已看的...)

 

Joh 發表在 痞客邦 留言(0) 人氣()

do-while要作多項參數判斷,跟if不一樣..

 

Joh 發表在 痞客邦 留言(0) 人氣()

沒想到...  switch 竟然沒 support point....

Programing 這麼久,都不曉得

Joh 發表在 痞客邦 留言(0) 人氣()