Direct2D C++ the easiest way to draw bottom half of an ellipse












0














I want to draw the bottom half of an ellipse. it better be portable. I would like to group several drawing commands in function and draw it in many places.


It would be better if not using bitmap kind of thing. I'd like the geometry cover less things as possible. Plus, it is more complicated. Still, it would be acceptable.

I am using C++ VS17 on Win10










share|improve this question





























    0














    I want to draw the bottom half of an ellipse. it better be portable. I would like to group several drawing commands in function and draw it in many places.


    It would be better if not using bitmap kind of thing. I'd like the geometry cover less things as possible. Plus, it is more complicated. Still, it would be acceptable.

    I am using C++ VS17 on Win10










    share|improve this question



























      0












      0








      0







      I want to draw the bottom half of an ellipse. it better be portable. I would like to group several drawing commands in function and draw it in many places.


      It would be better if not using bitmap kind of thing. I'd like the geometry cover less things as possible. Plus, it is more complicated. Still, it would be acceptable.

      I am using C++ VS17 on Win10










      share|improve this question















      I want to draw the bottom half of an ellipse. it better be portable. I would like to group several drawing commands in function and draw it in many places.


      It would be better if not using bitmap kind of thing. I'd like the geometry cover less things as possible. Plus, it is more complicated. Still, it would be acceptable.

      I am using C++ VS17 on Win10







      direct2d






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 at 13:32

























      asked Nov 20 at 13:13









      miehmg

      34




      34
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Create path geometry, then do Open()->sink->AddArc() (twice with appropriate parameters)->Close(). Now you have your geometry that you can draw.






          share|improve this answer





















          • I did that and get what I wanted. but this is not portable, right? although you can store the geometry, it's position is fixed when created.
            – miehmg
            Nov 21 at 0:36










          • Geometry is immutable, that's correct. To draw it at different coordinates you can use target/context transform around Draw*() call. I don't know what you mean by portable though.
            – bunglehead
            Nov 21 at 4:14










          • I group it into a function like drawHouse() in which I draw the geometry. but I need to draw house at many coordinates. before this answer, I pass the coordinates into the function and draw it there using run-time parameters. But I am concerned about whether this method will take more time and resources. As what I see in the msdn example, they store brushes, bitmaps etc. So I wonder if I can create a geometry and save it so that next time I draw it, it is more efficient.
            – miehmg
            Nov 23 at 13:53












          • Sure, if it's possible to create it once, you should do that. To draw it at different coordinates use SetTransform() on target/context you're using to add offset you need.
            – bunglehead
            Nov 23 at 16:05











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393810%2fdirect2d-c-the-easiest-way-to-draw-bottom-half-of-an-ellipse%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Create path geometry, then do Open()->sink->AddArc() (twice with appropriate parameters)->Close(). Now you have your geometry that you can draw.






          share|improve this answer





















          • I did that and get what I wanted. but this is not portable, right? although you can store the geometry, it's position is fixed when created.
            – miehmg
            Nov 21 at 0:36










          • Geometry is immutable, that's correct. To draw it at different coordinates you can use target/context transform around Draw*() call. I don't know what you mean by portable though.
            – bunglehead
            Nov 21 at 4:14










          • I group it into a function like drawHouse() in which I draw the geometry. but I need to draw house at many coordinates. before this answer, I pass the coordinates into the function and draw it there using run-time parameters. But I am concerned about whether this method will take more time and resources. As what I see in the msdn example, they store brushes, bitmaps etc. So I wonder if I can create a geometry and save it so that next time I draw it, it is more efficient.
            – miehmg
            Nov 23 at 13:53












          • Sure, if it's possible to create it once, you should do that. To draw it at different coordinates use SetTransform() on target/context you're using to add offset you need.
            – bunglehead
            Nov 23 at 16:05
















          0














          Create path geometry, then do Open()->sink->AddArc() (twice with appropriate parameters)->Close(). Now you have your geometry that you can draw.






          share|improve this answer





















          • I did that and get what I wanted. but this is not portable, right? although you can store the geometry, it's position is fixed when created.
            – miehmg
            Nov 21 at 0:36










          • Geometry is immutable, that's correct. To draw it at different coordinates you can use target/context transform around Draw*() call. I don't know what you mean by portable though.
            – bunglehead
            Nov 21 at 4:14










          • I group it into a function like drawHouse() in which I draw the geometry. but I need to draw house at many coordinates. before this answer, I pass the coordinates into the function and draw it there using run-time parameters. But I am concerned about whether this method will take more time and resources. As what I see in the msdn example, they store brushes, bitmaps etc. So I wonder if I can create a geometry and save it so that next time I draw it, it is more efficient.
            – miehmg
            Nov 23 at 13:53












          • Sure, if it's possible to create it once, you should do that. To draw it at different coordinates use SetTransform() on target/context you're using to add offset you need.
            – bunglehead
            Nov 23 at 16:05














          0












          0








          0






          Create path geometry, then do Open()->sink->AddArc() (twice with appropriate parameters)->Close(). Now you have your geometry that you can draw.






          share|improve this answer












          Create path geometry, then do Open()->sink->AddArc() (twice with appropriate parameters)->Close(). Now you have your geometry that you can draw.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 22:46









          bunglehead

          6231617




          6231617












          • I did that and get what I wanted. but this is not portable, right? although you can store the geometry, it's position is fixed when created.
            – miehmg
            Nov 21 at 0:36










          • Geometry is immutable, that's correct. To draw it at different coordinates you can use target/context transform around Draw*() call. I don't know what you mean by portable though.
            – bunglehead
            Nov 21 at 4:14










          • I group it into a function like drawHouse() in which I draw the geometry. but I need to draw house at many coordinates. before this answer, I pass the coordinates into the function and draw it there using run-time parameters. But I am concerned about whether this method will take more time and resources. As what I see in the msdn example, they store brushes, bitmaps etc. So I wonder if I can create a geometry and save it so that next time I draw it, it is more efficient.
            – miehmg
            Nov 23 at 13:53












          • Sure, if it's possible to create it once, you should do that. To draw it at different coordinates use SetTransform() on target/context you're using to add offset you need.
            – bunglehead
            Nov 23 at 16:05


















          • I did that and get what I wanted. but this is not portable, right? although you can store the geometry, it's position is fixed when created.
            – miehmg
            Nov 21 at 0:36










          • Geometry is immutable, that's correct. To draw it at different coordinates you can use target/context transform around Draw*() call. I don't know what you mean by portable though.
            – bunglehead
            Nov 21 at 4:14










          • I group it into a function like drawHouse() in which I draw the geometry. but I need to draw house at many coordinates. before this answer, I pass the coordinates into the function and draw it there using run-time parameters. But I am concerned about whether this method will take more time and resources. As what I see in the msdn example, they store brushes, bitmaps etc. So I wonder if I can create a geometry and save it so that next time I draw it, it is more efficient.
            – miehmg
            Nov 23 at 13:53












          • Sure, if it's possible to create it once, you should do that. To draw it at different coordinates use SetTransform() on target/context you're using to add offset you need.
            – bunglehead
            Nov 23 at 16:05
















          I did that and get what I wanted. but this is not portable, right? although you can store the geometry, it's position is fixed when created.
          – miehmg
          Nov 21 at 0:36




          I did that and get what I wanted. but this is not portable, right? although you can store the geometry, it's position is fixed when created.
          – miehmg
          Nov 21 at 0:36












          Geometry is immutable, that's correct. To draw it at different coordinates you can use target/context transform around Draw*() call. I don't know what you mean by portable though.
          – bunglehead
          Nov 21 at 4:14




          Geometry is immutable, that's correct. To draw it at different coordinates you can use target/context transform around Draw*() call. I don't know what you mean by portable though.
          – bunglehead
          Nov 21 at 4:14












          I group it into a function like drawHouse() in which I draw the geometry. but I need to draw house at many coordinates. before this answer, I pass the coordinates into the function and draw it there using run-time parameters. But I am concerned about whether this method will take more time and resources. As what I see in the msdn example, they store brushes, bitmaps etc. So I wonder if I can create a geometry and save it so that next time I draw it, it is more efficient.
          – miehmg
          Nov 23 at 13:53






          I group it into a function like drawHouse() in which I draw the geometry. but I need to draw house at many coordinates. before this answer, I pass the coordinates into the function and draw it there using run-time parameters. But I am concerned about whether this method will take more time and resources. As what I see in the msdn example, they store brushes, bitmaps etc. So I wonder if I can create a geometry and save it so that next time I draw it, it is more efficient.
          – miehmg
          Nov 23 at 13:53














          Sure, if it's possible to create it once, you should do that. To draw it at different coordinates use SetTransform() on target/context you're using to add offset you need.
          – bunglehead
          Nov 23 at 16:05




          Sure, if it's possible to create it once, you should do that. To draw it at different coordinates use SetTransform() on target/context you're using to add offset you need.
          – bunglehead
          Nov 23 at 16:05


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393810%2fdirect2d-c-the-easiest-way-to-draw-bottom-half-of-an-ellipse%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin