Line Attributes X 1 Y 1 X 2
Line Attributes (X 1, Y 1, X 2, Y 2, Color) The Line Based on Slope Decision on the dx and dy Loop on Greater (Counter of 1) Increment of other (Slope) Plot Pixels in the loop BY Kamran Yousaf
Line ‘dx’, ‘dy’ to calculate the diffrence along x and y axis ‘steps’ to calculate Loop counting ‘x. Inc’, ‘y. Inc’ to calculate the Difference covered in each step ‘x’ , ‘y’ to store current pixel position ‘i’ as a loop variable BY Kamran Yousaf
Line Calculate ‘dx’ as x 2 -x 1, ‘dy’ as y 2 -y 1 ‘steps’ will have the greater absolute value from ‘dx’ or ‘dy’ ‘x. Inc’ is ‘dx’/’steps’ , ‘y. Inc’ is ‘dy’/’steps’ ‘x’ is ‘x 1’ ‘y’ is ‘y 1’ Plot 1 st pixel at ‘x’, ’y’ using ‘color’ Loop ‘k’ 1 to steps and ‘x’+=‘x. Inc’, ‘y’+=‘y. Inc’ BY Kamran Yousaf
Rectangle Attributes (X 1, Y 1, X 2, Y 2, Color) Set of four Lines Line 1(X 1, Y 1, X 2, Y 1) Line 2(X 1, Y 2, X 2, Y 2) Line 3(X 1, Y 1, X 1, Y 2) Line 4(X 2, Y 1, X 2, Y 2) BY Kamran Yousaf
Button Set of 8 Lines Line 1(X 1, Y 1, X 2, Y 1, Silver) Line 2(X 1, Y 2, X 2, Y 2, Black) Line 3(X 1, Y 1, X 1, Y 2, Silver) Line 4(X 2, Y 1, X 2, Y 2, Black) Line 5(X 1+1, Y 1+1, X 2 -1, Y 1+1, White) Line 6(X 1+1, Y 2 -1, X 2 -1, Y 2 -1, Gray) Line 7(X 1+1, Y 1+1, X 1+1, Y 2 -1, White) Line 8(X 2 -1, Y 1+1, X 2 -1, Y 2 -1, Gray) BY Kamran Yousaf
Poly. Gon n no of Attributes Set of n/2 no of lines Filled or Open Shape Parameters Array, and count of points BY Kamran Yousaf
Circle Attributes ( xc, yc, radius, color) ‘x’, ‘y’ as current points ‘i’ to run loop 0 to 360 ‘x’ is calculated as xc+radius*cos(rad) ‘y’ is calculated as yc+radius*sin(rad) Where rad is PI*deg/180 BY Kamran Yousaf
Arc Attributes ( xc, yc, radius, start. Angle, end. Angle , color) ‘x’, ‘y’ as current points ‘i’ to run loop start to end ‘x’ is calculated as xc+radius*cos(rad) ‘y’ is calculated as yc+radius*sin(rad) Where rad is PI*deg/180 BY Kamran Yousaf
Ellipse Attributes ( xc, yc, Xradius, Yradius, color) ‘x’, ‘y’ as current points ‘i’ to run loop 0 to 360 ‘x’ is calculated as xc+Xradius*cos(rad) ‘y’ is calculated as yc+Yradius*sin(rad) Where rad is PI*deg/180 BY Kamran Yousaf
Elliptical Arc Attributes ( xc, yc, Xradius, Yradius, start, end, color) ‘x’, ‘y’ as current points ‘i’ to run loop start to end ‘x’ is calculated as xc+Xradius*cos(rad) ‘y’ is calculated as yc+Yradius*sin(rad) Where rad is PI*deg/180 BY Kamran Yousaf
- Slides: 10