func (e *Element) At(x, y int) color.Color { offset := gfx.GetPixelOffset(x, y, e.Width) return color.RGBA{ R: e.Buffer[offset+I_R], G: e.Buffer[offset+I_G], B: e.Buffer[offset+I_B], A: e.Buffer[offset+I_A], } }
func (fb *Framebuffer) At(x, y int) color.Color { offset := gfx.GetPixelOffset(x, y, int(fb.Vinfo.Xres)) return color.RGBA{ R: fb.MemOffscreen[offset+I_R], G: fb.MemOffscreen[offset+I_G], B: fb.MemOffscreen[offset+I_B], A: fb.MemOffscreen[offset+I_A], } }
func (e *Element) Set(x, y int, c color.Color) { offset := gfx.GetPixelOffset(x, y, e.Width) r, g, b, a := c.RGBA() // since image.Draw works with RGBA64 internally we need to convert the color value to RGBA before writing // to the framebuffer - hence the div 256 e.Buffer[offset+I_R] = uint8(r / 256) e.Buffer[offset+I_G] = uint8(g / 256) e.Buffer[offset+I_B] = uint8(b / 256) e.Buffer[offset+I_A] = uint8(a / 256) }
func (fb *Framebuffer) Set(x, y int, c color.Color) { offset := gfx.GetPixelOffset(x, y, int(fb.Vinfo.Xres)) r, g, b, a := c.RGBA() // since image.Draw works with RGBA64 internally we need to convert the color value to RGBA before writing // to the framebuffer - hence the div 256 fb.MemOffscreen[offset+I_R] = uint8(r / 256) fb.MemOffscreen[offset+I_G] = uint8(g / 256) fb.MemOffscreen[offset+I_B] = uint8(b / 256) fb.MemOffscreen[offset+I_A] = uint8(a / 256) }