Exemple #1
0
        public static void overlay_draw(osd_bitmap dest, artwork overlay)
        {
            int i, j;
            int height, width;
            osd_bitmap o = null;
            int black;

            o = overlay._artwork;
            height = overlay._artwork.height;
            width = overlay._artwork.width;
            black = Machine.pens[0];

            if (dest.depth == 8)
            {
                _BytePtr dst, ovr;

                for (j = 0; j < height; j++)
                {
                    dst = new _BytePtr(dest.line[j]);
                    ovr = new _BytePtr(o.line[j]);
                    for (i = 0; i < width; i++)
                    {
                        if (dst[0] != black)
                            dst[0] = ovr[0];
                        dst.offset++;
                        ovr.offset++;
                    }
                }
            }
            else
            {
                _ShortPtr dst, ovr;

                for (j = 0; j < height; j++)
                {
                    dst = new _ShortPtr(dest.line[j]);
                    ovr = new _ShortPtr(o.line[j]);
                    for (i = 0; i < width; i++)
                    {
                        if (dst.read16(0) != black)
                            dst.write16(0, ovr.read16(0));
                        dst.offset += 2;
                        ovr.offset += 2;
                    }
                }
            }
        }
Exemple #2
0
 static int rp_16_fy(osd_bitmap b, int x, int y) { return b.line[b.height - 1 - y].read16(x); }
Exemple #3
0
 static void drawgfx_core16(osd_bitmap dest, GfxElement gfx, uint code, uint color, bool flipx, bool flipy, int sx, int sy, rectangle clip, int transparency, int transparent_color)
 {
     int ox; int oy; int ex; int ey;
     /* check bounds */
     ox = sx; oy = sy;
     ex = sx + gfx.width - 1; if (sx < 0) sx = 0;
     if (clip != null && sx < clip.min_x) sx = clip.min_x;
     if (ex >= dest.width) ex = dest.width - 1;
     if (clip != null && ex > clip.max_x) ex = clip.max_x;
     if (sx > ex) return; ey = sy + gfx.height - 1;
     if (sy < 0) sy = 0;
     if (clip != null && sy < clip.min_y) sy = clip.min_y;
     if (ey >= dest.height) ey = dest.height - 1;
     if (clip != null && ey > clip.max_y) ey = clip.max_y;
     if (sy > ey) return; osd_mark_dirty(sx, sy, ex, ey, 0); /* ASG 971011 */
     {
         _BytePtr sd = new _BytePtr(gfx.gfxdata, (int)(code * gfx.char_modulo)); /* source data */
         int sw = ex - sx + 1; /* source width */
         int sh = ey - sy + 1; /* source height */
         int sm = gfx.line_modulo; /* source modulo */
         _ShortPtr dd = new _ShortPtr(dest.line[sy], sx); /* dest data */
         int dm = dest.line[1].offset - dest.line[0].offset; /* dest modulo */
         UShortSubArray paldata = new UShortSubArray(gfx.colortable, (int)((gfx.color_granularity * color)));
         if (flipx)
         {
             sd.offset += gfx.width - 1 - (sx - ox);
         }
         else
             sd.offset += (sx - ox); if (flipy)
         {
             sd.offset += sm * (gfx.height - 1 - (sy - oy));
             sm = -sm;
         }
         else
             sd.offset += sm * (sy - oy); switch (transparency)
         {
             case TRANSPARENCY_NONE:
                 if (flipx) blockmove_opaque_flipx16(sd, sw, sh, sm, dd, dm, paldata);
                 else
                     blockmove_opaque16(sd, sw, sh, sm, dd, dm, paldata);
                 break;
             case TRANSPARENCY_PEN:
                 if (flipx)
                     blockmove_transpen_flipx16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 else
                     blockmove_transpen16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 break;
             case TRANSPARENCY_PENS: if (flipx)
                     blockmove_transmask_flipx16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 else
                     blockmove_transmask16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 break;
             case TRANSPARENCY_COLOR: if (flipx)
                     blockmove_transcolor_flipx16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 else
                     blockmove_transcolor16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 break;
             case TRANSPARENCY_THROUGH: if (flipx)
                     blockmove_transthrough_flipx16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 else
                     blockmove_transthrough16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 break;
             case TRANSPARENCY_PEN_TABLE: if (flipx)
                     blockmove_pen_table_flipx16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 else
                     blockmove_pen_table16(sd, sw, sh, sm, dd, dm, paldata, transparent_color);
                 break;
         }
     }
 }
