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#
  4. Purpose of Clip member in Graphics

Purpose of Clip member in Graphics

Scheduled Pinned Locked Moved C#
questiongraphicshelp
7 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.
  • B Offline
    B Offline
    baranils
    wrote on last edited by
    #1

    Hello I was trying to use a Clip to define the drawing area on a graphic Let says that I'm woking with a Graphics on a page : bound 0,0,1200,1800 I define a clip at 100,100,700,900 So the clipBound is 100,100,700,900 I was expecting that if I draw something at 0,0 on that graphics it will be 0,0 on my clip so 100,100 on my page But it remain 0,0 on the page So my question is : What is the use of a clip ? Is it really usefull for some purpose ? Thank for your help

    D 1 Reply Last reply
    0
    • B baranils

      Hello I was trying to use a Clip to define the drawing area on a graphic Let says that I'm woking with a Graphics on a page : bound 0,0,1200,1800 I define a clip at 100,100,700,900 So the clipBound is 100,100,700,900 I was expecting that if I draw something at 0,0 on that graphics it will be 0,0 on my clip so 100,100 on my page But it remain 0,0 on the page So my question is : What is the use of a clip ? Is it really usefull for some purpose ? Thank for your help

      D Offline
      D Offline
      Dr Walt Fair PE
      wrote on last edited by
      #2

      Ummm, according to the documentation a Clip "gets or sets a Region that limits the drawing region of this Graphics." Why would you think it translates coordinates?

      CQ de W5ALT

      Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

      B 1 Reply Last reply
      0
      • D Dr Walt Fair PE

        Ummm, according to the documentation a Clip "gets or sets a Region that limits the drawing region of this Graphics." Why would you think it translates coordinates?

        CQ de W5ALT

        Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

        B Offline
        B Offline
        baranils
        wrote on last edited by
        #3

        Thanks for you reply Walt "gets or sets a Region that limits the drawing region of this Graphics." Let's assume that So how that limit works ? If I set a clip as Graphics.Clip(new Region(new Rectangle(100,100,500,800)); The limited region will be 100,100,500,800 So at least if the coordinates are not translated, drawing at 0, 0 is outside the clip and I will see nothing But is seems that I can continue to draw anywhere on the original graphics

        R D 2 Replies Last reply
        0
        • B baranils

          Thanks for you reply Walt "gets or sets a Region that limits the drawing region of this Graphics." Let's assume that So how that limit works ? If I set a clip as Graphics.Clip(new Region(new Rectangle(100,100,500,800)); The limited region will be 100,100,500,800 So at least if the coordinates are not translated, drawing at 0, 0 is outside the clip and I will see nothing But is seems that I can continue to draw anywhere on the original graphics

          R Offline
          R Offline
          RichardM1
          wrote on last edited by
          #4

          You are supposed to be able to use any valid coordinate, but only the ones inside the clip bounds would be drawn on the graphic surface.

          Opacity, the new Transparency.

          B 1 Reply Last reply
          0
          • R RichardM1

            You are supposed to be able to use any valid coordinate, but only the ones inside the clip bounds would be drawn on the graphic surface.

            Opacity, the new Transparency.

            B Offline
            B Offline
            baranils
            wrote on last edited by
            #5

            You are supposed to be able to use any valid coordinate, but only the ones inside the clip bounds would be drawn on the graphic surface. That was not the result I got I will try again... Maybe the fact that I was using a TransFormMatrix on the Graphics affects the normal behaviour

            1 Reply Last reply
            0
            • B baranils

              Thanks for you reply Walt "gets or sets a Region that limits the drawing region of this Graphics." Let's assume that So how that limit works ? If I set a clip as Graphics.Clip(new Region(new Rectangle(100,100,500,800)); The limited region will be 100,100,500,800 So at least if the coordinates are not translated, drawing at 0, 0 is outside the clip and I will see nothing But is seems that I can continue to draw anywhere on the original graphics

              D Offline
              D Offline
              Dr Walt Fair PE
              wrote on last edited by
              #6

              Take a look at the example at http://msdn.microsoft.com/en-us/library/system.drawing.graphics.resetclip.aspx[^] As you mentioned in another post, perhaps the transformation is affecting the way it appears to work.

              CQ de W5ALT

              Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

              B 1 Reply Last reply
              0
              • D Dr Walt Fair PE

                Take a look at the example at http://msdn.microsoft.com/en-us/library/system.drawing.graphics.resetclip.aspx[^] As you mentioned in another post, perhaps the transformation is affecting the way it appears to work.

                CQ de W5ALT

                Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                B Offline
                B Offline
                baranils
                wrote on last edited by
                #7

                As you mentioned in another post, perhaps the transformation is affecting the way it appears to work

                Indeed ! Thank you Walt

                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