protected override unsafe void RedrawView()
        {
            //Darken the frame
            for (int i = 0; i < Height - MENU_HEIGHT; i++)
            {
                DisplayPixel *line = GetPixelPointer(0, i);
                for (int x = 0; x < Width; x++)
                {
                    line[x].r /= 3;
                    line[x].g /= 3;
                    line[x].b /= 3;
                }
            }

            //Draw the background
            UtilFill(StaticColors.COLOR_FOREGROUND_BG, 0, Height - MENU_HEIGHT, Width, MENU_HEIGHT);

            //Draw the tab labels
            for (int i = 0; i < tabs.Length; i++)
            {
                int offsetX = PADDING;
                int offsetY = (Height - MENU_HEIGHT) + PADDING + (i * TAB_LABEL_HEIGHT);
                if (i == currentTab)
                {
                    UtilFill(StaticColors.COLOR_FOREGROUND_INPUT_BG, offsetX, offsetY, TAB_LABEL_WIDTH, TAB_LABEL_HEIGHT);
                }
                if (i == currentTab && !currentTabSelected)
                {
                    UtilOutline(StaticColors.COLOR_SELECTION, offsetX, offsetY, TAB_LABEL_WIDTH, TAB_LABEL_HEIGHT, 1);
                }
                FontStore.SYSTEM_REGULAR_15.RenderPretty(GetOffsetContext(offsetX + 5, offsetY), tabs[i].DisplayName.ToCharArray(), DisplayPixel.WHITE, AlignHorizontal.Left, AlignVertical.Center, TAB_LABEL_WIDTH - 10, TAB_LABEL_HEIGHT);
            }
        }
Beispiel #2
0
 public unsafe void ReportFrame(DisplayPixel *pixel, int width, int height)
 {
     if (screenStreamer.HasClient)
     {
         BitConverter.GetBytes(width).CopyTo(buffer, HEADER_LENGTH + 0);
         BitConverter.GetBytes(height).CopyTo(buffer, HEADER_LENGTH + 4);
         SendCommand(OP_SCREENCAP_FRAME, 8, screenStreamer.Client);
         screenStreamer.ReportData(width * height, pixel);
     }
 }
Beispiel #3
0
        private void RecreateBuffers()
        {
            //Destory buffers
            waterfallBuffer?.Dispose();
            waterfallQueueBuffer?.Dispose();

            //Create buffers
            waterfallBuffer         = UnsafeBuffer.Create(Width * Height, sizeof(DisplayPixel));
            waterfallBufferPtr      = (DisplayPixel *)waterfallBuffer;
            waterfallQueueBuffer    = UnsafeBuffer.Create(Width, sizeof(DisplayPixel));
            waterfallQueueBufferPtr = (DisplayPixel *)waterfallQueueBuffer;
        }
Beispiel #4
0
        public static unsafe void Mix(DisplayPixel *a, DisplayPixel *b, float aPercent, DisplayPixel *output)
        {
            float bPercent = 1 - aPercent;
            byte *cA       = (byte *)a;
            byte *cB       = (byte *)b;
            byte *cO       = (byte *)output;

            for (int i = 0; i < 4; i++)
            {
                cO[i] = (byte)((aPercent * cA[i]) + (bPercent * cB[i]));
            }
        }
Beispiel #5
0
        public unsafe void RenderCharacter(IDrawingContext ctx, char c, DisplayPixel color)
        {
            //Make sure we have this
            if (!font.ContainsKey(c))
            {
                return;
            }

            //Get lines
            byte[] data = font[c];

            //Copy
            for (int y = 0; y < height; y++)
            {
                //Get pointer and offset
                DisplayPixel *line   = ctx.GetPixelPointer(0, y);
                int           offset = width * y;

                //Transfer
                for (int x = 0; x < width; x++)
                {
                    //Cheap out
                    if (data[offset + x] == byte.MaxValue)
                    {
                        line[x] = color;
                    }
                    else if (data[offset + x] == 0)
                    {
                        continue;
                    }

                    //Mix
                    DisplayPixel.Mix(&color, line + x, data[offset + x] / 255f, line + x);
                }
            }
        }