Advertisement
Advertisement
| 03.05.2008 at 12:39AM PST, ID: 23215272 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: |
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HBITMAP hbitmap;
int WIDTH, HEIGHT;
switch (message)
{
case WM_PAINT:
HANDLE hObj = LoadImage(NULL,"image.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
HDC hdc = CreateCompatibleDC(NULL);
SelectObject(hdc, hObj);
BITMAPINFO bInfo;
bInfo.bmiHeader.biSize = sizeof(bInfo.bmiHeader);
bInfo.bmiHeader.biWidth = WIDTH;
bInfo.bmiHeader.biHeight = HEIGHT;
bInfo.bmiHeader.biPlanes = 1;
bInfo.bmiHeader.biBitCount = 8;
bInfo.bmiHeader.biCompression = BI_RGB;
BYTE tempScanLine[WIDTH ];
BYTE info[HEIGHT][WIDTH][1];
BITMAPINFO bi;
ZeroMemory(&bi, sizeof(BITMAPINFO));
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
int count = HEIGHT - 1;
const double grayscale[WIDTH*HEIGHT];
for(int j = 0; j < HEIGHT; ++j)
{
// find the width of the object
GetDIBits(hdc, (HBITMAP) hObj, j, 1, NULL, &bi, DIB_RGB_COLORS);
// store the color values in a 3D array of bytes
GetDIBits(hdc, (HBITMAP) hObj, j, 1, tempScanLine, &bInfo, DIB_RGB_COLORS);
for(int z = 0; z < bi.bmiHeader.biWidth; ++z)
{
info[count][z][0] = tempScanLine[(z * 1) + 2];
info[count][z][1] = tempScanLine[(z * 1) + 1];
info[count][z][2] = tempScanLine[(z * 1) + 0];
//Transform to gray values
grayscale[z]=info[count][z][0]*0.299 + info[count][z][1]*0.587+info[count][z][2]*0.114;
}
--count;
}
|
| Answered By: | DanRollins |
| Expert Since: | 04/18/2000 |
| Accepted Solutions: | 4287 |
| Computer Expertise: | Guru |