Example #1
0
            public void SetFileName(String value)
            {
                var byteLen = (Byte)Blitter.ToBytes(_buffer, value.ToUpper(), MaxFileNameLength, FileNameOffset);

                Blitter.ToBytes(_buffer, byteLen, FileNameLengthOffset);
                UpdateWriteRange(FileNameOffset, byteLen);
            }
Example #2
0
            public TileDisplay()
            {
                renderer     = new Blitter();
                tileIndecies = new byte[16, 16];
                buffer       = new Bitmap(256, 256, PixelFormat.Format8bppIndexed);

                SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true);
            }
        public void InitData(HDRenderPipelineRuntimeResources renderPipelineResources)
        {
            m_DebugLightVolumeMaterial       = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.debugLightVolumePS);
            m_DebugLightVolumeCompute        = renderPipelineResources.shaders.debugLightVolumeCS;
            m_DebugLightVolumeGradientKernel = m_DebugLightVolumeCompute.FindKernel("LightVolumeGradient");
            m_DebugLightVolumeColorsKernel   = m_DebugLightVolumeCompute.FindKernel("LightVolumeColors");
            m_ColorGradientTexture           = renderPipelineResources.textures.colorGradient;

            m_Blit = Blitter.GetBlitMaterial(TextureDimension.Tex2D);
        }
Example #4
0
        public override void Update(float dt)
        {
            Blitter.Begin(_surface.Texture);

            if (Input.MouseLeftPressed())
            {
                Console.WriteLine("Mouse Pressed");

                int local_x = (int)(Input.MousePos.X - _surface.X);
                int local_y = (int)(Input.MousePos.Y - _surface.Y);

                Blitter.SetColor(Color.Black);

                Blitter.FillRect(local_x - 16, local_y - 16, 32, 32);
            }

            if (Input.MouseRightPressed())
            {
                Console.WriteLine("Mouse Right Pressed");

                int local_x = (int)(Input.MousePos.X - _surface.X);
                int local_y = (int)(Input.MousePos.Y - _surface.Y);

                Blitter.Blit(_paste, local_x - 32, local_y - 32, Rect.Empty, 64, 64);
            }

            if (Input.KeyPressed(Keys.A))
            {
                Blitter.ColorAdd(255, 255, 255, 0);
            }

            if (Input.KeyPressed(Keys.Left))
            {
                Blitter.PixelShift(-16, 0);
            }

            if (Input.KeyPressed(Keys.Right))
            {
                Blitter.PixelShift(16, 0);
            }

            if (Input.KeyPressed(Keys.Up))
            {
                Blitter.PixelShift(0, -16);
            }

            if (Input.KeyPressed(Keys.Down))
            {
                Blitter.PixelShift(0, 16);
            }

            Blitter.End();
        }
Example #5
0
        public override void Load()
        {
            paste = Pixmap.Create(16, 16, Color.Orange);

            Blitter.Begin(paste);

            Blitter.Rect(0, 0, 8, 8, Color.Blue);
            Blitter.Rect(8, 8, 8, 8, Color.Blue);

            Blitter.End();

            surface = new Sprite(Texture2D.Create(512, 512, Color.White));
            surface.SetOrigin(0, 0);
            surface.SetPosition(Engine.Canvas.Width / 2 - surface.Width / 2, Engine.Canvas.Height / 2 - surface.Height / 2);

            Input.OnKeyPress += Input_OnKeyPress;
        }
Example #6
0
        public void Draw(Canvas2D canvas)
        {
            if (_refresh)
            {
                Console.WriteLine("Redraw Gui");

                Blitter.Begin(_surface);

                Blitter.Clear();

                _root.Draw(Drawer);

                if (DebugMode)
                {
                    Blitter.DrawText(10, 10, $"Hovered: {HoveredWidget?.Id ?? "None"}");
                    Blitter.DrawText(10, 35, $"Active: {ActiveWidget?.Id ?? "None"}");
                    Blitter.DrawText(10, 65, $"Input Focused: {InputFocusedWidget?.Id ?? "None"}");

                    //for (int i = 0; i < _widgets.Count; ++i)
                    //{
                    //    var w = _widgets[i];
                    //    blitter.Text(10, 50 + (i) * 10, $"{w.Id} [ZIndex: {w.ZIndex}]", 1);
                    //}
                }

                Blitter.End();

                _refresh = false;
            }



            canvas.Begin();

            canvas.DrawQuad(in _quad, _surface);

            canvas.End();
        }
Example #7
0
 public void SetDataLength(UInt16 value) => UpdateWriteRange(DataLengthOffset, Blitter.ToBytes(_buffer, value, DataLengthOffset));
