Obtaining straightline pixels

I have two coordinates like (x1,y1) and (x2,y2). now i want to draw a straight line between them and want to get all the pixels on it. how can i do it?? can anyone help me please...:confused::confused: