Proper syntax of Direct2D Chroma-Key effect - direct2d

I'm trying to implement a Croma-Key effect on a bitmap, and i'm following the page: https://msdn.microsoft.com/en-us/library/windows/desktop/dn890715(v=vs.85).aspx
first i noticed the syntax was incorrect in the implementation of an array as an argument, when i fixed this, the proper way to get the processed image was incorrect and needed some poling around to solve, in the end, i'm still unable to find what m_d2dContext is. i would assume it's the ID2D1HwndRenderTarget but the intelesense says there's no method definition for: CreateEffect i was wondering if anyone has had success with this, and could show and explain their code.

I do, as I already replied to the same question you posted 4 days ago: what's the proper implementation of the Chroma-key Effect in Microsoft visual studio c++?

Related

Processing Movie background change

I had another question about processing and a project i'm making. I would like to play a movie in a loop on the background. I managed to do this by initializing a Movie and putting it in an image the size of my app. But now I would like to load in multiple movies and add a button to change the background when pressed with the leap motion. Is this possible ? Or should I use a different library for this ?
Thanks in advance!
Kind regards,
DarthSwedo
It's really hard to answer general "how do I do this" type questions. Stack Overflow is designed more for specific "I tried X, expected Y, but got Z instead" type questions. You'll have much better luck if you just try something and post an MCVE if you get stuck.
That being said, I'm going to try to clear up some of the general confusion you seem to have.
Step 1: You need to figure out what library or libraries you're using. In all of your questions, you seem to not be sure which library you're using. Which Leap Motion library are you using? How did you set it up? Where is its documentation? You say you're using a Movie class. Where is that coming from? Are you sure it's not from the Video library?
If you have more specific questions in the future, please provide this information. We can't really help you without it. But more importantly, you need to know the answers to these questions if any of this is ever going to make any sense.
Step 2: Read the documentation for those libraries. Processing comes with the reference. The Video library comes with its own documentation page. I'm sure whatever Leap Motion library you're using has something similar. You need to read about the functions available to you. That's a huge part of programming. Right now your question is just asking whether something possible, and the honest answer to that is, well, what happened when you googled it?
Step 3: Try something. After you read through the documentation, just try something. Write some code based on the examples in the documentation. Even if that code doesn't work, that's okay, because then you can use it as an MCVE and ask a more specific question.
Good luck.

How to identify visual studio symbols?

I'm new to the use of MVS, I'm used with the symbols in Eclipse since I programm java already. My question is, where can I find a guideline to identify which code the IDE is suggesting?
For example: BlendAdd has a white symbol that I dont know what does that means (if its a member function, data or whatever)..To blend mode there is another symbol, for Circle shape another and so on.
In eclipse I know the difference just looking what is a method or a constant. This is a completely beginner question but since yesterday I didn't find anything to clearfy my mind cos maybe I'm searching for the wrong concept.
Thanks in advance for the support
There is a page on MSDN that explains all of it, http://msdn.microsoft.com/en-us/library/y47ychfe%28v=vs.110%29.aspx
- constant
- enum
- class

On the use of of Internal`Bag, and any official documentation?

(Mathematica version: 8.0.4)
lst = Names["Internal`*"];
Length[lst]
Pick[lst, StringMatchQ[lst, "*Bag*"]]
gives
293
{"Internal`Bag", "Internal`BagLength", "Internal`BagPart", "Internal`StuffBag"}
The Mathematica guidebook for programming By Michael Trott, page 494 says on the Internal context
"But similar to Experimental` context, no guarantee exists that the behavior and syntax of the functions will still be available in later versions of Mathematica"
Also, here is a mention of Bag functions:
Implementing a Quadtree in Mathematica
But since I've seen number of Mathematica experts here suggest Internal`Bag functions and use them themselves, I am assuming it would be sort of safe to use them in actual code? and if so, I have the following question:
Where can I find a more official description of these functions (the API, etc..) like one finds in documenation center? There is nothing now about them now
??Internal`Bag
Internal`Bag
Attributes[Internal`Bag]={Protected}
If I am to start using them, I find it hard to learn about new functions by just looking at some examples and trial and error to see what they do. I wonder if someone here might have a more complete and self contained document on the use of these, describe the API and such more than what is out there already or a link to such place.
The Internal context is exactly what its name says: Meant for internal use by Wolfram developers.
This means, among other things, the following things hold about anything you might find in there:
You most likely won't be able to find any official documentation on it, as it's not meant to be used by the public.
It's not necessarily as robust about invalid arguments. (Crashing the kernel can easily happen on some of them.)
The API may change without notice.
The function may disappear completely without notice.
Now, in practice some of them may be reasonably stable, but I would strongly advise you to steer away from them. Using undocumented APIs can easily leave you in for a lot of pain and a nasty surprise in the future.

Cannot evaluate expression error in ONE project for years

Just tired to see this error every time for years only in ONE project: "Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized"
Almost every property or field displays this message. From vs2005+.net2.0 to vs2008+.net3.5 now. Does anybody know how to fix it?
This is the same problem as this StackOverfow question. In that case it seems to be an inbuilt limit to the size of structs used within the method. The answer here provides links to two discussions of the issue.

The field must have a documentation header - Style Cop - Code smell?

I was just running style cop against some of my code and got a few:
SA1600: The field must have a documentation header.
Now don't get me wrong I like style cop, it's great when you work on a project with more then one person but this rule seems a bit excessive to me. Why would you want to add:
/// <summary>
/// blah blah blah
/// </summary>
to the top of every variable. I'm pretty sure that I remember someone saying(Martin Fowler, Kent Beck..can't really remember ATM) that comment should say "why" not "what" and I really can't see how you can explain why on a variable.
I also find code that has comments on every variable harder to read because all you see is fluff.
My thoughts are if you have to explain what every variable is then you are really failing in terms of naming.
Does anyone else find commenting variables a bit of a code smell or is it just me.
This is quite an old post but came across it while searching for a solution to this issue myself, so though I would offer a solution.
If you open your Settings.StyleCop file in the rules editor, select the Documentation Rules node, then in the Detailed settings section on the right de-select the Include fields option. Now you will no longer be required to document fields.
I wouldn't say that commenting a variable is always a code smell (and it doesn't sound like that's what you're saying, either). I do agree that commenting every single variable, every single time is at the very least excessive, and possibly indicative of poor naming. In fact, some would argue that any comment is a code smell, and that descriptive names and short routines are more readable and prevent the situation where code has been changed, but the comments haven't been updated (which has certainly bitten me in a few legacy code bases). I don't think I'd take it quite that far, but if you can write code that is self-explanatory without extra explanation, that does seem preferable.
So yeah, basically what you said.
XML Comments are slightly different than other comments.
If you set things up correctly, you can have them appear in tool tips in Visual Studio AND use them to create MSDN style documentation with Sand Castle. I think they should tell you what the thingy is doing when you don't have access to the source code.
The point is that these comments can appear without the source code that they are commenting. They should be helpful to another devloper who can't see your code and could care less how you are doing things.
I don't know about the "Cop" tool you are using, but it would be nice to have a way of signaling the tool that intend to leave a param blank. So:
/// <param name="fubar"></param> // Haven't gotten around to it
/// <param name="portNumber" /> // I intend this parameter to have no help
I have worked on projects where we have to fill everything in and we get things like:
/// <param name="portNumber">The Port Number</param> // What else could it be?
If you don't want to use the features above, go ahead turn off the Style Cop rule.
Totally agree and the first thing I turned off in StyleCop. If you need to explain it, you have named it in a fashion which needs explanation and have failed in making the code self documenting.
For those that still come across this issue, this post how-to-change-a-stylecop-rule actually has the perfect answer.
You should try GhosDoc is an easy way to have documentation automated for every code member on your application. Just install it, right click on the member and select document this!
I think the correct answer here is "it depends." You can certainly explain the "why" of a variable being marked static/const, or business logic/restrictions on the variable's contents. Having said that, I agree that seeing every variable comment impedes readability and can indicate blindly following a standard or improper naming.

Resources