I need to draw line.
My putpixel function is
void pixel(unsigned long colour, unsigned short posX, unsigned short posY) {
video[posY * 1024 + posX] = colour;
}
Please help. If you can then write source code.

Code: Select all
//Draw Horizontal Line:
void h_line(int Yval, int start_Xval, int width, char color)
{
int END_Xval = start_Xval + width; /*set our ending pixel as WIDTH+STARTING PIXEL */
while (start_Xval <= END_XVal) /*while the current pixel is less than or equal to the ending X value */
{
pixel(color, Xval, start_Yval); //draw the pixel
start_Xval++; //increase our current X pixel by one.
}
return; //done
}
Was he specifically requesting source code, or was he asking if anyone knew how? There's nothing wrong with saying "Can someone please tell me how to draw a line using xxx pixel-drawing function?" What isn't OK would be to say "Give me some source code for drawing a line using xxx pixel-drawing function!!!"@areo: pls refrain from source code requests. State what your problem is or what doesn't work. We are not your coding slaves.