解説
エンボス処理。エッジ処理の変形とも取れる処理。処理方法はPlatform SDKのサンプルと 同じ。ソースコード中2箇所の「(pRGB->rgbtRed + pRGB->rgbtGreen) >> 1;」は簡易的なグレー スケール変換処理。本来ならばきちんと計算すべきだが計算量を減らすためにこのような処理 になっている。
実行例

ソースコード
GDI+を利用した画像処理テストのスケルトンの 画像処理部分を以下のように変更する。
////////////////////////////
//画像処理
//
UINT x;
UINT y;
RGBTRIPLE* pTmp;
Gdiplus::BitmapData bitmapData;
pImage->LockBits(&Gdiplus::Rect(0,0,pImage->GetWidth(),pImage->GetHeight())
,Gdiplus::ImageLockModeRead | Gdiplus::ImageLockModeWrite,PixelFormat24bppRGB,&bitmapData);
pTmp = (RGBTRIPLE*)bitmapData.Scan0;
RGBTRIPLE* pRGB;
UINT grey;
UINT grey2;
int temp;
//エンボス処理
pRGB = pTmp;
for(y = 0; y < pImage->GetHeight(); y++)
{
grey2 = (pRGB->rgbtRed + pRGB->rgbtGreen) >> 1;
pRGB->rgbtRed = 128;
pRGB->rgbtGreen = 128;
pRGB->rgbtBlue = 128;
pRGB++;
for(x = 1; x < pImage->GetWidth(); x++)
{
grey = (pRGB->rgbtRed + pRGB->rgbtGreen) >> 1;
temp = grey - grey2;
temp = (temp > 127) ? 127 : temp;
temp = (temp < -127) ? -127 : temp;
temp += 128;
pRGB->rgbtRed = temp;
pRGB->rgbtGreen = temp;
pRGB->rgbtBlue = temp;
grey2 = grey;
pRGB++;
}
}
pImage->UnlockBits(&bitmapData);
