|
Im using this method needless to say is not working and need some help.
void rotateb(Bitmap* image, HDC dc){<br />
Graphics graphics(dc);<br />
Bitmap* SrcBitmap1 = image;<br />
Color mc;<br />
<br />
int angle=45;
float radians=(2*3.1416*angle)/360; <br />
<br />
float cosine=(float)cos(radians); <br />
float sine=(float)sin(radians); <br />
<br />
float Point1x=(-SrcBitmap1->GetHeight()*sine); <br />
float Point1y=(SrcBitmap1->GetHeight()*cosine); <br />
float Point2x=(SrcBitmap1->GetWidth()*cosine-SrcBitmap1->GetHeight()*sine); <br />
float Point2y=(SrcBitmap1->GetHeight()*cosine+SrcBitmap1->GetWidth()*sine); <br />
float Point3x=(SrcBitmap1->GetWidth()*cosine); <br />
float Point3y=(SrcBitmap1->GetWidth()*sine); <br />
<br />
<br />
float minx=min(0,min(Point1x,min(Point2x,Point3x))); <br />
float miny=min(0,min(Point1y,min(Point2y,Point3y))); <br />
float maxx=max(Point1x,max(Point2x,Point3x)); <br />
float maxy=max(Point1y,max(Point2y,Point3y)); <br />
<br />
int DestBitmapWidth=(int)ceil(fabs(maxx)-minx); <br />
int DestBitmapHeight=(int)ceil(fabs(maxy)-miny);<br />
<br />
Bitmap* DestBitmap = new Bitmap(DestBitmapWidth, DestBitmapHeight);<br />
<br />
for(int x=0;x<DestBitmapWidth;x++) <br />
{ <br />
for(int y=0;y<DestBitmapHeight;y++) <br />
{ <br />
int SrcBitmapx=(int)((x+minx)*cosine+(y+miny)*sine); <br />
int SrcBitmapy=(int)((y+miny)*cosine-(x+minx)*sine); <br />
if(SrcBitmapx>=0&&SrcBitmapx<SrcBitmap1->GetWidth() && SrcBitmapy>= 0 && <br />
SrcBitmapy<SrcBitmap1->GetHeight()) <br />
{ <br />
SrcBitmap1->GetPixel(SrcBitmapx,SrcBitmapy,&mc);<br />
DestBitmap->SetPixel(x,y,mc);<br />
} <br />
} <br />
} <br />
<br />
graphics.DrawImage(DestBitmap,0, 0); <-- this does not <br />
}
Thank you
|
|
|
|
|
what does it display? Try to set some pixels in destination bmp with some constatnt color to check if there is problem in rotation alghoritm or displaying
rrrado
|
|
|
|
|
Also, if you aren't required to write the rotation code yourself, GDI+ will do it for you
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi
the GDI+ i find is not very precise Mark i mean the image center shifts, and you have to draw the image then rotate the DC then draw it again you end up with two images and a rotated DC lol
the method i posted is skipping the second for loop for some reason
thanks for your replies... back to digging
|
|
|
|
|
hmm I've found it to be precise. Controlling the image center is easy handled.
I'm not sure what you mean by rotating a DC and ending up with two images - It uses pretty much
the same technique you are using.
Check this out (if you want to ). This spins an image (in a window, so you can watch) around
its center point (like a propellor LOL) at 5 degree increments...
Gdiplus::Bitmap SrcBitmap(L"C:\\test.bmp", FALSE);
Graphics DstGraphics(*this);
REAL angle = 0.0f;
for (int i = 0; i < 200; ++i)
{
DstGraphics.ResetTransform();
DstGraphics.RotateTransform(angle);
DstGraphics.TranslateTransform(SrcBitmap.GetWidth() / 2.0f, SrcBitmap.GetWidth() / 2.0f, MatrixOrderAppend);
DstGraphics.DrawImage(&SrcBitmap, -((INT)SrcBitmap.GetWidth() / 2), -((INT)SrcBitmap.GetHeight() / 2),
SrcBitmap.GetWidth(), SrcBitmap.GetHeight());
angle += 5.0f;
if (angle >= 360.0f)
angle -= 360.0f;
}
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
I am working on a large codebase on VC++ 6.0, which contains many unused functions. i.e. functions that are never called from anywhere else in the code. I would like to delete these functions.
Without having to run every possible scenario with some sort of code coverage tool, is there any possible way to find these functions? Currently all I can do is do a Find In Files on the function name and work it out.
Thanks for your help...
Cheers
d3m0n
|
|
|
|
|
do you want to do that for your personal order? I mean the compiler sees which functions you use...
|
|
|
|
|
Yes... it's sometimes confusing if you're changing a file, and there's a function in there with an obvious bug. There's no point trying to fix the bug if that function is totally redundant. Better to just remove it.
So I was wondering if there was a way to find every redundant function, so I don't waste my time looking at them.
Thanks.
Cheers
d3m0n
|
|
|
|
|
[d3m0n] wrote: So I was wondering if there was a way to find every redundant function...
Doesn't the profiler tell you this?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I could never get the profiler to work. Enabled the option in the project settings but the [Build->Profile] menu is always disabled.
Might try again though if you think it would be useful for what I'm trying to do.
Thanks.
Cheers
d3m0n
|
|
|
|
|
[d3m0n] wrote: Enabled the option in the project settings...
On the Link tab, you checked the Enable profiling checkbox?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Interesting this profiler, I did not know its existence but do not see a profiler anywhere neither in Build menu nor in the settings.
I use VS 2003. could you help please?
|
|
|
|
|
Yup, and rebuilt like it says in MSDN
Cheers
d3m0n
|
|
|
|
|
Hi all,
I am capturing video from device and then rendering it in a Dialog Box window using RenderStream function by using the following piece of code:
CHECK_HRESULT(UnInitializeGraph());
CHECK_HRESULT(InitializeGraph(enmCAPTURE_GRAPH, hParent, hPreview));
CComPtr pCaptureFilter;
CHECK_HRESULT(AddFilterByName( CLSID_VideoInputDeviceCategory, bstrDeviceName, &pCaptureFilter));
CHECK_HRESULT(RenderStream(pCaptureFilter, PIN_CATEGORY_PREVIEW, MEDIATYPE_Video));
CHECK_HRESULT(GetGraphInterfaces());
and it is working fine.
Now suppose i don't want to use RenderStream given above and get the same functionality.I want to connect the individual filters by AddFilter function.
Actually i am trying to do that but i am not getting anything.
Please help me how should i proceed.
Thanks and Regards,
Mayank
|
|
|
|
|
Is that C++? Many of those DirectShow calls don't look right to me
For example, RenderStream isn't called on an object and I thought it took 5 parameters...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mike,
Thanks for your reply.
Actually it is C++ only and these indeed are the right calls.In RenderStream i am calling another RenderStream function which is indeed taking 5 parameters.I have attached camcorder through Fusion HDTV card to my system and is getting the video being captured being displayed.
I used GraphEdit and saw the follwing process going on:
TvTuner-->TvAudio-->Crossbar-->FusionHDTV-->Video Renderer
Now if i don't want to use RenderStream function how will i be able to get the video displayed.
If i can get the filters of all the above and then connect them in the filter graph then if i will be able to get the video displayed.
e.g i can add the Crossbar filter using the given below code:
CHECK_HRESULT(AddFilterByName( AM_KSCATEGORY_CROSSBAR, bstrDeviceName, &pCrossbarFilter));
Or is there any method to accomplish above
Thanks and Regards,
Mayank
|
|
|
|
|
Hi all,
i have made a SDI application in that i have made a splitter control which is dividing my window in two horizontal parts. For those two partition i have made two view each derived from CFormView. In that i have made a list control each. now my problem is while i resize my window or splitter control my list control is not resizing itself. I know that the desired code should be written in WM_SIZE but i don know how to code it. Can anybody help me in this...
Thanks in advance
|
|
|
|
|
Hi,
MFC version of WM_SIZE is OnSize Handler and if you need to adjust the size to whole window the following code will do it.
void CYourFormView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
m_wndListCtrl.MoveWindow(0, 0, cx, cy);
}
if you want the list control to be placed and resize to new position use SetWindowPos() instead of MoveWindow.
Best Regards
Raj
|
|
|
|
|
Rajkumar is right - you need to handle WM_SIZE / OnSize in your formview. BUT: If you have many controls on your form, then there is a whole section of articles on the subject on this strange site. What was the name....?
Ah yes:
http://www.codeproject.com/dialog/#Control+Positioning[^]
Iain.
|
|
|
|
|
I want to Call WIN 32 DLL in WIN 16 Program. PLz give some IDEA or any reference.
|
|
|
|
|
why would you do that?
rrrado
|
|
|
|
|
...and how would you expect that to work? And why would you write a Win16 app?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi All,
How to get the status of all ports on the remote system? I need to give a list of ports that are listening, opened, waiting to close etc. Almost the same output as:
netstat -o
The only thing is that, I need to get the information of remote system. I am trying WMI, but, no luck yet. Any help is greatly appreciated.
Regards,
KVRN Kiran Kumar.
|
|
|
|
|
I would like to print some text using the default printer.
(by a MFC C++ program)
Please help me with some related coding or web pages.
Thanks!
|
|
|
|