Пример #1
0
	TitleBar::TitleBar()
	{
		back_height = 0;
		back_width = 0;

		col_left  = MAKECOLOR(4, 72, 117);
		col_right = MAKECOLOR(25, 108, 119);

		col_glow_up = MAKECOLOR(255,255,255);
		col_glow_bottom = MAKECOLOR(0,245,245);

		topfade_up = 128;
		topfade_bottom = 64;
		bottomfade_up = 0;
		bottomfade_bottom = 210;
	}
Пример #2
0
	inline DWORD BlendColor(DWORD c1, DWORD c2, int alpha)
	{
		int	r = (COMP(c1,16)*256 + (COMP(c2,16)-COMP(c1,16))*alpha) >> 8;
		int	g = (COMP(c1,8)*256 + (COMP(c2,8)-COMP(c1,8))*alpha) >> 8;
		int	b = (COMP(c1,0)*256 + (COMP(c2,0)-COMP(c1,0))*alpha) >> 8;
		return MAKECOLOR(r,g,b);
	}
Пример #3
0
#define MAKECOLOR(a, b, c) (((a >> 3) << 10) | ((b >> 3) << 5) | (c >> 3))

enum {
    COL_BLACK = 0,
    COL_RED,
    COL_GREEN,
    COL_YELLOW,
    COL_BLUE,
    COL_PURPLE,
    COL_CYAN,
    COL_WHITE
};

static unsigned short colors[8] = {
    MAKECOLOR(0x00,0x00,0x00),
    MAKECOLOR(0xaa,0x00,0x00),
    MAKECOLOR(0x00,0xaa,0x00),
    MAKECOLOR(0xaa,0x55,0x00),
    MAKECOLOR(0x00,0x00,0xaa),
    MAKECOLOR(0xaa,0x00,0xaa),
    MAKECOLOR(0x00,0xaa,0xaa),
    MAKECOLOR(0xaa,0xaa,0xaa),
};

