Rev 1555 | Rev 1709 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1555 | Rev 1673 | ||
---|---|---|---|
Line 82... | Line 82... | ||
82 | * @param putpixel Putpixel function used to print bitmap |
82 | * @param putpixel Putpixel function used to print bitmap |
83 | */ |
83 | */ |
84 | int ppm_draw(unsigned char *data, size_t datasz, unsigned int sx, |
84 | int ppm_draw(unsigned char *data, size_t datasz, unsigned int sx, |
85 | unsigned int sy, |
85 | unsigned int sy, |
86 | unsigned int maxwidth, unsigned int maxheight, |
86 | unsigned int maxwidth, unsigned int maxheight, |
87 | void (*putpixel)(int,unsigned int, unsigned int, int),int vp) |
87 | putpixel_cb_t putpixel,void *vport) |
88 | { |
88 | { |
89 | unsigned int width, height; |
89 | unsigned int width, height; |
90 | unsigned int maxcolor; |
90 | unsigned int maxcolor; |
91 | int i; |
91 | int i; |
92 | void *maxdatap = data + datasz; |
92 | void *maxdatap = data + datasz; |
Line 119... | Line 119... | ||
119 | data += 3; |
119 | data += 3; |
120 | continue; |
120 | continue; |
121 | } |
121 | } |
122 | color = ((data[0]*coef) << 16) + ((data[1]*coef) << 8) + data[2]*coef; |
122 | color = ((data[0]*coef) << 16) + ((data[1]*coef) << 8) + data[2]*coef; |
123 | 123 | ||
124 | (*putpixel)(vp, sx+(i % width), sy+(i / width), color); |
124 | (*putpixel)(vport, sx+(i % width), sy+(i / width), color); |
125 | data += 3; |
125 | data += 3; |
126 | } |
126 | } |
127 | } |
127 | } |