|
So do you mean 24 bits per pixel? There's no 8bpp RGB format for Windows bitmaps...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
To create the DIBSection, you can drop the palette and change the bmiHeader.biBitCount:
BITMAPINFO *bm = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO)];
bm->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bm->bmiHeader.biWidth = 176;
bm->bmiHeader.biHeight = 144;
bm->bmiHeader.biPlanes = 1;
bm->bmiHeader.biBitCount = 24;
bm->bmiHeader.biCompression = BI_RGB;
bm->bmiHeader.biSizeImage = 0;
bm->bmiHeader.biXPelsPerMeter = 0;
bm->bmiHeader.biYPelsPerMeter = 0;
bm->bmiHeader.biClrUsed = 0;
bm->bmiHeader.biClrImportant = 0;
BYTE *pBitmapBits;
HBITMAP hBitmap = ::CreateDIBSection(NULL, bm, DIB_RGB_COLORS, (void**)&pBitmapBits, NULL, 0);
if (hBitmap)
{
::DeleteObject(hBitmap);
}
delete[] (BYTE *)bm;
jossion wrote: I have 8 bits of R,8 bits of G and 8 bits of B seperately in seperate arrays
The pixel data (pointed to by pBitmapBits) will now be a RGBTRIPLE struct for each pixel:
typedef struct tagRGBTRIPLE {
BYTE rgbtBlue;
BYTE rgbtGreen;
BYTE rgbtRed;
} RGBTRIPLE;
You'll need to take the individual RGB component bytes from the arrays and
pack them in the RGBTRIPLE format - BGRBGRBGR...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I would suggest:
bm->bmiHeader.biHeight = -144;
instead of
bm->bmiHeader.biHeight = 144;
When height is positive, the bitmap is bottom-up oriented.
In 99% our bitmap sources are up-bottom oriented.
|
|
|
|
|
That's fine....as long as the OP remembers to adjust his/her
direct pixel access calculations accordingly
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i used the gluTessCallback() function to draw polygon, i can draw it in one computer, but can not draw in another computer, the two computer has diffrent graphic card. what is the matter, and how can resolve the question?
thanks
|
|
|
|
|
Hello ~
Can i ask Some question abo ut zedgraph here??
anyway this is my first question in code project ^^
and i can't english well plz comprehension my writing
let's start question
now My company Project Using Zedgraph.dll ver:5.1.4(maybe)
in the Project using zedgraph namespace
and i complete Drawing the Graph
only user X axis, Y axis
data is X[30] , T[30] <-- this data is ReadlTime data and Changing 3sec
Graph is Drawing but 3sec draw the Line, and 6sec draw the Line.. so on
Time is Gone...Line is so Many Many and i don't want it
for example)
0sec
3sec Draw the Line~~~~ Having data X[30] , T[30](data always chaging every
3sec)
and i want clear the line <-- this is i want
6sec Draw the Line~~~~ Having data X[30] , T[30](data always chaging every 3sec)
so on.....
how do i clear the Line ??
check this out my source
private void CreateGraph(double[] X, double[] T) //제드그래프 생성 (X,Y값을 가져옴)
{
GraphPane myPane = zgc.GraphPane;
// Set the titles and axis labels/;/l
myPane.Title.Text = "My Test Date Graph";
myPane.XAxis.Title.Text = "X";
myPane.YAxis.Title.Text = "Y";
// Make up some data points from the Sine function
PointPairList list = new PointPairList();
for (int i = 0; i < X.Length; i++)
{
list.Add(X[i], T[i]);
}
/*
for (double x = 0; x < 36; x++)
{
double y = Math.Sin(x * Math.PI / 15.0);
list.Add(x, y);
}
*/
// Generate a blue curve with circle symbols, and "My Curve 2" in the legend
LineItem myCurve = myPane.AddCurve("내부온도", list, Color.Blue,
SymbolType.Circle);
myCurve.Line.Fill = new Fill(Color.White, Color.Red, 45F);
// Make the symbols opaque by filling them with white
myCurve.Symbol.Fill = new Fill(Color.White);
// Make the symbols opaque by filling them with white
myCurve.Symbol.Fill = new Fill(Color.White);
// Fill the axis background with a color gradient
myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F);
// Fill the pane background with a color gradient
myPane.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45F);
// Calculate the Axis Scale Ranges
zgc.AxisChange();
Refresh();
|
|
|
|
|
You'll have a better chance getting an answer if you ask on either the official ZedGraph[^] site or the article here[^] on CodeProject.
Cheers,
Drew.
|
|
|
|
|
Hello friends,
Recenty i have started working on flash MX.
I have designed a flash registration page,after entering the details and clicking on the submit button i am redirecting it to a HTML page.HTML page is similar to the flash registration page.
This HTML page is hosted in sm application,through the getURL method i am passing all the field values to the HTML registartion page.These fields get populated in the HTML page.
In the hosted HTML page i have a submit button on clicking of this the user is redirected to the login page and the datas are stored in a database.
My problem is can i redirect to login page and also store the data in database.How can i use the HTML registartion page submit buttons action in action script so that i am redirected to loging page.
Can any one help me
Thanks in advance.
|
|
|
|
|
I’ve got problem with using GDI on top of OpenGL in Windows Vista. I’ve found that if GDI graphic would be drawn before any drawing operation of OpenGL than everything what was drawn by GDI would be cleared and would be drawn everything what was drawn by OpenGL before and after. It looks like OpenGL is drawn in separate buffer which after each calling of glFlush function drawn on a screen while clearing what was drawn by GDI. One of easiest solution of the problem is to draw any GDI objects after drawing OpenGL elements, but appears the same problem when the screen spitted on 4 sides. After drawing of one screen, drawing of OpenGL elements next screen clearing GDI objects previous screen. I tried to draw everything on the screen and the copy everything to memory buffer using CDC::BitBlt and then draw this buffer using OpenGL function glDrawPixels. But I found that GDI objects are drawn after exit from CView::OnDraw function, means catch of screen using CDC::BitBlt at the end of CView::OnDraw function do not include GDI objects.
Other case is to draw GDI objects to memory and the draw them by using OpenGL functions did not tested. I am trying to find much easiest way to solve the problem.
Please, help to solve the problem.
|
|
|
|
|
Hi,
Im using DirectX.AudioVideoPlayback.dll in my C# project to play both audio and video. But some problems are facing.
1. Video.Dispose() or Audio.Dispose() methods are not working correctly. Even I disposed the video object used it is not freeing all resources used. I tried to delete the file that is used by the video object to play video after disposing it. But windows shows that 'File is already in use'. It only freeing resource after closing the application. This is a major Issue.
2. Video.Ending event is not firing always.
Any help will be appreciated. Thanks in advance
Sibin Sunny
|
|
|
|
|
I had the same problem with Video.Ending event. I solved it by using System.Timers.Timer component. Always before calling Play() method I set Interval property of the timer to the value of Video.Duration * 1000 (video Duration property is in seconds and Interval property is in miliseconds), and start the timer. Each time the timer Elapsed event occurs means that video is ended. I got the same behavior as Video.Ending event should provide.
modified on Tuesday, May 5, 2009 9:36 AM
|
|
|
|
|
|
I am student of Birbhum institute of engg.
|
|
|
|
|
Nice to meet you...
- ns ami -
|
|
|
|
|
|
KCMANDAL wrote: very important
So, you're "very important"?? Don't you think that's a bit arrogant of you to declare?
|
|
|
|
|
I try to display the content of client area of window A on the window B.
void SimpleDlg::OnButton3()
{
HWND hWnd=NULL;
hWnd=::FindWindow("l2UnrealWWindowsViewportWindow", NULL);
HDC hdcLin=::GetDC(hWnd);
HDC hdcWin=::GetDC(this->m_hWnd);
::BitBlt(hdcWin,
0,0,
300, 300,
hdcLin,
600,400,
SRCCOPY);
::ReleaseDC(hWnd, hdcLin);
::ReleaseDC(this->m_hWnd, hdcWin)
}
this code looks fine, but it works only once. when a pircture is changed on the window A and then function OnButton3 is run again, previous content of window A will be displayed. DC of window A is updated only when i close window A and open a new one. do i have to refresh somehow DC of window A in order to have always the most recent context?
thank you in advance.
radek
|
|
|
|
|
Hii there.. i wondering whether u have an solution already for "refresh device context" problem, if u do please let me know, because i have the same problem. Thanks for share.
|
|
|
|
|
Hello,
I'm communicating with a logic analyzer (HP 1660A) over RS232. I issue a command which tells the analyzer to print screen its display and send it over to the controller (my pc) through serial communication. I'm saving the result (which is usually abut 25kB) to my computer and I would like to view it as a TIFF or other format. The problem is that the response from the analyzer comes in PCL format, therefore suitable to be sent to a printer and printed directly, but not to be opened as an image. I have tried a few PCL to image converters to do the job, I found one which does it properly, however I've used the trial version and I am reluctant to purchase it. I've given you the background of my labour. I would appreciate any kind of help, a reference to the commands in pcl 1 and what should I do in order to extract the data and format it properly from the PCL file. I have no experience with PCL and image processing whatsoever, so please, give me a hand here. Thank you.
P.S. I've obtained the PCL file from the analyzer, both in C# and matlab... I have one slight problem in C# with the serial port control, some images have some uninterpreted characters in the image, when using the above converters. I say all these because I need an algorithm or some indications, no matter the programming language, so please feel free to post.
|
|
|
|
|
Hi,
i have written a shadder program like wrapEffect available on codeproject.com which i am using in wpf to distort images.
i want to know is it possible that in shader we can translate vertext to any direction.
currently it seem that we can translate vertext to only straight direction within a ratio of 0 to 1..
is there any way to do so..
|
|
|
|
|
Hi;
I downloaded Directx SDK November2008 release. in SDK I got some samples when I compile that samples it is compiling ok, but when I run this sample it is giving this error.
"The procedure entry point __CxxFrameHandler3 could not be located in the dynamic link library"
if any body have solution for this problem it would be thank full.
|
|
|
|
|
I'm developing a vector graphics app and I'm trying to find the most efficient way to scale a rotated shape. As an example, lets say the user adds a rectangular shape to the drawing surface. Once they rotate the shape to, say 45 degrees, how can I most effeciently perform scaling once they decide to resize the shape?
My current solution is to get the amount of pixels the mouse has moved, then rotate the shape back to 0 degrees, then offset the points by the delta amount, then rotate the points back to the current rotation. I don't think this is the best method because if the user has created a complex polygon and rotates it, I may end performing thousands of calculations!
Can anybody help me?
My code this week has no errors. But it's Monday morning and I haven't got out of bed.
|
|
|
|
|
Hi,
this is one approach:
- create an abstract base class that represents a drawable item; give it a Transformation Matrix member that initially is set to the unity matrix.
- derive all drawable items (lines, rectangles, circles, ...) from it; in the Paint handler, apply the transformation matrix to your Graphics object before drawing the object.
- when one or more drawable items are selected and a transformation gets ordered (translation, rotation, scaling) adjust the matrix for each selected object, i.e. calculate the matrix that represents the new transformation and combine it with the individual matrices.
The main problem that remains now is mapping mouse positions to the relevant drawable item;
there is no inverse matrix so you can't directly go from mouse position to item; you have to enumerate the items, for each enumerate the clickable parts (points, edges, surfaces), apply the transformation to them and check for a mouse hit.
Hope I made this sufficiently clear.
|
|
|
|
|
Thanks for the reply.
I've toyed around with using the matrix class but I can't seem to justify transforming a whole collection of shapes every time I need the coordinates. The transforms would also have to be applied on every paint operation. This seems to be too much of a cpu hog.
I wish I had a more firm grip on trigonomerty so the points could be scaled along the rotational axis.
My code this week has no errors. But it's Monday morning and I haven't got out of bed.
|
|
|
|
|