void console_init(void)
{
    con_x = 0;
    con_y = 0;

    con_col_fg = colors[COL_WHITE];
Пример #4
0
void Deinterlacer::InternalProcess(MDFN_Surface *surface, MDFN_Rect &DisplayRect, int32 *LineWidths, const bool field)
{
 //
 // We need to output with LineWidths as always being valid to handle the case of horizontal resolution change between fields
 // while in interlace mode, so clear the first LineWidths entry if it's == ~0, and
 // [...]
 const bool LineWidths_In_Valid = (LineWidths[0] != ~0);
 const bool WeaveGood = (StateValid && PrevDRect.h == DisplayRect.h && DeintType == DEINT_WEAVE);
 //
 // XReposition stuff is to prevent exceeding the dimensions of the video surface under certain conditions(weave deinterlacer, previous field has higher
 // horizontal resolution than current field, and current field's rectangle has an x offset that's too large when taking into consideration the previous field's
 // width; for simplicity, we don't check widths, but just assume that the previous field's maximum width is >= than the current field's maximum width).
 //
 const int32 XReposition = ((WeaveGood && DisplayRect.x > PrevDRect.x) ? DisplayRect.x : 0);

 //printf("%2d %2d, %d\n", DisplayRect.x, PrevDRect.x, XReposition);

 if(XReposition)
  DisplayRect.x = 0;

 if(surface->h && !LineWidths_In_Valid)
 {
  LineWidths[0] = 0;
 }

 for(int y = 0; y < DisplayRect.h / 2; y++)
 {
  // [...]
  // set all relevant source line widths to the contents of DisplayRect(also simplifies the src_lw and related pointer calculation code
  // farther below.
  if(!LineWidths_In_Valid)
   LineWidths[(y * 2) + field + DisplayRect.y] = DisplayRect.w;

  if(XReposition)
  {
    memmove(surface->pixels + ((y * 2) + field + DisplayRect.y) * surface->pitchinpix,
	    surface->pixels + ((y * 2) + field + DisplayRect.y) * surface->pitchinpix + XReposition,
	    LineWidths[(y * 2) + field + DisplayRect.y] * sizeof(T));
  }

  if(WeaveGood)
  {
   const T* src = FieldBuffer->pixels + y * FieldBuffer->pitchinpix;
   T* dest = surface->pixels + ((y * 2) + (field ^ 1) + DisplayRect.y) * surface->pitchinpix + DisplayRect.x;
   int32 *dest_lw = &LineWidths[(y * 2) + (field ^ 1) + DisplayRect.y];

   *dest_lw = LWBuffer[y];

   memcpy(dest, src, LWBuffer[y] * sizeof(T));
  }
  else if(DeintType == DEINT_BOB)
  {
   const T* src = surface->pixels + ((y * 2) + field + DisplayRect.y) * surface->pitchinpix + DisplayRect.x;
   T* dest = surface->pixels + ((y * 2) + (field ^ 1) + DisplayRect.y) * surface->pitchinpix + DisplayRect.x;
   const int32 *src_lw = &LineWidths[(y * 2) + field + DisplayRect.y];
   int32 *dest_lw = &LineWidths[(y * 2) + (field ^ 1) + DisplayRect.y];

   *dest_lw = *src_lw;

   memcpy(dest, src, *src_lw * sizeof(T));
  }
  else
  {
   const int32 *src_lw = &LineWidths[(y * 2) + field + DisplayRect.y];
   const T* src = surface->pixels + ((y * 2) + field + DisplayRect.y) * surface->pitchinpix + DisplayRect.x;
   const int32 dly = ((y * 2) + (field + 1) + DisplayRect.y);
   T* dest = surface->pixels + dly * surface->pitchinpix + DisplayRect.x;

   if(y == 0 && field)
   {
    T black = MAKECOLOR(0, 0, 0, 0);
    T* dm2 = surface->pixels + (dly - 2) * surface->pitchinpix;

    LineWidths[dly - 2] = *src_lw;

    for(int x = 0; x < *src_lw; x++)
     dm2[x] = black;
   }

   if(dly < (DisplayRect.y + DisplayRect.h))
   {
    LineWidths[dly] = *src_lw;
    memcpy(dest, src, *src_lw * sizeof(T));
   }
  }

  //
  //
  //
  //
  //
  //
  if(DeintType == DEINT_WEAVE)
  {
   const int32 *src_lw = &LineWidths[(y * 2) + field + DisplayRect.y];
   const T* src = surface->pixels + ((y * 2) + field + DisplayRect.y) * surface->pitchinpix + DisplayRect.x;
   T* dest = FieldBuffer->pixels + y * FieldBuffer->pitchinpix;

   memcpy(dest, src, *src_lw * sizeof(uint32));
   LWBuffer[y] = *src_lw;

   StateValid = true;
  }
 }
}
Пример #5
0
	void TitleBar::DoPaint(CDC *dc, int cx, int cy)
	{
		int			x,y;
		BITMAP		b;
		GetObject(backbuffer, sizeof(b), &b);

		cy -= 1;

		// draw gradient
		int			stride = (b.bmWidthBytes / 4);
		DWORD		*pix = (DWORD*)(b.bmBits);
		DWORD		base_color;
		DWORD		color;
		int			y_mid = cy/2;

		for (y=0; y<cy; y++) {
			DWORD	*line = pix + y*stride;
			DWORD	glow_color;
			int		glow_alpha;

			// calculate glow parameters
			if (y < y_mid) {
				glow_color = col_glow_up;
				glow_alpha = (topfade_up + (((topfade_bottom-topfade_up)*(y+1))/y_mid));
			} else {
				glow_color = col_glow_bottom;
				glow_alpha = (bottomfade_up + (((bottomfade_bottom-bottomfade_up)*(y-y_mid+1))/y_mid));

				float	temp = glow_alpha / 256.0;
				temp = pow((float)temp, (float)3.0);
				glow_alpha = temp * 255.0;
			}

			for (x=0; x<cx; x++) {

				// base gradient color
				base_color = BlendColor(col_left, col_right, (x+1)*255/cx);
				color = BlendColor(base_color, glow_color, glow_alpha);

				line[x] = color;
			}
		}

		// draw border lines
		DWORD	*line1 = pix + 0*stride;
		DWORD	*line2 = pix + (cy-1)*stride;
		for (x=0; x<cx; x++) {
			line1[x] = BlendColor(line1[x], MAKECOLOR(255,255,255), 100);
			line2[x] = BlendColor(line2[x], MAKECOLOR(255,255,255), 100);
		}
		for (y=0; y<cy; y++) {
			line1 = pix + y*stride;
			line1[0]    = BlendColor(line1[0],    MAKECOLOR(255,255,255), 100);
			line1[cx-1] = BlendColor(line1[cx-1], MAKECOLOR(255,255,255), 100);
		}

		cy += 1;

		// black line at the bottom
		line1 = pix + (cy-1)*stride;
		for (x=0; x<cx; x++) {
			line1[x] = 0;
		}
	}