t1.c - \/t1.c Lab 4#include#include#include#include#include <assert.h> <stdint.h> <stdlib.h> <stdio.h> <math.h> void draw_circle uint8_t img unsigned int

t1.c - /t1.c Lab 4#include#include#include#include#include...

This preview shows page 1 out of 1 page.

//t1.c Lab 4 #include <assert.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <math.h> void draw_circle( uint8_t img[], unsigned int cols, unsigned int rows, int x, int y, int r, uint8_t color ) { int i, j; double xi,yj,dist; for(i = 0; i< cols; i++){ for(j = 0; j< rows;j++){ if(r > 0 ){ xi = i-x-.5; yj = j-y-.5; dist = sqrt(pow(xi,2) + pow(yj,2)); if(dist<r){ set_pixel(img, cols, rows, i,j,color);
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Winter '14
  • RichardVaughan
  • #include

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture