static int create_diago2_page(TIFF *tiff_file)
{
    uint8_t image_buffer[1728/8 + 1];
    int row;

    /* ETSI ETS 300 242 B.5.1 One dimensional coding test chart - the DIAGO2 page. */
    for (row = 0;  row < 1001;  row++)
    {
        clear_row(image_buffer, 1728);
        set_pixel_range(image_buffer, 1, row + 728, 1727);
        if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
        {
            printf("Write error at row %d.\n", row);
            exit(2);
        }
    }
    clear_row(image_buffer, 1728);
    set_pixel_range(image_buffer, 1, 0, 1727);
    if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }
    return 1002;
}
示例#2
0
void write_frame()
{
  mxtype *v;
  int i;

  /* Decide what to do with partial bins */
  if (save_partial) {
    if (rows_accumulated != 0) frame_h++; /* Keep partial row always */
  } else if (frame_h == 0 && rows_accumulated != 0) 
    frame_h++; /* Keep partial row if it is the only one */
  else {
    /* Ignore partial row; update accounting */
    v = matrix + frame_h*frame_w;
    for (i=0; i < frame_w; i++) {
      recorded_counts -= v[i];
      ignored_counts += v[i];
    }
  }

  /* Check for consistent number of rows in frame */
  if (rows == 0) {
    rows = frame_h;
  } else if (frame_h == 0) {
    /* ICP dropped the frame so fill with zeros */
    frame_w = columns;
    for (frame_h = 0; frame_h < rows; frame_h++) clear_row();
    // printf("recover dropped frame to %d x %d\n", frame_h, frame_w);
  } else if (rows != frame_h) {
    if (warn_dims) fprintf(stderr,"inconsistent number of rows\n");
    warn_dims = 0;
    while (frame_h < rows) { clear_row(); frame_h++; }
    frame_h = rows; /* in case it was bigger */
  }
#ifdef DEBUG
  printf("=========== %d x %d \n", frame_w, frame_h);
  mx_print(frame_h,frame_w,matrix);
  printf("===========\n");
#endif

  /* Transpose the matrix if necessary */
  if (do_transpose) {
    mx_transpose(frame_h,frame_w,matrix,matrix);
    i = frame_w; frame_w = frame_h; frame_h = i;
  }

  /* Output the rows one by one */
  v = matrix;
  for (i=0; i < frame_h-1; i++) {
    switch(output) {
    case VTK: vtk_save(outfile,v,frame_w,1); break;
    case ICP: icp_save(outfile,v,frame_w,1); break;
    }
    v += frame_w;
  }
  switch (output) {
  case VTK: vtk_save(outfile,v,frame_w,0); break;
  case ICP: icp_save(outfile,v,frame_w,0); break;
  }
}
static int create_stairstep_page(TIFF *tiff_file)
{
    uint8_t image_buffer[8192];
    int row;
    int start_pixel;
    int i;

    /* TSB-85 STAIRSTEP page. */
    start_pixel = 0;
    for (row = 0;  row < 1728;  row++)
    {
        clear_row(image_buffer, 1728);
        set_pixel_range(image_buffer, 1, start_pixel, start_pixel + 63);
        if (photo_metric != PHOTOMETRIC_MINISWHITE)
        {
            for (i = 0;  i < 1728/8;  i++)
                image_buffer[i] = ~image_buffer[i];
        }
#if 0
        if (fill_order != FILLORDER_LSB2MSB)
            bit_reverse(image_buffer, image_buffer, 1728/8);
#endif
        if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
        {
            printf("Write error at row %d.\n", row);
            exit(2);
        }
        start_pixel += 64;
        if (start_pixel >= 1728)
            start_pixel = 0;
    }
    return 1728;
}
示例#4
0
inline static void newline(void) {
	uint32_t i;
	uint32_t *address;
	uint32_t *to;
	uint32_t *from;

	current_y++;
	current_x = 0;

	if (current_y == FB_HEIGHT / FB_CHAR_H) {
		if (top_row == 0) {
			/* Pointer to row = 0 */
			to = (uint32_t *) (fb_addr);
			/* Pointer to row = 1 */
			from = to + (FB_CHAR_H * FB_WIDTH) / 2;
			/* Copy block from {row = 1, rows} to {row = 0, rows - 1} */
			i = ((FB_HEIGHT - FB_CHAR_H) * FB_WIDTH) / 2;
		} else {
			to = (uint32_t *) (fb_addr) + ((FB_CHAR_H * FB_WIDTH) * top_row) / 2;
			from = to + (FB_CHAR_H * FB_WIDTH) / 2;
			i = ((FB_HEIGHT - FB_CHAR_H) * FB_WIDTH - ((FB_CHAR_H * FB_WIDTH) * top_row)) / 2;
		}

		memcpy_blk(to, from, i/8);

		/* Clear last row */
		address = (uint32_t *)(fb_addr) + ((FB_HEIGHT - FB_CHAR_H) * FB_WIDTH) / 2;
		clear_row(address);

		current_y--;
	}
}
示例#5
0
void ReceiverTypeData::clean_weak_klass_links(BoolObjectClosure* is_alive_cl) {
    for (uint row = 0; row < row_limit(); row++) {
    Klass* p = receiver(row);
    if (p != NULL && !p->is_loader_alive(is_alive_cl)) {
      clear_row(row);
    }
  }
}
示例#6
0
void ReceiverTypeData::follow_weak_refs(BoolObjectClosure* is_alive_cl) {
  for (uint row = 0; row < row_limit(); row++) {
    klassOop p = receiver(row);
    if (p != NULL && !is_alive_cl->do_object_b(p)) {
      clear_row(row);
    }
  }
}
示例#7
0
文件: vga.c 项目: kubinux/cubix
void vga_clear(void)
{
    for (int i = 0; i < MAX_ROWS; ++i)
    {
        clear_row(i);
    }
    struct cursor top_left = {0, 0};
    set_cursor(top_left);
}
示例#8
0
/*! Clears the screen and moves the cursor to the upper left. */
static void cls(void) {
    size_t y;

    for (y = 0; y < ROW_CNT; y++)
        clear_row(y);

    cx = cy = 0;
    move_cursor();
}
示例#9
0
void check_map_for_filled_rows(int map_2D[19][12])
{
    int i;
    for (i=BoxY-1; i>0; --i){
        if(row_full(map_2D, i)){       
            clear_row(map_2D, i);
        }
    }
}
示例#10
0
/*! Advances the cursor to the first column in the next line on
    the screen.  If the cursor is already on the last line on the
    screen, scrolls the screen upward one line. */
