Drawing Line that has different colors for each points

Hello, I am developing a project to transfer an image from computer to microcontroller(stm32f7 disco) via UDP. I want to complete the image line by line. I will move the line position too.
My question is how can I create a line that has different colors for every pixel. For example I wanna draw a straight but each point has its own pixel.
Note : I could make one example with canvas but it not moving. That is why I cant create image.