Have tried to obtain a screenshot from the ChromiumEmbedded browser for Delphi XE2/Firemonkey, but the ChromiumFMX.MakeScreenshot method only returns an empty bitmap.
Anyone have any idea how to obtain a bitmap?
Thx.
Instead, use the following (be sure to instantiate YourBitmap prior to this call):
CefGetBitmap(ChromiumFMX.Browser, PET_VIEW, YourBitmap);
Related
I'm using Direct2D to render my user interface.
What I would like is to be more easily able to profile my ui rendering (since I'm using several panels using Graphics debugger is a bit cumbersome).
Since I know that Direct2D uses a Direct3D device (exactly d3d11 device using 10_0 feature level) under the hood, I'd like to know if it is possible to retrieve either a ID310Device or ID3D11Device instance from ID2D1RenderTarget or ID2D1Factory object.
In that case I would easily be able to attach a timestamp query on the BeginDraw/EndDraw calls.
I tried several QueryInterface calls, but none of them have been sucessful so far.
An interesting undocumented secret is that any ID2D1RenderTarget you get from ID2D1Factory will also be an ID2D1DeviceContext (it seems to be intentional from what I've gathered, just accidentally undocumented?). Just call IUnknown::QueryInterface() to snag it. From there you can toy around with methods like GetDevice() and GetTarget(). If you can get the target then you may be able to weasel your way to obtaining the IDXGISurface which supports IDXGIDeviceSubObject::GetDevice() https://msdn.microsoft.com/en-us/library/windows/desktop/bb174529(v=vs.85).aspx (I haven't verified this part)
And in Win10 it looks like ID2D1Device2 gives you precisely what you want: GetDxgiDevice() https://msdn.microsoft.com/en-us/library/windows/desktop/dn917489(v=vs.85).aspx . So in that case, your ID2D1RenderTarget is cast to an ID2D1DeviceContext via IUnknown::QueryInterface(), and then you get an ID2D1Device via ID2D1DeviceContext::GetDevice() and then cast it to an ID2D1Device2 via another call to IUnknown::QueryInterface().
I am using NVAPI, I can get some performance data by calling this function:
NvAPI_GPU_GetDynamicPstatesInfoEx
But don't know how to get video memory usage. I find some c# codes call this function to get it.
NVAPI.NvAPI_GPU_GetMemoryInfo
But there is no the same function in NVAPI.
Any idea?
Does it have to be in NVAPI? If not, check out Nvidia PerfKit: http://developer.nvidia.com/nvidia-perfkit
In case somebody still needs this, you can use this library:
https://github.com/falahati/NvAPIWrapper
Find the right GPU using the NvAPIWrapper.GPU.PhysicalGPU.GetPhysicalGPUs() static method.
Use the NvAPIWrapper.GPU.PhysicalGPU.MemoryInfo property to get the total memory, available memory and other information relative to memory.
My application uses 2 DXGISurfaceRenderTargets.
The 1st render target is used to create ID2D1Bitmap, then ID2D1BitmapBrush from it.
Resulting ID2D1BitmapBrush is used to FillGeometry on the 2nd render target.
Is it possible to retrieve IDXGISurface that was used to create ID2D1BitmapBrush from the ID2D1BitmapBrush or the ID2D1Bitmap?
Windows 8 has ID2D1Bitmap1 with GetSurface method, but I need this on Windows 7.
Thank you.
No, you cannot, as you pointed out, only ID2D1Bitmap1 can retrieve the surface by calling Getsurface, and that's only works on Windows 8.
If you want to use the surface, can you store it after creation, and then pass it as the parameter to the function which used it?
D2D1Bitmap
D2D1Bitmap1
I would like obtain a list of all OIDs in the MIBs that are loaded on a manager and display it to users so that they can choose which MIB object to perform the GET/SET request. I would also like to obtain the syntax and max-access of the object. I'm programming using C++. I want to parse the MIBs to obtain the OIDs, not use snmpwalk. I am trying to use the Net-SNMP MIB_API. I've looked at the manual page but am not clear of how to use the functions to achieve what I want to do.
I see that read_all_mibs() is already called when we call init_mib(). That means I don't need to call read_all_mibs() again, right? Could anyone please guide on what is the next step after init_mib() that I should do.
Any help would be much appreciated. Thanks.
You should look at the apps/snmptranslate.c file for an example of how to walk the loaded mib tree to get information like the syntax and max-access details.
And, no, if you call init_snmp() or init_mib() you don't need to call read_all_mibs()
I'm working with Via Builder, from Inscriber Technology. This app merges a TGA sequence animation into one single .via file, making it much better to load large sequences, as this file is optimized. There are plugins to use this with some Adobe products.
I'm working on Delphi, and my problem is that I can't get back the original alpha channel from the frames. Using their VIACODECLib_TLB library, I have the following function:
function GetFrameBitmap(Frame: Integer): Integer;
from tha IViaFile interface. This function is supposed to return a handle to a frame bitmap from the original sequence. The following code could work:
viaObject: IViaFile;
bmp: TBitmap;
index: Integer;
bmp.Handle := ViaObject.GetFrameBitmap(index);
But the resulting bitmap is the original frame with no alpha channel. Actually, its alpha channel is zero for the entire image.
Assuming I was doing something wrong, I tried using the GetDIBits function, to be sure there was an alpha channel somewhere. So I allocated memory long enough to store the bitmap assuming it had 4 channels and used the GetDIBits function. I got the same result as before: normal frame, alpha channel zero for the entire image.
Just to note, Inscriber (whose forums are dead), claims that its Via Builder has full alpha support. I know someone who managed to load the frames correctly, on C++, using the GetDIBits function, but "translating" the code to Delphi didn't work.
Any help would be much appreciated.
Thank you.
I suggest you take a closer look at your colleague's C++ code that supposedly works. You probably missed some detail. How much of the code was Windows API, and how much of it was some vendor-specific graphics code? The API stuff should be a cinch to translate to Delphi.
You might find that Delphi's TBitmap class doesn't support transparency, so you would need to use some other graphic-support library instead of plain old GDI. But if you're fetching the raw bitmap data as with GetDIBits, you should at least be able to see that the alpha-channel data is there. (You'd still need to find a way of displaying the bitmap properly, but at least you'd know you had the right data to start with.)