public void SetFileName(String value) { var byteLen = (Byte)Blitter.ToBytes(_buffer, value.ToUpper(), MaxFileNameLength, FileNameOffset); Blitter.ToBytes(_buffer, byteLen, FileNameLengthOffset); UpdateWriteRange(FileNameOffset, byteLen); }
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); }
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(); }
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; }
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(); }
public void SetDataLength(UInt16 value) => UpdateWriteRange(DataLengthOffset, Blitter.ToBytes(_buffer, value, DataLengthOffset));
public void SetBlockId(UInt16 value) => UpdateWriteRange(BlockIdOffset, Blitter.ToBytes(_buffer, value, BlockIdOffset));
public void SetMarker(Byte value) => UpdateWriteRange(MarkerOffset, Blitter.ToBytes(_buffer, value, MarkerOffset));
public DateTime GetCreationTime() => Blitter.GetDateTime(_buffer, CreationTimeOffset);
public String GetFileName() => Blitter.GetString(_buffer, GetFileNameLength(), FileNameOffset);
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; } }
public UInt16 GetBlockId() => Blitter.GetUInt16(_buffer, BlockIdOffset);
public UInt16 GetObjId() => Blitter.GetUInt16(_buffer, ObjIdOffset);
public Byte GetMarker() => Blitter.GetByte(_buffer, MarkerOffset);
public UInt16 GetDataLength() => Blitter.GetUInt16(_buffer, DataLengthOffset);
public void SetCreationTime(DateTime value) => UpdateWriteRange(CreationTimeOffset, Blitter.ToBytes(_buffer, value, CreationTimeOffset));
private Byte GetFileNameLength() => Blitter.GetByte(_buffer, FileNameLengthOffset);
private void Start() { m_Wrapper = new NativeTextureWrapper(); m_Blitter = new Blitter(); }
/// <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) { }