|
Hi, thanks for your reply.
Is there a way to set the pixels of a DDB with this? I had thought it was DIB only?
"Sir, I protest. I am NOT a merry man!"
|
|
|
|
|
Naturality wrote: Is there a way to set the pixels of a DDB with this? I had thought it was DIB only?
LockBits is GDI+ and works great.
In addition to that...
With GDI, a DIBsection gives you a bitmap you can use like a DDB
but with a pointer to the pixel bits array. See CreateDIBSection().
A DIBSection (like a GDI+ Bitmap object) is also more flexible than
a DDB, since it can be created it with the same pixel format as your
data and still be selected into into a memory DC that is not the same
format as the screen.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, I've been looking into it and it seems like it's the answer for me
"Sir, I protest. I am NOT a merry man!"
|
|
|
|
|
Hello,
given the vertices's of initial and resultant plane.
I need to transform a plane(i.e. triangle) from one plane to other in which rotation, scaling and translation has to occur. I just need that transformation matrix if applied to the initial plane it will give resultant plane.
i am trying to
1> rotate the plane first to the normal of the resultant plane.
2> scale the matrix requred
3> translate the points...
dont know the approach is correct upto what extent? also it would be to know that can the rotation o the plane be replaced by transalation.
|
|
|
|
|
I've been experimenting with XNA a little. I have a CAD program I can draw models in with a lot of different formats you can export to but unforunately it doesn't have .fbx or .x. I was wondering can the content piplelines use any other formats? I wasn't able to find any list of acceptable 3d CAD file formats. Thanks.
|
|
|
|
|
Hi all,
I'm new to Direct3D programming, but made some simple examples.
I'm actually working on a WPF project in C#, but I'm exploring the new 3.5SP1 D3DImage imagesource to solve a performance issue.
I already have made a working example of some aplha-blended d3d projected on a WPF window, and it performs and antialiases very smooth.
The d3d code is Visual C++ , put in an unmanaged dll. I'd like to keep it that way, it's the method suggested for optimal performance.
What I want to can't be very hard - I want to draw about 200-300 rectangles on the 2D screen which size independantly of eachother. The rectangles are a simple top to bottom gradients. The rest of the rendered output is transparent.
- from here on I'd like your advice -
Do draw the rectangles, I'll use an array of four-vertices vertexarrays, stored on the d3ddevice memory. (Is that a good starting point?). I render them with trianglefan.
The rectangles get sized (scaled?) each 20 milliseconds, individually from oneanother (an array of floats is sent from the WPF app). What methods should I look for? Is it correct that matrices only apply to the whole scene, so I should do it differently?
It would be nice if I could "slow down" the sizing. For example, a rectangle goes from 0.1 to 0.9, and I want it to progress at a maximum speed of 1/500ms . Any ideas? Which part/methods of the DirectX documentation is good reading material for this?
Any help appreciated
|
|
|
|
|
Dear All,
I am developing an application to preview the video from a Capture device. I have developed the application and it is working fine, but the problem is that it is playing two times correctly but for the third time i got error while connecting with video renderer. Please help me. Code snippet is given below :
void DialogPlayer::OnBnClickedButton12()
{
bool x= CreateVideoGraph();
}
BOOL DialogPlayer::CreateVideoGraph()
{
hr = CoCreateInstance(CLSID_FilterGraph, NULL,CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
if(FAILED(hr))
{
return FALSE;
}
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL,CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2,(void **)&pBuilder);
if(FAILED(hr))
{
return FALSE;
}
if (SUCCEEDED(hr))
{
hr=pBuilder->SetFiltergraph(pGraph);
if(FAILED(hr))
{
return FALSE;
}
}
}
hr= pGraph->QueryInterface(IID_IMediaControl,(LPVOID *) &(pControl));
hr=pGraph->QueryInterface(IID_IVideoWindow, (LPVOID *) &(VideoWindow));
ICreateDevEnum *pSysDevEnum = NULL;
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum);
if(FAILED(hr))
{
return FALSE;
}
IEnumMoniker *pEnumCat = NULL;
hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0);
if (hr == S_OK)
{
IMoniker *pMoniker = NULL;
ULONG cFetched;
while(pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK)
{
IPropertyBag *pPropBag;
hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag);
if (SUCCEEDED(hr))
{
VARIANT varName;
VariantInit(&varName);
hr = pPropBag->Read(L"FriendlyName", &varName, 0);
BSTR name2=varName.bstrVal;
if((wcscmp(name2, "Video Capture AV")==0))
{
hr=pMoniker->BindToObject(0,0,IID_IBaseFilter, (void**)&(VideoSourceFilter));
hr=pGraph->AddFilter(VideoSourceFilter,L"Video Source");
check1=1;
}
if(check1==0)
{
return FALSE;
}
pPropBag->Release();
}
pMoniker->Release();
}
pEnumCat->Release();
}
else
{
return FALSE;
}
pSysDevEnum->Release();
hr = CoCreateInstance(CLSID_VideoRenderer, 0, CLSCTX_INPROC_SERVER,IID_IBaseFilter, (void**)(&VideoRenderer));
IPin *outPin;
IPin *inPin;
hr = pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, VideoSourceFilter,IID_IAMCrossbar, (void **)(&CrossbarFilter));
hr = pBuilder->FindPin(VideoSourceFilter,PINDIR_OUTPUT,NULL,NULL,FALSE,0,&outPin);
hr = pGraph->Render(outPin);
return TRUE;
}
|
|
|
|
|
You didn't say what kind of error you were getting. Is it possible that on one of your previous runs you aborted the program or took a path that didn't close everything? I had a problem with an OpenCV app I wrote that got very unhappy if I exited without properly releasing everything. COM is funny that way.
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
Hi
are you releasing the reference count on the
CrossbarFilter
IPin *outPin;
these two interfaces when done.
|
|
|
|
|
I tried releasing everything and nothing happens. Finally I remove all the filters in the graph using IEnuFilters and this works for me. Thanks for your kindness and reply.
|
|
|
|
|
Does anybody know where I can get a control like the picture control in Microsoft Word or PhotoDraw? I am in need of that type of image control that floats above another image (using layers), rotates freely and is resizable.
|
|
|
|
|
|
When I run
'Icon k = Icon.FromHandle(WorkingImage.GetHicon());
MemoryStream s = new MemoryStream();
k.Save(s);
int s_length = (int)s.Length;
FileStream WriteFileFinaly = new FileStream(FileName, FileMode.Create);
byte[] b = new byte[s_length];
s.Read(b, 0, s_length);
WriteFileFinaly.Write(b, 0, s_length);
WriteFileFinaly.Flush();
WriteFileFinaly.Close();'
(FileName is a location and file name)
The file created is not working as an icon, when i try to use it in a icon using program it gives an error.
What should I do?
|
|
|
|
|
ThinkingCapProductions_MrFluffy wrote: s.Read(b, 0, s_length);
What would you expect this line to do...?
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
I am using 'b' "a byte[] array" to transfer the data from the MemoryStream 's' "which holds the Icon k" to a FileStream 'WriteFileFinaly'.
|
|
|
|
|
Then you might want to check the return value.
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
I found the main problem but not the solution.
The byte[] 'b' size is alwase 446, and all of the numbers are 0.
Thanks for helping.
|
|
|
|
|
ThinkingCapProductions_MrFluffy wrote: I found the main problem but not the solution.
Might want to pay attention to what i'm trying to point out then.
Look, when you have problems like this, the first step is to break it down. You have a bunch of things that can go wrong, narrow down to the one that is going wrong. If the length of b is 446, then s_length is also 446, and there are 446 bytes stored in your MemoryStream (s ). If all bytes in b have the value 0 , then either the call to Read() is failing or s actually contains nothing but 0 s - so find out: the documentation for Read() specifies that the return value will be the number of bytes read - if that return value is 446... or anything greater than 0... you're successfully reading the contents of the stream into b , and the failure is prior to that. If it's 0, then the call to Read() is failing to read anything and you need to find out why (hint: Seek() back to the start of the stream before trying to read it).
BTW - why are you bothering to write to a MemoryStream rather than just writing directly to your FileStream ?
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
I feel stupid.
'MemoryStream s = new MemoryStream();
k.Save(s);'
The streams position was at the end when I start to read from it, so all I did to fix it was put s.Position=0; to fix it.
Thanks a lot for all the help.
|
|
|
|
|
ThinkingCapProductions_MrFluffy wrote: The streams position was at the end when I start to read from it, so all I did to fix it was put s.Position=0; to fix it.
Ah, good.
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
In C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include , there is ddraw.h ,
but where is the correspond .lib file?
There is no ddraw.lib in C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib .
system
|
|
|
|
|
|
system
|
|
|
|
|
Hello ...
i need help with the sample code given by windows SDK.
there is this AMCAP code they provide.
but there seems to be 5 errors of the same type...
C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\ctutil.h(278): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
and the line 278 of ctutil.h displays;
private:
COARefTime (LONG);
operator = (LONG);
};
anyone could help me to solve the error.. or any guidance?
please.
thanks in advance.
-sue. 
|
|
|
|
|
|