Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. GDI+ concern???????

GDI+ concern???????

Scheduled Pinned Locked Moved C / C++ / MFC
graphicswinformshelpquestion
14 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T TooShy2Talk

    SandipG :) wrote: Why dont you create a stitched bitmap first and then draw this bitmap on device context. i mean Graphics gr(bmpTemp) .... Stitching code. Graphics gr(hDC) RatateTransform()... DrawImage(bmpTemp).. Does it make sense?? Regards, Sandip. I received a reply from Sandip but I'm having hard time translating it to code. The process is what i needed it's just that I can't make it work. First I haven't found a constructor for Graphics gr(bmpTemp) and for function DrawImage(bmpTemp).. I'm not that good in GDI so I hope somebody can help me. It will be a big help if you reply. Thanks.

    C Offline
    C Offline
    CPallini
    wrote on last edited by
    #2

    TooShy2Talk wrote:

    Graphics gr(bmpTemp)

    (One overload of )The Graphics constructor accepts a pointer to a CImage object. DrawImage (as well as RotateTransform) is a method of the Graphics class. :)

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
    [My articles]

    T 2 Replies Last reply
    0
    • C CPallini

      TooShy2Talk wrote:

      Graphics gr(bmpTemp)

      (One overload of )The Graphics constructor accepts a pointer to a CImage object. DrawImage (as well as RotateTransform) is a method of the Graphics class. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      T Offline
      T Offline
      TooShy2Talk
      wrote on last edited by
      #3

      But how will I declare bmpTemp? ????????? Graphics gr(bmpTemp) I'm confused on how will I declare this one. Can yu please show. Thank you.

      S 1 Reply Last reply
      0
      • C CPallini

        TooShy2Talk wrote:

        Graphics gr(bmpTemp)

        (One overload of )The Graphics constructor accepts a pointer to a CImage object. DrawImage (as well as RotateTransform) is a method of the Graphics class. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        T Offline
        T Offline
        TooShy2Talk
        wrote on last edited by
        #4

        I have tried Image *bmpTemp; Graphics gr(bmpTemp); .... stitching here but result to following error, bmpTemp is being used without being defined. I don't really know how to implement it.

        C 1 Reply Last reply
        0
        • T TooShy2Talk

          But how will I declare bmpTemp? ????????? Graphics gr(bmpTemp) I'm confused on how will I declare this one. Can yu please show. Thank you.

          S Offline
          S Offline
          SandipG
          wrote on last edited by
          #5

          Did you look at the link i gave. It shows a graphics constructor which accepts Image class object as a parameter. Bitmap class is derived from the Image class. So when you will pass the Bitmap object to the graphics constructor it would invoke that constructor. Now declaration of bitmap. You can simply create a canvas bitmap which will hold your other bitmaps someting like this. Bitmap *bmpTemp = new Bitmap(iWidth,iHeight); Is it clear now???

          Regards, Sandip.

          1 Reply Last reply
          0
          • T TooShy2Talk

            I have tried Image *bmpTemp; Graphics gr(bmpTemp); .... stitching here but result to following error, bmpTemp is being used without being defined. I don't really know how to implement it.

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #6

            For instance

            CImage bmpTemp;
            bmpTemp.Create(640,400,32);
            Graphics gr(& bmpTemp); // please note the ampersand

            Bitmap bmpTemp(640,400, PixelFormat32bppRGB);
            Graphics gr(& bmpTemp);

            Did you follow the link provided by Sandip? Have you a good C++ tutorial? :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            modified on Tuesday, September 9, 2008 4:41 AM

            T 2 Replies Last reply
            0
            • C CPallini

              For instance

              CImage bmpTemp;
              bmpTemp.Create(640,400,32);
              Graphics gr(& bmpTemp); // please note the ampersand

              Bitmap bmpTemp(640,400, PixelFormat32bppRGB);
              Graphics gr(& bmpTemp);

              Did you follow the link provided by Sandip? Have you a good C++ tutorial? :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              modified on Tuesday, September 9, 2008 4:41 AM

              T Offline
              T Offline
              TooShy2Talk
              wrote on last edited by
              #7

              Yes, I have tried also CImage bmpTemp; but there is no intellisense for .Create() bmpTemp.Create(); I have tried including altimage.h but it comflicts to other class I'm using. Or is there other header to include?

              S C 2 Replies Last reply
              0
              • T TooShy2Talk

                Yes, I have tried also CImage bmpTemp; but there is no intellisense for .Create() bmpTemp.Create(); I have tried including altimage.h but it comflicts to other class I'm using. Or is there other header to include?

                S Offline
                S Offline
                SandipG
                wrote on last edited by
                #8

                TooShy2Talk wrote:

                CImage bmpTemp;

                I dont know if CImage is derived from Image. But you can use

                Image *bmpTemp = new Image(iWidth,iHeight);

                Did you try this?? I don't know why are you facing so much trouble in this Previously you were using hDC directly to draw your bitmaps on. Now you just have to replace this hDC with temporary bitmap.. and once you finish all your operations do following

                Graphics gr(hDC);
                gr.RotateTransform(..);
                gr.DrawImage(bmpTemp);

                Is it clear?

                Regards, Sandip.

                T 1 Reply Last reply
                0
                • S SandipG

                  TooShy2Talk wrote:

                  CImage bmpTemp;

                  I dont know if CImage is derived from Image. But you can use

                  Image *bmpTemp = new Image(iWidth,iHeight);

                  Did you try this?? I don't know why are you facing so much trouble in this Previously you were using hDC directly to draw your bitmaps on. Now you just have to replace this hDC with temporary bitmap.. and once you finish all your operations do following

                  Graphics gr(hDC);
                  gr.RotateTransform(..);
                  gr.DrawImage(bmpTemp);

                  Is it clear?

                  Regards, Sandip.

                  T Offline
                  T Offline
                  TooShy2Talk
                  wrote on last edited by
                  #9

                  SandipG :) wrote:

                  But you can use Image *bmpTemp = new Image(iWidth,iHeight);

                  I received an error on this, I think there is no constructor available.

                  S 1 Reply Last reply
                  0
                  • C CPallini

                    For instance

                    CImage bmpTemp;
                    bmpTemp.Create(640,400,32);
                    Graphics gr(& bmpTemp); // please note the ampersand

                    Bitmap bmpTemp(640,400, PixelFormat32bppRGB);
                    Graphics gr(& bmpTemp);

                    Did you follow the link provided by Sandip? Have you a good C++ tutorial? :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    modified on Tuesday, September 9, 2008 4:41 AM

                    T Offline
                    T Offline
                    TooShy2Talk
                    wrote on last edited by
                    #10

                    I have successfully created the following lines

                    CPallini wrote:

                    CImage bmpTemp; bmpTemp.Create(640,400,32);

                    But encountered an error on the line below.

                    CPallini wrote:

                    Graphics gr(& bmpTemp);

                    Error is "Cannot convert CImage* to HDC".

                    1 Reply Last reply
                    0
                    • T TooShy2Talk

                      SandipG :) wrote:

                      But you can use Image *bmpTemp = new Image(iWidth,iHeight);

                      I received an error on this, I think there is no constructor available.

                      S Offline
                      S Offline
                      SandipG
                      wrote on last edited by
                      #11

                      TooShy2Talk wrote:

                      Image *bmpTemp = new Image(iWidth,iHeight);

                      I am nt sure if constructor is available for the Image class but it is surely there for Bitmap. What is the problem you facing in following code.

                      Bitmap *bmpTemp = new Bitmap(iWidth,iHeight);
                      Graphics gr(bmpTemp);

                      If you still have problems Please Look at this section on CP GDI+[^] I hope it will help you..

                      Regards, Sandip.

                      modified on Tuesday, September 9, 2008 4:40 AM

                      1 Reply Last reply
                      0
                      • T TooShy2Talk

                        Yes, I have tried also CImage bmpTemp; but there is no intellisense for .Create() bmpTemp.Create(); I have tried including altimage.h but it comflicts to other class I'm using. Or is there other header to include?

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #12

                        You're right: I made confusion, I'm sorry about. I've modified my previous post. Hope it helps. :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        T 1 Reply Last reply
                        0
                        • C CPallini

                          You're right: I made confusion, I'm sorry about. I've modified my previous post. Hope it helps. :)

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          T Offline
                          T Offline
                          TooShy2Talk
                          wrote on last edited by
                          #13

                          Finally, it WORKS. Thank you very much. It's a big help. Till my next question. :laugh: :laugh:

                          C 1 Reply Last reply
                          0
                          • T TooShy2Talk

                            Finally, it WORKS. Thank you very much. It's a big help. Till my next question. :laugh: :laugh:

                            C Offline
                            C Offline
                            CPallini
                            wrote on last edited by
                            #14

                            I'm very sorry for the delay due to my mistakes. :)

                            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                            [My articles]

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups