|
|
IF:
Xo, Yo - the center of the ellipse
Rx, Ry - the two radius'
alpha - is the angle in radians!!!
Calculate:
X = Xo + Rx*cos(alpha);
Y = Yo + Ry*sin(alpha);
Draw:
a line from (Xo,Yo) to (X,Y)
*In case you have a circle, then Rx=Ry = R of circle
|
|
|
|
|
Btw, if you want to implement as it was on the picture, I would highly recommend using a circle, because otherwise the length of the hands will vary, which is not realistic.
|
|
|
|
|
Hi all,
This is with reference to an old message posted by me which you can find here
http://www.codeproject.com/script/Forums/View.aspx?fid=387159&msg=2452196[^]
For the past one year this piece of code which Mr.Mark gave me; satisfied my requirements excellently. Now I have come up with a problem of displaying colour video. I will need help once again in modifying the code to colour mode. The main problem is how I should arrange the pixels and where to write it. What are the BITMAPINFO parameters that I have to change. Hope to get a reply at the earliest.
|
|
|
|
|
How many bits per pixel (what's the pixel format)?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
8 bit per pixel in RGB format.I have three arrays of unsigned char for each R,G and B values.
|
|
|
|
|
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.
|
|
|
|