/************************************************************************/ /* Draw sixteen boxes using pixel write */ /************************************************************************/ pixel_box16() { #define MONO 5 #define VMONO 7 #define COLOR 4 #define ENHANCED 3 #define VCOLOR 8 int box, i, j, color, x, y; int type; /* Get display type and select mode accordingly */ type = get_display_type(); /* Get display type */ switch (type) /* Set mode according to*/ { /* type of display */ case VMONO: case MONO: set_mode(0x0F); break; case COLOR: set_mode(0x0E); break; case VCOLOR: case ENHANCED: default: set_mode(0x10); break; } /* Draw boxes using SET/RESET write mode */ printf("Drawing pixels using mode 0, SET/RESET method"); for (box = 0; box < 16; box++) /* Loop over boxes */ for (j = 0; j < 10; j++) /* Loop over rasters */ /* within box */ for (i = 0; i < 100; i++) /* Loop over pixels */ { /* within raster */ x = i; /* Set x */ y = j + 10 * box; /* Compute y */ color = box; /* Set color */ pixel_set(x, y, color); /* Fill next pixel */ } getchar(); /* Wait for */ /* Draw boxes using PACKED write mode */ cls(); printf("Drawing pixels using mode 2, packed write method"); for (box = 0; box < 16; box++) /* Loop over boxes */ for (j = 0; j < 10; j++) /* Loop over rasters */ /* within box */ for (i = 0; i < 100; i++) /* Loop over pixels */ { /* within raster */ x = i; /* Set x */ y = j + 10 * box; /* Compute y */ color = 15 - box; /* Set color */ pixel_packed_write(x, y, color);/*Fill next pix */ } getchar(); /* Wait for */ /* Draw boxes using PLANAR write mode */ cls(); printf("Drawing pixels using mode 0, planar write method"); for (box = 0; box < 16; box++) /* Loop over boxes */ for (j = 0; j < 10; j++) /* Loop over rasters */ /* within box */ for (i = 0; i < 100; i++) /* Loop over pixels */ { /* within raster */ x = i; /* Set x */ y = j + 10 * box; /* Compute y */ color = box; /* Set color */ pixel_write(x, y, color);/*Fill next pixel */ } }