Example #8
0
 public void SetBlockId(UInt16 value) => UpdateWriteRange(BlockIdOffset, Blitter.ToBytes(_buffer, value, BlockIdOffset));
Example #9
0
 public void SetMarker(Byte value) => UpdateWriteRange(MarkerOffset, Blitter.ToBytes(_buffer, value, MarkerOffset));
Example #10
0
 public DateTime GetCreationTime() => Blitter.GetDateTime(_buffer, CreationTimeOffset);
Example #11
0
 public String GetFileName() => Blitter.GetString(_buffer, GetFileNameLength(), FileNameOffset);
Example #12
0
        void RenderingCallback(IntPtr surface, IntPtr userData)
        {
            if (image24_ == null && image32_ == null && image565_ == null &&
                image555_ == null)
            {
                image24_ = new Bitmap(this.Width, this.Height,
                                      System.Drawing.Imaging.PixelFormat.Format24bppRgb);

                Font  font  = new Font("Arial", 12);
                Brush brush = new SolidBrush(Color.White);
                using (Graphics g = Graphics.FromImage(image24_))
                {
                    g.FillEllipse(new SolidBrush(Color.Blue), 0, 0, this.Width, this.Height);
                    g.DrawString("24-bit RGB", font, brush, 0, 0);
                }

                image32_ = new Bitmap(this.Width, this.Height,
                                      System.Drawing.Imaging.PixelFormat.Format32bppRgb);
                using (Graphics g = Graphics.FromImage(image32_))
                {
                    g.FillEllipse(new SolidBrush(Color.Blue), 0, 0, this.Width, this.Height);
                    g.DrawString("32-bit RGB", font, brush, 0, 0);
                }

                image555_ = new Bitmap(this.Width, this.Height,
                                       System.Drawing.Imaging.PixelFormat.Format16bppRgb555);
                using (Graphics g = Graphics.FromImage(image555_))
                {
                    g.FillEllipse(new SolidBrush(Color.Blue), 0, 0, this.Width, this.Height);
                    g.DrawString("16-bit RGB 555", font, brush, 0, 0);
                }

                image565_ = new Bitmap(this.Width, this.Height,
                                       System.Drawing.Imaging.PixelFormat.Format16bppRgb565);
                using (Graphics g = Graphics.FromImage(image565_))
                {
                    g.FillEllipse(new SolidBrush(Color.Blue), 0, 0, this.Width, this.Height);
                    g.DrawString("16-bit RGB 565", font, brush, 0, 0);
                }
            }

            switch (imageToBlit)
            {
            case 0:
                Blitter.Blit(surface, 0, 0, image32_, 0, 0);
                break;

            case 1:
                Blitter.Blit(surface, 0, 0, image24_, 0, 0);
                break;

            case 2:
                Blitter.Blit(surface, 0, 0, image565_, 0, 0);
                break;

            case 3:
                Blitter.Blit(surface, 0, 0, image555_, 0, 0);
                break;
            }

            imageToBlit++;
            if (imageToBlit > 3)
            {
                imageToBlit = 0;
            }
        }
Example #13
0
 public UInt16 GetBlockId() => Blitter.GetUInt16(_buffer, BlockIdOffset);
Example #14
0
 public UInt16 GetObjId() => Blitter.GetUInt16(_buffer, ObjIdOffset);
Example #15
0
 public Byte GetMarker() => Blitter.GetByte(_buffer, MarkerOffset);
Example #16
0
 public UInt16 GetDataLength() => Blitter.GetUInt16(_buffer, DataLengthOffset);
Example #17
0
 public void SetCreationTime(DateTime value) => UpdateWriteRange(CreationTimeOffset, Blitter.ToBytes(_buffer, value, CreationTimeOffset));
Example #18
0
 private Byte GetFileNameLength() => Blitter.GetByte(_buffer, FileNameLengthOffset);
Example #19
0
 private void Start()
 {
     m_Wrapper = new NativeTextureWrapper();
     m_Blitter = new Blitter();
 }
Example #20
0
 /// <summary>
 /// Applies the binary operation specified by the <paramref name="mode"/> to all
 /// pixel pairs taken from the source image <paramref name="ip"/> and the target image
 /// (the image on which this method is invoked) and stores the result in the targtet
 /// image. <paramref name="u"/> and <paramref name="v"/> are the coordinates where the source
 /// image is inserted into the target image (usually they are 0).
 /// </summary>
 public void CopyBits(ImageProcessor ip, int u, int v, Blitter mode)
 {
 }