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
Related
When I open the print options using AirPrint, I want to make it default to 2 copies and not just 1 copy.
Couldn't find any methods that could change the number of copies. Wondering if anyone has any ideas if this is possible since it seems that this printing option is pretty limited.
So I found my own solution. Basically under the UIPrintInteraction Controller there is a method called printItems. What I did is make an NSArray and put two copies of the object I wanted to print and used that method instead of printItem.
However, since my application used the printFormatter I was unable to use this method since in the IOS developer documentation it says
"If you set this property (printFormatter), UIPrintInteractionController sets the printingItems, printingItem, and printPageRenderer properties to nil. (Only one of these properties can be set for a print job.)"
So what I did was just doubled the html page I was formatting and I trusted that the formatting was correct for it to print two pages.
Another way would be to add the same printFormatter to page 1 and page 2 in a printPageRenderer.
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().
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);
I am working on a website created in ModX. I need to know the way I could execute a php code when any resource is created and also edit template variable associated to the created resource.
You can do this using a plugin, set to run on the OnDocFormSave event. This event has a mode property which will be set to new when the document being saved has just been created - you can do a simple check for this to prevent the plugin being run every time a document is saved.
To set a TV value for the current resource, do this:
// get the required TV object by name (or id)
$tv = $modx->getObject('modTemplateVar',array('name'=>'tvName'));
// set the new value and save it
$tv->setValue($modx->resource->get('id'), $newValue);
$tv->save();
The answer by okyanet is correct, but I've added details for those unfamiliar with MODX.
Create a plugin, and configure it to execute on the two system events 'onBeforeDocFormSave' and 'onDocFormSave'. The two events are fired just before and just after a resource is saved. When a resource is saved, the $mode variable is available to your plugin, and if it is a new resource it's value is modSystemEvent::MODE_NEW and if an update its value is modSystemEvent:MODE_UPD
I've written a gist that includes the full code with examples:
https://gist.github.com/2768300
This example shows you how to target either event through a switch statement, and how to further target the 'new' or 'update' status of the action. For intercepting and changing resource fields, its quite easy using the onBeforeDocFormSave event as you can simply change any resource fieldname with $resource->set('yourFieldname'). There is no $resource->save() required as this happens automatically after this event.
It's apparently much more difficult to save a tv using the onBeforeDocFormSave event, because of the way tvs are processed, so therefore the example shows how to update a tv using the system event 'onDocFormSave'. Again there is no $resource->save() required as tvs are saved immediately when you call 'setValue' on them.
A plugin could be made to function requiring only one of the system events, but as there are advantages to using both states as shown above, and to help explain, I have used both.
I am using the Datalogics library 9.1 and I am trying to embed an OutputIntent in a PDF I am creating so that it will be compliant with PDFA-1B.
I'm using PdDocColorConvertEmbedOutputIntent to do so and the function call is succeeding. The intent is getting in there, I can see it in Adobe Preflight. But certain PDFA verifiers still do not like what I'm creating.
I think it may be because the PDFA/s I create with this method have an outputIntent with a subtype of "GTS_PDFX" (as shown in Preflight). I believe it needs to be "GTS_PDFA". I see nowhere to specify the subtype of the output intent in the PdDocColorConvertEmbedOutputIntent parameters. This meethod seems to automatically choose the "GTS_PDFX" subtype and not allow me to choose anything else.
Basically, I'm just reading an ICC profile into pBuffer from a file, creating the profile and embedding it as below.
AC_Profile profile = NULL;
ACMakeBufferProfile(&profile,pBuffer,nSize);
PDDocColorConvertEmbedOutputIntent(m_pDoc,profile);
Am I missing something?
The 9.1 API and early versions of the 10 API have no parameter to supply to PdDocColorConvertEmbedOutputIntent () to specify the subtype. At the time of creation there was only one subtype "GTS_PDFX" and was hard coded into the API.
Manipulation at the COS layer will be necessary to affect a change to the subtype.