Esempio n. 1
0
        public byte[] GetCpcScr(Param param, bool spriteMode = false)
        {
            int maxSize = (BitmapCpc.TailleX >> 3) + ((BitmapCpc.TailleY - 2) >> 4) * (BitmapCpc.TailleX >> 3) + ((BitmapCpc.TailleY - 2) & 14) * 0x400;

            if (spriteMode)
            {
                maxSize = (BitmapCpc.TailleX * BitmapCpc.TailleY) >> 4;
            }
            else
            if (maxSize >= 0x4000)
            {
                maxSize += 0x3800;
            }

            byte[] ret = new byte[maxSize];
            Array.Clear(ret, 0, ret.Length);
            int posRet = 0;

            for (int y = 0; y < BitmapCpc.TailleY; y += 2)
            {
                int adrCPC = BitmapCpc.GetAdrCpc(y);
                int tx     = BitmapCpc.CalcTx(y);
                for (int x = 0; x < BitmapCpc.TailleX; x += 8)
                {
                    byte pen = 0, octet = 0;
                    for (int p = 0; p < 8; p++)
                    {
                        if ((p % tx) == 0)
                        {
                            RvbColor col = BmpLock.GetPixelColor(x + p, y);
                            if (BitmapCpc.cpcPlus)
                            {
                                for (pen = 0; pen < 16; pen++)
                                {
                                    if ((col.v >> 4) == (BitmapCpc.Palette[pen] >> 8) && (col.r >> 4) == ((BitmapCpc.Palette[pen] >> 4) & 0x0F) && (col.b >> 4) == (BitmapCpc.Palette[pen] & 0x0F))
                                    {
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                for (pen = 0; pen < 16; pen++)
                                {
                                    RvbColor fixedCol = BitmapCpc.RgbCPC[BitmapCpc.Palette[pen]];
                                    if (fixedCol.r == col.r && fixedCol.b == col.b && fixedCol.v == col.v)
                                    {
                                        break;
                                    }
                                }
                            }
                            octet |= (byte)(tabOctetMode[pen] >> (p / tx));
                        }
                    }
                    if (!spriteMode)
                    {
                        posRet = BitmapCpc.GetAdrCpc(y) + (x >> 3);
                    }

                    ret[posRet++] = octet;
                }
            }
            return(ret);
        }
Esempio n. 2
0
 public void SauvePalette(string fileName, Param param)
 {
     SauveImage.SauvePalette(fileName, this, param);
     main.SetInfo("Sauvegarde palette ok.");
 }
Esempio n. 3
0
 public void SauveScr(string fileName, Param param)
 {
     bitmapCpc.CreeBmpCpc(BmpLock, colMode5);
     SauveImage.SauveScr(fileName, bitmapCpc, this, param, false);
     main.SetInfo("Sauvegarde image CPC ok.");
 }