# BY Kamran Yousaf Line Attributes (X1, Y1, X2, Y2, Color) The Line Based on Slope Decision on the dx and dy Loop on Greater (Counter of 1) Increment of.

## Presentation on theme: "BY Kamran Yousaf Line Attributes (X1, Y1, X2, Y2, Color) The Line Based on Slope Decision on the dx and dy Loop on Greater (Counter of 1) Increment of."— Presentation transcript:

BY Kamran Yousaf Line Attributes (X1, Y1, X2, Y2, 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 ‘xInc’, ‘yInc’ 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 x2-x1,‘dy’ as y2-y1 ‘steps’ will have the greater absolute value from ‘dx’ or ‘dy’ ‘xInc’ is ‘dx’/’steps’,‘yInc’ is ‘dy’/’steps’ ‘x’ is ‘x1’ ‘y’ is ‘y1’ Plot 1 st pixel at ‘x’,’y’ using ‘color’ Loop ‘k’ 1 to steps and ‘x’+=‘xInc’, ‘y’+=‘yInc’

BY Kamran Yousaf Rectangle Attributes (X1,Y1,X2,Y2,Color) Set of four Lines Line 1(X1,Y1,X2,Y1) Line 2(X1,Y2,X2,Y2) Line 3(X1,Y1,X1,Y2) Line 4(X2,Y1,X2,Y2)

BY Kamran Yousaf Button Set of 8 Lines Line 1(X1,Y1,X2,Y1, Silver) Line 2(X1,Y2,X2,Y2, Black) Line 3(X1,Y1,X1,Y2,Silver) Line 4(X2,Y1,X2,Y2, Black) Line 5(X1+1,Y1+1,X2-1,Y1+1, White) Line 6(X1+1,Y2-1,X2-1,Y2-1,Gray) Line 7(X1+1,Y1+1,X1+1,Y2-1,White) Line 8(X2-1,Y1+1,X2-1,Y2-1, Gray)

BY Kamran Yousaf PolyGon 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,startAngle, endAngle, 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

Download ppt "BY Kamran Yousaf Line Attributes (X1, Y1, X2, Y2, Color) The Line Based on Slope Decision on the dx and dy Loop on Greater (Counter of 1) Increment of."

Similar presentations