Exemple #4
0
        public static void drawgfx(osd_bitmap dest, GfxElement gfx, uint code, uint color, bool flipx, bool flipy, int sx, int sy, rectangle clip, int transparency, int transparent_color)
        {
            rectangle myclip = new rectangle();

            if (gfx == null)
            {
                usrintf_showmessage("drawgfx() gfx == 0");
                return;
            }
            if (gfx.colortable == null)
            {
                usrintf_showmessage("drawgfx() gfx.colortable == 0");
                return;
            }

            code %= gfx.total_elements;
            color %= (uint)gfx.total_colors;

            if (gfx.pen_usage != null && (transparency == TRANSPARENCY_PEN || transparency == TRANSPARENCY_PENS))
            {
                int transmask = 0;

                if (transparency == TRANSPARENCY_PEN)
                {
                    transmask = 1 << transparent_color;
                }
                else if (transparency == TRANSPARENCY_PENS)
                {
                    transmask = transparent_color;
                }

                if ((gfx.pen_usage[(int)code] & ~transmask) == 0)
                    /* character is totally transparent, no need to draw */
                    return;
                else if ((gfx.pen_usage[(int)code] & transmask) == 0 && transparency != TRANSPARENCY_THROUGH && transparency != TRANSPARENCY_PEN_TABLE)
                    /* character is totally opaque, can disable transparency */
                    transparency = TRANSPARENCY_NONE;
            }

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

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

                bool tempb = flipx;
                flipx = flipy;
                flipy = tempb;

                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 - gfx.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 !PREROTATE_GFX
                flipx = !flipx;
#endif
            }
            if ((Machine.orientation & ORIENTATION_FLIP_Y) != 0)
            {
                sy = dest.height - gfx.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 !PREROTATE_GFX
                flipy = !flipy;
#endif
            }

            if (dest.depth != 16)
                drawgfx_core8(dest, gfx, code, color, flipx, flipy, sx, sy, clip, transparency, transparent_color);
            else
                drawgfx_core16(dest, gfx, code, color, flipx, flipy, sx, sy, clip, transparency, transparent_color);

        }
Exemple #5
0
 static void pp_8_d_fy_s(osd_bitmap b, int x, int y, int p) { int newx = b.height - 1 - x; b.line[newx][y] = (byte)p; osd_mark_dirty(y, newx, y, newx, 0); }
Exemple #6
0
 static void pp_8_d_s(osd_bitmap b, int x, int y, int p) { b.line[x][y] = (byte)p; osd_mark_dirty(y, x, y, x, 0); }
Exemple #7
0
 static void pp_8_d_fx(osd_bitmap b, int x, int y, int p) { int newx = b.width - 1 - x; b.line[y][newx] = (byte)p; osd_mark_dirty(newx, y, newx, y, 0); }
Exemple #8
0
 static int rp_8_fxy_s(osd_bitmap b, int x, int y) { return b.line[b.height - 1 - x][b.width - 1 - y]; }
Exemple #9
0
 static void pp_8_nd_s(osd_bitmap b, int x, int y, int p) { b.line[x][y] = (byte)p; }
