I cannot seem to find an appropriate API call.
Thanks,
...Matt
=?Utf-8?B?TWF0dCBIb3VzZXI=?= <MattH...@discussions.microsoft.com> spake the secret code
<7578FE24-C035-4535...@microsoft.com> thusly:
>How can I draw an ID2D1Bitmap object to a ID2D1RenderTarget in an xor fashion?
Are you trying to do rubber banding?
In GDI you would do this using xor with the old position of the
rubber-banded geometry and then xor the new position.
In a GPU accelerated environment, you just clear the back buffer and
render the whole scene again.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>
Legalize Adulthood! <http://legalizeadulthood.wordpress.com>
> Are you trying to do rubber banding?
>
> In GDI you would do this using xor with the old position of the
> rubber-banded geometry and then xor the new position.
>
> In a GPU accelerated environment, you just clear the back buffer and
> render the whole scene again.
No, I am not trying to rubberband.
I have many elements on-screen of varying colours. In our GDI
implementation, in order for certain elements on "stick out" and not blend
into the background, we do an xor border around the element. This way, the
border will always be seen.
How can I accomplish the same using Direct2D?
...Matt
=?Utf-8?B?TWF0dCBIb3VzZXI=?= <MattH...@discussions.microsoft.com> spake the secret code
<06B58182-8FD8-4E04...@microsoft.com> thusly:
>I have many elements on-screen of varying colours. In our GDI
>implementation, in order for certain elements on "stick out" and not blend
>into the background, we do an xor border around the element. This way, the
>border will always be seen.
>
>How can I accomplish the same using Direct2D?
Can you post a link to a screen shot of what your existing app does so
I can see the visual result?
You'll notice that the triangle and circle are surrounded by a noticable
border regardless of the colour the user chooses for the background. As
well, if there are any other objects below the triangle or circle (like the
black line), the border does not get obscured by those objects. The triangle
and circle is always noticable to the user.
...Matt
=?Utf-8?B?TWF0dCBIb3VzZXI=?= <MattH...@discussions.microsoft.com> spake the secret code
<E6F13566-2576-4B0F...@microsoft.com> thusly:
There are a couple of choices here that you could try.
First, you could try using a GDI DC on the render target, but that's
going to be slow due to the nature of GDI.
Second, you could draw the border as stipple pattern of alternating
white and black pixels so that the border would be visible. This is
what most drawing programs like Photoshop do to indicate a selection
boundary while ensuring contrast against an arbitrary background.
So in summary, there's no way to xor using Direct2D. So we'll have to find
alternatives. I can work with that.
Is it technically difficult to xor using hardware, or was it a design
decision that Direct2D not support it? Is it possible that it may be added
in the future? I just would like to know why it's not supported so I can
explain it to people who will ask.
Thanks,
...Matt
On everage, a good approximation of XOR can be obtained
by programming the blend-mode of the output-merger-state so that it does
an inversion of the destination with 0 contribution from the source
(called DestInvert mode).
Changing the output merger in the middle of an arbitrary
batch of drawing operations may have undefined results
(based upon triangle culling rules, Z-buffers, and other tricks that
you can use to implement 2D on top of a 3D pipeline).
GDI interop, as already recommended, seems the most feasible
approach. That operation may even be partially hadware
accelerated on WDDM 1.1 drivers on Win7.
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Matt Houser" <MattH...@discussions.microsoft.com> wrote in message
news:8FAF7BE2-38D9-4822...@microsoft.com...