{"id":24838,"date":"2017-09-08T18:32:34","date_gmt":"2017-09-08T13:02:34","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=24838"},"modified":"2017-09-08T18:32:34","modified_gmt":"2017-09-08T13:02:34","slug":"setviewport-function-c","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/setviewport-function-c\/","title":{"rendered":"setviewport function in c"},"content":{"rendered":"<p>setviewport function sets the current viewport for graphics output.<\/p>\n<p>Declaration :- void setviewport(int left, int top, int right, int bottom, int clip);<\/p>\n<p>setviewport function is used to restrict drawing to a particular portion on the screen. For example setviewport(100 , 100, 200, 200, 1);<br \/>\nwill restrict our drawing activity inside the rectangle(100,100, 200, 200).<br \/>\nleft, top, right, bottom are the coordinates of main diagonal of rectangle in which we wish to restrict our drawing. Also note that the point (left, top) becomes the new origin.<\/p>\n<h2 id=\"c-programming-source-code-for-setviewport\">C programming source code for setviewport<\/h2>\n[pastacode lang=\u201dc\u201d manual=\u201d%23include%3Cgraphics.h%3E%0A%23include%3Cconio.h%3E%0A%20%0Amain()%0A%7B%0A%20%20%20int%20gd%20%3D%20DETECT%2C%20gm%2C%20midx%2C%20midy%3B%0A%20%0A%20%20%20initgraph(%26gd%2C%20%26gm%2C%20%22C%3A%5C%5CTC%5C%5CBGI%22)%3B%0A%20%0A%20%20%20midx%20%3D%20getmaxx()%2F2%3B%0A%20%20%20midy%20%3D%20getmaxy()%2F2%3B%0A%20%0A%20%20%20setviewport(midx%20-%2050%2C%20midy%20-%2050%2C%20midx%20%2B%2050%2C%20midy%20%2B%2050%2C%201)%3B%0A%20%20%20circle(50%2C%2050%2C%2055)%3B%0A%20%0A%20%20%20getch()%3B%0A%20%20%20closegraph()%3B%0A%20%20%20return%200%3B%0A%7D\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>setviewport function in c &#8211; c programming &#8211; setviewport function is used to restrict drawing to a particular portion on the screen. For example setviewport<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[82977,83095,75068,82980,82979,82976,82978,83096,83097,83098,76930,82975],"class_list":["post-24838","post","type-post","status-publish","format-standard","hentry","category-coding","tag-callback-function-in-c","tag-clearviewport-function-in-c","tag-function-program-in-c","tag-functions-in-c-language","tag-functions-in-c-pdf","tag-library-functions-in-c","tag-scanf-function-in-c","tag-setviewport-function-in-computer-graphics","tag-setviewport-qt","tag-setviewport-vtk","tag-string-functions-in-c","tag-types-of-functions-in-c"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/24838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=24838"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/24838\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=24838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=24838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=24838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}