static void newline(void) {
    cx = 0;
    cy++;
    if (cy >= ROW_CNT) {
        cy = ROW_CNT - 1;
        memmove(&fb[0], &fb[1], sizeof fb[0] * (ROW_CNT - 1));
        clear_row(ROW_CNT - 1);
    }
}
示例#11
0
文件: vga.c 项目: kubinux/cubix
static void scroll(void)
{
    uint16_t *vga_base = get_vga_base();
    for (int row = 1; row < MAX_ROWS; ++row)
    {
        memcpy(vga_base + (row - 1) * MAX_COLS, vga_base + row * MAX_COLS,
               MAX_COLS * 2);
    }
    clear_row(MAX_ROWS - 1);
}
示例#12
0
文件: flipdot.c 项目: Bouni/flipdot
void set_rows(uint16_t data, uint8_t direction) {
    for(uint8_t i=0; i<ROWS; i++) {
        if(((data & (1<<i))>>i) == 1) {
            if(direction == 1) {
                set_row(i,((data & (1<<i))>>i));
                pulse();
                set_row(i,0);
            } else {
                clear_row(i,((data & (1<<i))>>i));
                pulse();
                clear_row(i,0);
            }
        }
static int create_white_page(TIFF *tiff_file)
{
    uint8_t image_buffer[8192];
    int row;

    /* TSB-85 WHITE page. */
    for (row = 0;  row < 1100;  row++)
    {
        clear_row(image_buffer, 1728);
        if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
        {
            printf("Write error at row %d.\n", row);
            exit(2);
        }
    }
    return 1100;
}
示例#14
0
/*
 * Memorize a message, Log it, Search it, and Display it in pieces
 */
static void borg_note_aux(cptr what)
{
	int j, n, i, k;

	int w, h, x, y;


	term *old = Term;

	/* Memorize it */
	message_add(what, MSG_GENERIC);

	/* Log the message */
	if (borg_fff) froff(borg_fff, "%s\n", what);

	/* Mega-Hack -- Check against the search string */
	if (borg_match[0] && strstr(what, borg_match))
	{
		/* Tell the user why you quit */
		borg_oops("Search string was matched");
	}

	/* Scan windows */
	for (j = 0; j < 8; j++)
	{
		if (!angband_term[j]) continue;

		/* Check flag */
		if (!(window_flag[j] & PW_BORG_1)) continue;

		/* Activate */
		Term_activate(angband_term[j]);

		/* Access size */
		Term_get_size(&w, &h);

		/* Access cursor */
		Term_locate(&x, &y);

		/* Erase current line */
		clear_row(y);


		/* Total length */
		n = strlen(what);

		/* Too long */
		if (n > w - 2)
		{
			char buf[1024];

			/* Split */
			while (n > w - 2)
			{
				/* Default */
				k = w - 2;

				/* Find a split point */
				for (i = w / 2; i < w - 2; i++)
				{
					/* Pre-emptive split point */
					if (isspace(what[i])) k = i;
				}

				/* Copy over the split message */
				for (i = 0; i < k; i++)
				{
					/* Copy */
					buf[i] = what[i];
				}

				/* Indicate split */
				buf[i++] = '\\';

				/* Terminate */
				buf[i] = '\0';

				/* Show message */
				roff(buf);

				/* Advance (wrap) */
				if (++y >= h) y = 0;

				/* Erase next line */
				clear_row(y);

				/* Advance */
				what += k;

				/* Reduce */
				n -= k;
			}

			/* Show message tail */
			roff(what);

			/* Advance (wrap) */
			if (++y >= h) y = 0;

			/* Erase next line */
			clear_row(y);
		}

		/* Normal */
		else
		{
			/* Show message */
			roff(what);

			/* Advance (wrap) */
			if (++y >= h) y = 0;

			/* Erase next line */
			clear_row(y);
		}


		/* Flush output */
		Term_fresh();

		/* Use correct window */
		Term_activate(old);
	}
}
示例#15
0
文件: ui.c 项目: jcheatham/Zangband
/*
 * Display a menu of choices on the screen
 *
 * We return the number of active options.
 */
static int show_menu(int num, menu_type *options, int select, bool scroll,
					 int disp(int), cptr prompt)
{
	int cnt = 0;
	int i;
	bool select_me;
	
	int x, y;
	
	int offset = 0;
	
	/*
	 * Display 'special' information
	 */
	if (disp) offset = disp(num);

	/* Border on top of menu */
	clear_row(1);
		
	/* Will they fit in one column? */
	if (num < 19)
	{
		for (i = 0; i < num; i++)
		{
			select_me = i == select;

			if (show_option(0, i + 2 + offset, &options[i], I2A(cnt), scroll, select_me))
			{
				cnt++;
			}
		}
	
		/* Border below menu */
		clear_row(num + 2 + offset);
	}
	
	/* Two columns (use numbers as well) */
	else if (num < 37)
	{
		for (i = 0; i < num; i++)
		{
			select_me = i == select;

			x = (i / 18) * 40;
			y = (i % 18) + 2;
				
			if (show_option(x, y + offset, &options[i], listsym[cnt], scroll, select_me))
			{
				cnt++;
			}
		}
		
		/* Border below menu */
		clear_row(20 + offset);
	}
	
	/* Three columns - need to use upper case letters */
	else
	{
		for (i = 0; i < num; i++)
		{
			select_me = i == select;

			x = (i / 20) * 30;
			y = (i % 20) + 2;
			
			if (show_option(x, y + offset, &options[i], listsym[cnt], scroll, select_me))
			{
				cnt++;
			}
		}
	
		/* Border below menu */
		clear_row(22 + offset);
	}
	
	/*
	 * Display the prompt.
	 * (Do this last, so we get the cursor in the right spot)
	 */
	if (!cnt)
	{
		prtf(0, 0, "%s (No commands available, ESC=exit)", prompt);
	}
	else if (cnt == 1)
	{
		/* Display the prompt */
		prtf(0, 0, "%s (Command (a), ESC=exit)", prompt ? prompt : "Select a command: ");
	}
	else if (cnt < 19)
	{
		/* Display the prompt */
		prtf(0, 0, "%s (Command (a-%c), ESC=exit)",
			 prompt ? prompt : "Select a command: " ,I2A(cnt - 1));
	}
	else
	{
		/* Display the prompt */
		prtf(0, 0, "%s (Command (0-%c), ESC=exit)",
			 prompt ? prompt : "Select a command: " ,listsym[cnt - 1]);
	}

	
	return (cnt);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_entire_row(char * print_string,int y,uint8_t text_attribute){

  clear_row(y);
  print_attribute(print_string,((display_columns/*-1*/)/2)-(length(print_string)/2),y,text_attribute);
  
}
static int create_error_page(TIFF *tiff_file)
{
    uint8_t image_buffer[1728/8 + 1];
    int row;
    int start_pixel;
    int i;

    /* ETSI ETS 300 242 B.5.4 Copy quality criteria - the ERROR page. */
    for (row = 0;  row < 68;  row++)
    {
        clear_row(image_buffer, 1728);
        if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
        {
            printf("Write error at row %d.\n", row);
            exit(2);
        }
    }

    clear_row(image_buffer, 1728);
    set_pixel_range(image_buffer, 1, 0, 1727);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }

    clear_row(image_buffer, 1728);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }

    for (i = 0;  i < 10;  i++)
    {
        for (start_pixel = 16;  start_pixel <= 1616;  start_pixel += 64)
        {
            clear_row(image_buffer, 1728);
            set_pixel_range(image_buffer, 1, start_pixel, start_pixel + 63);
            if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
            {
                printf("Write error at row %d.\n", row);
                exit(2);
            }
            row++;
        }
    }

    clear_row(image_buffer, 1728);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }

    clear_row(image_buffer, 1728);
    set_pixel_range(image_buffer, 1, 0, 1727);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }

    for (row = 332;  row < 400;  row++)
    {
        clear_row(image_buffer, 1728);
        if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
        {
            printf("Write error at row %d.\n", row);
            exit(2);
        }
    }

    return 400;
}
static int create_duration1_page(TIFF *tiff_file)
{
    uint8_t image_buffer[1728/8 + 1];
    int row;
    int i;

    /* ETSI ETS 300 242 B.5.3 Acceptance of total coded scan line duration - the DURATION1 page */
    row = 0;
    clear_row(image_buffer, 1728);
    set_pixel_range(image_buffer, 1, 0, 1727);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }
    for (  ;  row < 117;  row++)
    {
        clear_row(image_buffer, 1728);
        if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
        {
            printf("Write error at row %d.\n", row);
            exit(2);
        }
    }
    clear_row(image_buffer, 1728);
    set_pixel_range(image_buffer, 1, 0, 1727);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }
    clear_row(image_buffer, 1728);
    for (i = 1;  i < 1728;  i += 2)
        set_pixel(image_buffer, 1, i);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }
    clear_row(image_buffer, 1728);
    set_pixel_range(image_buffer, 1, 0, 1727);
    if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }
    for (  ;  row < 236;  row++)
    {
        clear_row(image_buffer, 1728);
        if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
        {
            printf("Write error at row %d.\n", row);
            exit(2);
        }
    }
    clear_row(image_buffer, 1728);
    set_pixel_range(image_buffer, 1, 0, 1727);
    if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
    {
        printf("Write error at row %d.\n", row);
        exit(2);
    }
    return 237;
}
示例#19
0
void next_frame()
{
  frame_r = frame_w = frame_h = 0;
  rows_accumulated = 0;
  clear_row();
}