Exemple #10
0
        public static void fillbitmap(osd_bitmap dest, int pen, rectangle clip)
        {
            FuncDict["fillbitmap"] = "fillbitmap";
            rectangle myclip = new rectangle();

            if ((Machine.orientation & ORIENTATION_SWAP_XY) != 0)
            {
                if (clip != null)
                {
                    myclip.min_x = clip.min_y;
                    myclip.max_x = clip.max_y;
                    myclip.min_y = clip.min_x;
                    myclip.max_y = clip.max_x;
                    clip = myclip;
                }
            }
            if ((Machine.orientation & ORIENTATION_FLIP_X) != 0)
            {
                if (clip != null)
                {
                    int 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)
            {
                if (clip != null)
                {
                    myclip.min_x = clip.min_x;
                    myclip.max_x = clip.max_x;
                    int temp = clip.min_y;
                    myclip.min_y = dest.height - 1 - clip.max_y;
                    myclip.max_y = dest.height - 1 - temp;
                    clip = myclip;
                }
            }

            int sx = 0;
            int ex = dest.width - 1;
            int sy = 0;
            int ey = dest.height - 1;

            if (clip != null && sx < clip.min_x) sx = clip.min_x;
            if (clip != null && ex > clip.max_x) ex = clip.max_x;
            if (sx > ex) return;
            if (clip != null && sy < clip.min_y) sy = clip.min_y;
            if (clip != null && ey > clip.max_y) ey = clip.max_y;
            if (sy > ey) return;

            osd_mark_dirty(sx, sy, ex, ey, 0);	/* ASG 971011 */

            /* ASG 980211 */
            if (dest.depth == 16)
            {
                if ((pen >> 8) == (pen & 0xff))
                {
                    for (int y = sy; y <= ey; y++)
                    {
                        for (int k = 0; k < (ex - sx + 1) * 2; k++)
                            dest.line[y][sx * 2 + k] = (byte)(pen & 0xff);
                    }
                    //memset(&dest.line[y][sx*2],pen&0xff,(ex-sx+1)*2);
                }
                else
                {
                    _ShortPtr sp = new _ShortPtr(dest.line[sy]);
                    int x;

                    for (x = sx; x <= ex; x++)
                        sp.write16(x, (ushort)pen);
                    sp.offset += sx * 2;
                    for (int y = sy + 1; y <= ey; y++)
                    {
                        Buffer.BlockCopy(sp.buffer, sp.offset, dest.line[y].buffer, sx * 2, (ex - sx + 1) * 2);
                    }
                    //memcpy(&dest.line[y][sx*2],sp,(ex-sx+1)*2);
                }
            }
            else
            {
                for (int y = sy; y <= ey; y++)
                {
                    for (int k = 0; k < ex - sx + 1; k++) dest.line[y][sx + k] = (byte)pen;
                }
            }
        }
Exemple #11
0
 static void pp_8_nd_fy(osd_bitmap b, int x, int y, int p) { b.line[b.height - 1 - y][x] = (byte)p; }
Exemple #12
0
 static void pp_8_nd_fx(osd_bitmap b, int x, int y, int p) { b.line[y][b.width - 1 - x] = (byte)p; }
Exemple #13
0
 static int rp_16_fxy_s(osd_bitmap b, int x, int y) { return b.line[b.height - 1 - x].read16(b.width - 1 - y); }
Exemple #14
0
 static int rp_16_fx_s(osd_bitmap b, int x, int y) { return b.line[x].read16(b.width - 1 - y); }
Exemple #15
0
 static int rp_16_s(osd_bitmap b, int x, int y) { return b.line[x].read16(y); }
Exemple #16
0
 static int rp_8_fx_s(osd_bitmap b, int x, int y) { return b.line[x][b.width - 1 - y]; }
Exemple #17
0
 static int rp_8_fy_s(osd_bitmap b, int x, int y) { return b.line[b.height - 1 - x][y]; }
Exemple #18
0
 static void pp_8_nd_fxy_s(osd_bitmap b, int x, int y, int p) { b.line[b.height - 1 - x][b.width - 1 - y] = (byte)p; }
Exemple #19
0
 static void pp_8_d(osd_bitmap b, int x, int y, int p) { b.line[y][x] = (byte)p; osd_mark_dirty(x, y, x, y, 0); }
Exemple #20
0
 static int rp_8(osd_bitmap b, int x, int y) { return b.line[y][x]; }
Exemple #21
0
 static void pp_8_d_fy(osd_bitmap b, int x, int y, int p) { int newy = b.height - 1 - y; b.line[newy][x] = (byte)p; osd_mark_dirty(x, newy, x, newy, 0); }
Exemple #22
0
 static int rp_8_fx(osd_bitmap b, int x, int y) { return b.line[y][b.width - 1 - x]; }
Exemple #23
0
 static void pp_8_d_fx_s(osd_bitmap b, int x, int y, int p) { int newy = b.width - 1 - y; b.line[x][newy] = (byte)p; osd_mark_dirty(newy, x, newy, x, 0); }
Exemple #24
0
 static int rp_8_fy(osd_bitmap b, int x, int y) { return b.line[b.height - 1 - y][x]; }
Exemple #25
0
 static void pp_8_d_fxy_s(osd_bitmap b, int x, int y, int p) { int newx = b.height - 1 - x; int newy = b.width - 1 - y; b.line[newx][newy] = (byte)p; osd_mark_dirty(newy, newx, newy, newx, 0); }
Exemple #26
0
 static void copybitmapzoom(osd_bitmap dest_bmp, osd_bitmap source_bmp, bool flipx, bool flipy, int sz, int sy, rectangle clip, int transparency, int transparent_color, int scalex, int scaley)
 {
     throw new Exception();
 }
Exemple #27
0
 public static void plot_pixel2(osd_bitmap bitmap1, osd_bitmap bitmap2, int x, int y, int pen)
 {
     plot_pixel(bitmap1, x, y, pen);
     plot_pixel(bitmap2, x, y, pen);
 }
Exemple #28
0
        public static void drawgfxzoom(osd_bitmap dest_bmp, GfxElement gfx, uint code, uint color, bool flipx, bool flipy, int sx, int sy, rectangle clip, int transparency, int transparent_color, int scalex, int scaley)
        {
            FuncDict["drawgfxzoom"] = "drawgfxzoom";
            rectangle myclip = new rectangle();


            /* only support TRANSPARENCY_PEN and TRANSPARENCY_COLOR */
            if (transparency != TRANSPARENCY_PEN && transparency != TRANSPARENCY_COLOR)
                return;

            if (transparency == TRANSPARENCY_COLOR)
                transparent_color = Machine.pens[transparent_color];


            /*
            scalex and scaley are 16.16 fixed point numbers
            1<<15 : shrink to 50%
            1<<16 : uniform scale
            1<<17 : double to 200%
            */


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

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

                var tempb = flipx;
                flipx = flipy;
                flipy = tempb;

                temp = scalex;
                scalex = scaley;
                scaley = 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_bmp.width - ((gfx.width * scalex + 0x7fff) >> 16) - 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_bmp.width - 1 - clip.max_x;
                    myclip.max_x = dest_bmp.width - 1 - temp;
                    myclip.min_y = clip.min_y;
                    myclip.max_y = clip.max_y;
                    clip = myclip;
                }
#if !PREROTATE_GFX
                flipx = !flipx;
#endif
            }
            if ((Machine.orientation & ORIENTATION_FLIP_Y) != 0)
            {
                sy = dest_bmp.height - ((gfx.height * scaley + 0x7fff) >> 16) - 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_bmp.height - 1 - clip.max_y;
                    myclip.max_y = dest_bmp.height - 1 - temp;
                    clip = myclip;
                }
