|
int* px = new int[iVariable];
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi All,
I have a an image handle provided to me by a device in form of
Handle hDib;
It is not
HDC hDC;
I want to convert this hDIB to Char* array for further use in my application.
Please let me know if any of you know about a good c++ library for this.
Thanks in advance.
|
|
|
|
|
Could GetDIBits[^] function help you?
Veni, vidi, vici.
|
|
|
|
|
Dear
As I mentioned in my question that it is not HDC rather it is
HANDLE hDib;
The function you mentioned need HDC as a parameter
which i donot have
|
|
|
|
|
What kind of device are you dealing with?
Veni, vidi, vici.
|
|
|
|
|
|
How can a digital camera provide a HANDLE to a DIB?
Veni, vidi, vici.
|
|
|
|
|
It is a method provided in its SDK which I'm using
It also saves it on the disk but I want to convert it into Char* array and later to jbyteArray.
Well the question is Is it possible to convert this Handle (which is obviously a pointer to that specific DIB) to char* array
modified 14-Sep-12 9:31am.
|
|
|
|
|
if that handle is really a pointer to a DIB, then it's a pointer to an BITMAPINFOHEADER, with the pixel bytes immediately following.
|
|
|
|
|
It's most unlikely that you would want to convert it to a char* array. If it is really a pointer to some form of bitmap then there should be a function that will return the actual bitmap structure or byte array for you, but without knowing anything about the SDK you are using it's impossible to know what.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thank you all for your response i have been able to create a
HBITMAP from my DIB
HANDLE DIB by using info header and filling it using GDI . I also have been able to save it to my disk and to draw it on screen by using
StretchDIBits method of the same library.Conversion of DIB to char* was not a good option.Now i want to know that is there any other good API or C++ library which can be used to draw DIB directly on
tagRect in an MFC application.
|
|
|
|
|
StretchDIBits() already performs that function; what do you mean by tagRect ?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
It is a structure which draws a rectangle in windows applications.
The problem with that method is that when i minimize my application and again restore it. The image disappears. I have also used the function
FillRect() but the problem still persists.
Kindly help me in this regard
|
|
|
|
|
AhmdAxf wrote: when i minimize my application and again restore it. The image disappears. So, you are probably doing something wrong, quite possibly drawing in the wrong place. You must put all your drawing code inside the function that handles the WM_PAINT message.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Actually it is not a MFC application which does have a method which contains WM_PAINT message.
Rather it is a java applet and I'm drawing through AWT native Interface.
|
|
|
|
|
So why was this posted in the C/C++/MFC forum and titled "Conversion of image Handle hDib to Char* array in C++"?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
There is no separate forum for c++ or AWT native interface or JNI. So I have to post it here
|
|
|
|
|
Please Let me know if there is any useful forum for this particular technology
|
|
|
|
|
There are clearly marked forums here for Java and for C++; choose the one that is most appropriate to your problem and describe the problem in detail.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
how to creat a R-Tree based on GIS.spatial object,if I know the MBR of each spatial object.how I can Know when to merge some MBR together?
|
|
|
|
|
Google and Wikipedia are fantastic tools, you know.
For instance, the R-Tree page[^] at Wikipedia looks promising.
Veni, vidi, vici.
|
|
|
|
|
|
You are welcome.
Veni, vidi, vici.
|
|
|
|
|
Hi everybody,
This is for the more advanced people!
I know that the DirectX9 D3DXIntersect function has the ability to gives the exact coordinates of the intersecting ray-to-polygon, and can give the distance from the ray’s starting point to the intersection point.
Now my question is, how do I retrieve that information of the exact coordinates of the ray’s intersecting point?
I think the information if I’m not mistaken is found in the LPD3DXBUFFER * ppAllHits, but I’m not sure as to how to setup the buffer, nor access the information.
Please help… Thanks!
HRESULT D3DXIntersect(
LPD3DXBASEMESHpMesh,
CONST D3DXVECTOR3 * pRayPos,
CONST D3DXVECTOR3 * pRayDir,
BOOL *pHit,
DWORD * pFaceIndex,
FLOAT * pU,
FLOAT * pV,
FLOAT * pDist,
LPD3DXBUFFER * ppAllHits,
DWORD * pCountOfHits);
____________________________________________
My variables and code:
Note: My code works great.
I just need help with getting and returning the exact coordinates of my ray’s intersection with the mesh.
____________________________________________
float XBegin, float YBegin, float ZBegin; float XEnd, float YEnd, float ZEnd; sMesh *LevelMesh;
BOOL Hit;
float u, v, Dist;
float XDiff, YDiff, ZDiff, Radius;
DWORD FaceIndex;
D3DXVECTOR3 vecDir;
while(LevelMesh != NULL) {
D3DXIntersect(LevelMesh->m_Mesh, \
&D3DXVECTOR3(XBegin,YBegin,ZBegin), &vecDir, \
&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);
if(Hit == TRUE) {
if(Dist < Radius)
return TRUE; }
return FALSE; }
|
|
|
|
|
Hmm, I know there are some smart coders out there! anyone?
|
|
|
|