Click here to Skip to main content
15,888,286 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
QuestionMFC Tree Pin
RakeshManohar3-Mar-10 17:43
RakeshManohar3-Mar-10 17:43 
QuestionGetHandle Pin
john56323-Mar-10 16:44
john56323-Mar-10 16:44 
AnswerRe: GetHandle Pin
Stephen Hewitt3-Mar-10 17:26
Stephen Hewitt3-Mar-10 17:26 
GeneralRe: GetHandle Pin
john56323-Mar-10 17:32
john56323-Mar-10 17:32 
GeneralRe: GetHandle Pin
Adam Roderick J3-Mar-10 17:35
Adam Roderick J3-Mar-10 17:35 
GeneralRe: GetHandle Pin
john56323-Mar-10 17:37
john56323-Mar-10 17:37 
GeneralRe: GetHandle Pin
john56323-Mar-10 17:41
john56323-Mar-10 17:41 
GeneralRe: GetHandle Pin
Adam Roderick J3-Mar-10 17:46
Adam Roderick J3-Mar-10 17:46 
GeneralRe: GetHandle Pin
john56323-Mar-10 17:50
john56323-Mar-10 17:50 
GeneralRe: GetHandle Pin
Adam Roderick J3-Mar-10 18:06
Adam Roderick J3-Mar-10 18:06 
GeneralRe: GetHandle Pin
john56323-Mar-10 18:08
john56323-Mar-10 18:08 

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.