Changeset 3352
 Timestamp:
 Jan 16, 2009, 3:23:23 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

libpipi/trunk/examples/storyboard.c
r3351 r3352 25 25 #include <pipi.h> 26 26 27 #define STEP 1 527 #define STEP 12 28 28 29 29 #define TWIDTH 90 … … 34 34 35 35 static int similar(uint8_t *img1, uint8_t *img2); 36 static void decorate(uint8_t *img); 36 37 37 38 int main(int argc, char *argv[]) … … 136 137 &start, &pitch); 137 138 139 decorate(start); 140 138 141 if(idx > 0) 139 142 { … … 168 171 int x, y, t, a, b, changed = 0; 169 172 170 for(y = 1; y < THEIGHT  1; y++)171 for(x = 1; x < TWIDTH  1; x++)173 for(y = 2; y < THEIGHT  2; y++) 174 for(x = 2; x < TWIDTH  2; x++) 172 175 { 173 176 int offset = y * TWIDTH * TCOLS + x; … … 211 214 } 212 215 216 static void decorate(uint8_t *img) 217 { 218 static int const hi = 200; 219 static int const lo = 50; 220 static int const mid = (hi + lo) / 2; 221 int x, y; 222 223 for(y = 0; y < THEIGHT; y++) 224 { 225 img[(y * TWIDTH * TCOLS) * 4] = hi; 226 img[(y * TWIDTH * TCOLS) * 4 + 1] = hi; 227 img[(y * TWIDTH * TCOLS) * 4 + 2] = hi; 228 img[(y * TWIDTH * TCOLS + TWIDTH  1) * 4] = lo; 229 img[(y * TWIDTH * TCOLS + TWIDTH  1) * 4 + 1] = lo; 230 img[(y * TWIDTH * TCOLS + TWIDTH  1) * 4 + 2] = lo; 231 } 232 233 for(x = 0; x < TWIDTH; x++) 234 { 235 img[x * 4] = hi; 236 img[x * 4 + 1] = hi; 237 img[x * 4 + 2] = hi; 238 img[((THEIGHT  1) * TWIDTH * TCOLS + x) * 4] = lo; 239 img[((THEIGHT  1) * TWIDTH * TCOLS + x) * 4 + 1] = lo; 240 img[((THEIGHT  1) * TWIDTH * TCOLS + x) * 4 + 2] = lo; 241 } 242 243 img[0] = (mid + hi) / 2; 244 img[1] = (mid + hi) / 2; 245 img[2] = (mid + hi) / 2; 246 247 img[(TWIDTH  1) * 4 + 0] = mid; 248 img[(TWIDTH  1) * 4 + 1] = mid; 249 img[(TWIDTH  1) * 4 + 2] = mid; 250 251 img[((THEIGHT  1) * TWIDTH * TCOLS) * 4 + 0] = mid; 252 img[((THEIGHT  1) * TWIDTH * TCOLS) * 4 + 1] = mid; 253 img[((THEIGHT  1) * TWIDTH * TCOLS) * 4 + 2] = mid; 254 255 img[((THEIGHT  1) * TWIDTH * TCOLS + TWIDTH  1) * 4 + 0] = (mid + lo) / 2; 256 img[((THEIGHT  1) * TWIDTH * TCOLS + TWIDTH  1) * 4 + 1] = (mid + lo) / 2; 257 img[((THEIGHT  1) * TWIDTH * TCOLS + TWIDTH  1) * 4 + 2] = (mid + lo) / 2; 258 } 259
Note: See TracChangeset
for help on using the changeset viewer.