public static void copybitmap(osd_bitmap dest, osd_bitmap src, int flipx, int flipy, int sx, int sy,
            rectangle clip, int transparency, int transparent_color)
    {
	rectangle myclip=new rectangle();


	/* if necessary, remap the transparent color */
	if (transparency == TRANSPARENCY_COLOR)
		transparent_color = Machine.pens[transparent_color];


	if ((Machine.orientation & ORIENTATION_SWAP_XY)!=0)
	{
		int temp;

		temp = sx;
		sx = sy;
		sy = temp;

		temp = flipx;
		flipx = flipy;
		flipy = temp;

		if (clip!=null)
		{
			/* clip and myclip might be the same, so we need a temporary storage */
			temp = clip.min_x;
			myclip.min_x = clip.min_y;
			myclip.min_y = temp;
			temp = clip.max_x;
			myclip.max_x = clip.max_y;
			myclip.max_y = temp;
			clip = myclip;
		}
	}
	if ((Machine.orientation & ORIENTATION_FLIP_X)!=0)
	{
		sx = dest.width - src.width - sx;
		if (clip!=null)
		{
			int temp;


			/* clip and myclip might be the same, so we need a temporary storage */
			temp = clip.min_x;
			myclip.min_x = dest.width-1 - clip.max_x;
			myclip.max_x = dest.width-1 - temp;
			myclip.min_y = clip.min_y;
			myclip.max_y = clip.max_y;
			clip = myclip;
		}
	}
	if ((Machine.orientation & ORIENTATION_FLIP_Y)!=0)
	{
		sy = dest.height - src.height - sy;
		if (clip!=null)
		{
			int temp;


			myclip.min_x = clip.min_x;
			myclip.max_x = clip.max_x;
			/* clip and myclip might be the same, so we need a temporary storage */
			temp = clip.min_y;
			myclip.min_y = dest.height-1 - clip.max_y;
			myclip.max_y = dest.height-1 - temp;
			clip = myclip;
		}
	}

	if (dest.depth != 16)
        {
            copybitmap_core8(dest,src,flipx,flipy,sx,sy,clip,transparency,transparent_color);
        }	
	else
        {
            throw new UnsupportedOperationException("copybitmap_core16");
            //copybitmap_core16(dest,src,flipx,flipy,sx,sy,clip,transparency,transparent_color);
        }
		
    }