예제 #1
0
 public static void Unpack8GrayPix(Pix2x8 pix, out byte p0, out byte p1, out byte p2, out byte p3, out byte p4, out byte p5, out byte p6, out byte p7)
 {
     p7 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x0100) >> 7) | ((pix.Value & 0x01) >> 0)));
     p6 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x0200) >> 8) | ((pix.Value & 0x02) >> 1)));
     p5 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x0400) >> 9) | ((pix.Value & 0x04) >> 2)));
     p4 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x0800) >> 10) | ((pix.Value & 0x08) >> 3)));
     p3 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x1000) >> 11) | ((pix.Value & 0x10) >> 4)));
     p2 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x2000) >> 12) | ((pix.Value & 0x20) >> 5)));
     p1 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x4000) >> 13) | ((pix.Value & 0x40) >> 6)));
     p0 = BadgeImage.PixToSrgbGray((byte)(((pix.Value & 0x8000) >> 14) | ((pix.Value & 0x80) >> 7)));
 }
예제 #2
0
        public static int DecodeFillRect(byte[] buffer, int offset, out Target targetBuffer, out byte x, out byte y, out byte width, out byte height, out Pix2x8 value)
        {
            System.Diagnostics.Debug.Assert((CommandCodes)(buffer[offset] >> 4) == CommandCodes.FillRect);

            targetBuffer = (Target)((buffer[offset] >> 2) & 0x3);
            x            = (byte)(buffer[offset + 1] >> 4);
            y            = (byte)(buffer[offset + 1] & 0xF);
            width        = (byte)(buffer[offset + 2] >> 4);
            height       = (byte)(buffer[offset + 2] & 0xF);
            value        = new Pix2x8((ushort)((buffer[offset + 3] << 8) | buffer[offset + 4]));
            return(5);
        }
예제 #3
0
 public static void CreateFillRect(Stream stream, Target targetBuffer, byte x, byte y, byte width, byte height, Pix2x8 value)
 {
     stream.WriteByte((byte)(((byte)CommandCodes.FillRect << 4) | (((byte)targetBuffer & 0x3) << 2)));
     stream.WriteByte((byte)((x << 4) | (y & 0xF)));
     stream.WriteByte((byte)((width << 4) | (height & 0xF)));
     stream.WriteByte((byte)(value.Value >> 8));
     stream.WriteByte((byte)(value.Value & 0xFF));
 }