Пример #1
0
/* Create the RGB-pixels that make up the hole */
static guchar *
create_hole_rgb (gint width,
                 gint height)
{
  guchar *hole, *top, *bottom;
  gint    radius, length, k;

  hole = g_new (guchar, width * height * 3);

  /* Fill a rectangle with white */
  memset (hole, 255, width * height * 3);
  radius = height / 4;
  if (radius > width / 2)
    radius = width / 2;
  top = hole;
  bottom = hole + (height-1)*width*3;
  for (k = radius-1; k > 0; k--)  /* Rounding corners */
    {
      length = (int)(radius - sqrt ((gdouble) (radius * radius - k * k))
                     - 0.5);
      if (length > 0)
        {
          set_pixels (length, top, &filmvals.film_color);
          set_pixels (length, top + (width-length)*3, &filmvals.film_color);
          set_pixels (length, bottom, &filmvals.film_color);
          set_pixels (length, bottom + (width-length)*3, &filmvals.film_color);
        }
      top += width*3;
      bottom -= width*3;
    }

  return hole;
}
Пример #2
0
Nes_Emu::Nes_Emu()
{
	frame_ = &single_frame;
	buffer_height_ = Nes_Ppu::buffer_height + 2;
	default_sound_buf = NULL;
	sound_buf = &silent_buffer;
	sound_buf_changed_count = 0;
	equalizer_ = nes_eq;
	channel_count_ = 0;
	sound_enabled = false;
	host_pixels = NULL;
	single_frame.pixels = 0;
	single_frame.top = 0;
	init_called = false;
	set_palette_range( 0 );
	memset( single_frame.palette, 0, sizeof single_frame.palette );
	host_pixel_buff = new char[buffer_width * buffer_height()];
	set_pixels(host_pixel_buff, buffer_width);
}