#if !PREROTATE_GFX
                flipy = !flipy;
#endif
            }

            /* KW 991012 -- Added code to force clip to bitmap boundary */
            if (clip != null)
            {
                myclip.min_x = clip.min_x;
                myclip.max_x = clip.max_x;
                myclip.min_y = clip.min_y;
                myclip.max_y = clip.max_y;

                if (myclip.min_x < 0) myclip.min_x = 0;
                if (myclip.max_x >= dest_bmp.width) myclip.max_x = dest_bmp.width - 1;
                if (myclip.min_y < 0) myclip.min_y = 0;
                if (myclip.max_y >= dest_bmp.height) myclip.max_y = dest_bmp.height - 1;

                clip = myclip;
            }


            /* ASG 980209 -- added 16-bit version */
            if (dest_bmp.depth != 16)
            {
                if (gfx != null && gfx.colortable != null)
                {
                    UShortSubArray pal = new UShortSubArray(gfx.colortable, (int)(gfx.color_granularity * (color % gfx.total_colors))); /* ASG 980209 */
                    int source_base = (int)((code % gfx.total_elements) * gfx.height);

                    int sprite_screen_height = (scaley * gfx.height + 0x8000) >> 16;
                    int sprite_screen_width = (scalex * gfx.width + 0x8000) >> 16;

                    /* compute sprite increment per screen pixel */
                    int dx = (gfx.width << 16) / sprite_screen_width;
                    int dy = (gfx.height << 16) / sprite_screen_height;

                    int ex = sx + sprite_screen_width;
                    int ey = sy + sprite_screen_height;

                    int x_index_base;
                    int y_index;

                    if (flipx)
                    {
                        x_index_base = (sprite_screen_width - 1) * dx;
                        dx = -dx;
                    }
                    else
                    {
                        x_index_base = 0;
                    }

                    if (flipy)
                    {
                        y_index = (sprite_screen_height - 1) * dy;
                        dy = -dy;
                    }
                    else
                    {
                        y_index = 0;
                    }

                    if (clip != null)
                    {
                        if (sx < clip.min_x)
                        { /* clip left */
                            int pixels = clip.min_x - sx;
                            sx += pixels;
                            x_index_base += pixels * dx;
                        }
                        if (sy < clip.min_y)
                        { /* clip top */
                            int pixels = clip.min_y - sy;
                            sy += pixels;
                            y_index += pixels * dy;
                        }
                        /* NS 980211 - fixed incorrect clipping */
                        if (ex > clip.max_x + 1)
                        { /* clip right */
                            int pixels = ex - clip.max_x - 1;
                            ex -= pixels;
                        }
                        if (ey > clip.max_y + 1)
                        { /* clip bottom */
                            int pixels = ey - clip.max_y - 1;
                            ey -= pixels;
                        }
                    }

                    if (ex > sx)
                    { /* skip if inner loop doesn't draw anything */
                        int y;

                        /* case 1: TRANSPARENCY_PEN */
                        if (transparency == TRANSPARENCY_PEN)
                        {
                            for (y = sy; y < ey; y++)
                            {
                                _BytePtr source = new _BytePtr(gfx.gfxdata, (source_base + (y_index >> 16)) * gfx.line_modulo);
                                _BytePtr dest = dest_bmp.line[y];

                                int x, x_index = x_index_base;
                                for (x = sx; x < ex; x++)
                                {
                                    int c = source[x_index >> 16];
                                    if (c != transparent_color) dest[x] = (byte)pal[c];
                                    x_index += dx;
                                }

                                y_index += dy;
                            }
                        }

                        /* case 2: TRANSPARENCY_COLOR */
                        else if (transparency == TRANSPARENCY_COLOR)
                        {
                            for (y = sy; y < ey; y++)
                            {
                                _BytePtr source = new _BytePtr(gfx.gfxdata, (source_base + (y_index >> 16)) * gfx.line_modulo);
                                _BytePtr dest = dest_bmp.line[y];

                                int x, x_index = x_index_base;
                                for (x = sx; x < ex; x++)
                                {
                                    int c = pal[source[x_index >> 16]];
                                    if (c != transparent_color) dest[x] = (byte)c;
                                    x_index += dx;
                                }

                                y_index += dy;
                            }
                        }
                    }

                }
            }

            /* ASG 980209 -- new 16-bit part */
            else
            {
                if (gfx != null && gfx.colortable != null)
                {
                    UShortSubArray pal = new UShortSubArray(gfx.colortable, (int)(gfx.color_granularity * (color % gfx.total_colors))); /* ASG 980209 */
                    int source_base = (int)((code % gfx.total_elements) * gfx.height);

                    int sprite_screen_height = (scaley * gfx.height + 0x8000) >> 16;
                    int sprite_screen_width = (scalex * gfx.width + 0x8000) >> 16;

                    /* compute sprite increment per screen pixel */
                    int dx = (gfx.width << 16) / sprite_screen_width;
                    int dy = (gfx.height << 16) / sprite_screen_height;

                    int ex = sx + sprite_screen_width;
                    int ey = sy + sprite_screen_height;

                    int x_index_base;
                    int y_index;

                    if (flipx)
                    {
                        x_index_base = (sprite_screen_width - 1) * dx;
                        dx = -dx;
                    }
                    else
                    {
                        x_index_base = 0;
                    }

                    if (flipy)
                    {
                        y_index = (sprite_screen_height - 1) * dy;
                        dy = -dy;
                    }
                    else
                    {
                        y_index = 0;
                    }

                    if (clip != null)
                    {
                        if (sx < clip.min_x)
                        { /* clip left */
                            int pixels = clip.min_x - sx;
                            sx += pixels;
                            x_index_base += pixels * dx;
                        }
                        if (sy < clip.min_y)
                        { /* clip top */
                            int pixels = clip.min_y - sy;
                            sy += pixels;
                            y_index += pixels * dy;
                        }
                        /* NS 980211 - fixed incorrect clipping */
                        if (ex > clip.max_x + 1)
                        { /* clip right */
                            int pixels = ex - clip.max_x - 1;
                            ex -= pixels;
                        }
                        if (ey > clip.max_y + 1)
                        { /* clip bottom */
                            int pixels = ey - clip.max_y - 1;
                            ey -= pixels;
                        }
                    }

                    if (ex > sx)
                    { /* skip if inner loop doesn't draw anything */
                        int y;

                        /* case 1: TRANSPARENCY_PEN */
                        if (transparency == TRANSPARENCY_PEN)
                        {
                            for (y = sy; y < ey; y++)
                            {
                                _BytePtr source = new _BytePtr(gfx.gfxdata, (source_base + (y_index >> 16)) * gfx.line_modulo);
                                _ShortPtr dest = new _ShortPtr(dest_bmp.line[y]);

                                int x, x_index = x_index_base;
                                for (x = sx; x < ex; x++)
                                {
                                    int c = source[x_index >> 16];
                                    if (c != transparent_color) dest[x] = (byte)pal[c];
                                    x_index += dx;
                                }

                                y_index += dy;
                            }
                        }

                        /* case 2: TRANSPARENCY_COLOR */
                        else if (transparency == TRANSPARENCY_COLOR)
                        {
                            for (y = sy; y < ey; y++)
                            {
                                _BytePtr source = new _BytePtr(gfx.gfxdata, (source_base + (y_index >> 16)) * gfx.line_modulo);
                                _ShortPtr dest = new _ShortPtr(dest_bmp.line[y]);

                                int x, x_index = x_index_base;
                                for (x = sx; x < ex; x++)
                                {
                                    int c = pal[source[x_index >> 16]];
                                    if (c != transparent_color) dest.write16(x, (ushort)c);
                                    x_index += dx;
                                }

                                y_index += dy;
                            }
                        }
                    }
                }
            }
        }
Exemple #29
0
        public static void copybitmap(osd_bitmap dest, osd_bitmap src, bool flipx, bool flipy, int sx, int sy, rectangle clip, int transparency, int transparent_color)
        {
            FuncDict["copybitmap"] = "copybitmap";
            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 = sx;
                sx = sy;
                sy = temp;

                bool tb = flipx;
                flipx = flipy;
                flipy = tb;

                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)
                {
                    /* clip and myclip might be the same, so we need a temporary storage */
                    int 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
                copybitmap_core16(dest, src, flipx, flipy, sx, sy, clip, transparency, transparent_color);
        }
Exemple #30
0
 static int rp_8_s(osd_bitmap b, int x, int y) { return b.line[x][y]; }