100 likes | 243 Views
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. Line. ‘dx’, ‘dy’ to calculate the diffrence along x and y axis ‘steps’ to calculate Loop counting
E N D
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
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
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 1st pixel at ‘x’,’y’ using ‘color’ • Loop ‘k’ 1 to steps and ‘x’+=‘xInc’, ‘y’+=‘yInc’
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)
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)
PolyGon • n no of Attributes • Set of n/2 no of lines • Filled or Open Shape • Parameters Array, and count of points
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
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
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
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