Click here to Skip to main content
15,911,891 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Strange behaviour with numeric_limits::quiet_NaN () [modified] Pin
Adam Roderick J4-Mar-10 0:09
Adam Roderick J4-Mar-10 0:09 
AnswerRe: Strange behaviour with numeric_limits::quiet_NaN () Pin
CPallini4-Mar-10 0:22
mveCPallini4-Mar-10 0:22 
GeneralRe: Strange behaviour with numeric_limits::quiet_NaN () Pin
Sylv334-Mar-10 0:39
Sylv334-Mar-10 0:39 
QuestionDesign OSI Layer in C++ Pin
Game-point3-Mar-10 22:25
Game-point3-Mar-10 22:25 
AnswerRe: Design OSI Layer in C++ Pin
Cedric Moonen3-Mar-10 22:38
Cedric Moonen3-Mar-10 22:38 
QuestionVideo Encoding... Pin
R@jeev K R3-Mar-10 21:17
R@jeev K R3-Mar-10 21:17 
AnswerRe: Video Encoding... Pin
Code-o-mat3-Mar-10 21:39
Code-o-mat3-Mar-10 21:39 
GeneralRe: Video Encoding... Pin
R@jeev K R3-Mar-10 22:12
R@jeev K R3-Mar-10 22:12 
AnswerRe: Video Encoding... Pin
KingsGambit3-Mar-10 21:43
KingsGambit3-Mar-10 21:43 
GeneralRe: Video Encoding... Pin
R@jeev K R3-Mar-10 22:17
R@jeev K R3-Mar-10 22:17 
GeneralRe: Video Encoding... Pin
KingsGambit3-Mar-10 22:52
KingsGambit3-Mar-10 22:52 
GeneralRe: Video Encoding... Pin
R@jeev K R3-Mar-10 23:05
R@jeev K R3-Mar-10 23:05 
QuestionMFC treeview in a listview [modified] Pin
yvanc3-Mar-10 20:38
yvanc3-Mar-10 20:38 
AnswerRe: MFC treeview in a listview Pin
john56324-Mar-10 0:21
john56324-Mar-10 0:21 
QuestionHWND of Dialog Pin
john56323-Mar-10 20:18
john56323-Mar-10 20:18 
AnswerRe: HWND of Dialog Pin
normanS3-Mar-10 20:28
normanS3-Mar-10 20:28 
AnswerRe: HWND of Dialog Pin
CPallini3-Mar-10 20:42
mveCPallini3-Mar-10 20:42 
AnswerRe: HWND of Dialog Pin
Maximilien4-Mar-10 3:17
Maximilien4-Mar-10 3:17 
Questionsaving dibsectionbits into avi?? Pin
Kiran Satish3-Mar-10 18:54
Kiran Satish3-Mar-10 18:54 
Hi all,
I have a code in an applicaiton that I use in many dialogs to display a grayscale data into a color image (using pseudo colors) as follows-

//in header file
LONG		DIBSecWidth;
LONG		DIBSecHeight;
LONG		BitsPerPixel;
LONG		Stride;
BITMAPINFO	bmi;
BYTE		*pDIBSectionBits;
HBITMAP		hbm;

//in cpp file
DIBSecWidth  = 512;
DIBSecHeight = 512; 
BitsPerPixel = 24;
m_bData = VBI_vector(row*col);
Stride = ((DIBSecWidth * BitsPerPixel + 31L) & (~31L)) / 8L;	
memset(&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = DIBSecWidth;
bmi.bmiHeader.biHeight = DIBSecHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = (WORD)BitsPerPixel;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = Stride * abs(DIBSecHeight);
hbm = ::CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void**)&pDIBSectionBits, NULL, 0);
memDC.CreateCompatibleDC(NULL);
//colormap
colormap = new COLORREF[256];
int red, blue, green;
for (int i=1; i<257; ++i)
{
	red = (int)(((1+cos((4*PI*double(i))/(3*255)))/2)*255);
	green = (int)(((1+cos((4*PI*double(i)/(3*255))-(2*PI/3)))/2)*255);
	blue = (int)(((1+cos((4*PI*double(i)/(3*255))-(4*PI/3)))/2)*255);
	colormap[256-i] = RGB(red,green,blue);
}
//on paint()

CDC *dc = Display->GetDC();
HGDIOBJ holdbm;
BYTE color;	
short idx;
RGBTRIPLE *pCurRowPixel = (RGBTRIPLE *)(pDIBSectionBits);
short i=-1;
for (int y = 0; y < 512; ++y)
{
	for (int x = 0; x < 512; ++x)
	{
		color = (BYTE) m_dDatatemp[++i];
		pCurRowPixel[x].rgbtBlue = GetBValue(colormap[color]);
		pCurRowPixel[x].rgbtGreen = GetGValue(colormap[color]);
		pCurRowPixel[x].rgbtRed = GetRValue(colormap[color]);
	}
	pCurRowPixel = (RGBTRIPLE *)((BYTE*)pCurRowPixel + Stride);
}	
holdbm = memDC.SelectObject(hbm);
dc->BitBlt(align_left, align_top, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight,&memDC,0,0,SRCCOPY);
memDC.SelectObject(holdbm);		
ReleaseDC(dc);

Now I would like to save pDIBSectionBits(or to say the color image being displayed on the dialog) into an avi file. Any ideas or suggestions are really appreciated.

thanks in advance,
PKNT

AnswerRe: saving dibsectionbits into avi?? Pin
normanS3-Mar-10 20:38
normanS3-Mar-10 20:38 
QuestionRaw Image & GUI- Newbie Pin
Trevor Johansen3-Mar-10 18:35
Trevor Johansen3-Mar-10 18:35 
AnswerRe: Raw Image & GUI- Newbie Pin
KingsGambit3-Mar-10 20:09
KingsGambit3-Mar-10 20:09 
AnswerRe: Raw Image & GUI- Newbie Pin
Tim Craig4-Mar-10 19:25
Tim Craig4-Mar-10 19:25 
GeneralRe: Raw Image & GUI- Newbie Pin
Trevor Johansen5-Mar-10 16:12
Trevor Johansen5-Mar-10 16:12 
GeneralRe: Raw Image & GUI- Newbie Pin
Tim Craig5-Mar-10 18:07
Tim Craig5-Mar-10 18:07 

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.