[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering
From: |
Arvinder Bhathal |
Subject: |
Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering |
Date: |
Fri, 23 Jun 2017 13:24:55 -0400 |
> I wanted to know if anyone knew how to display the pixel grid
> (like the one in ftgrid) on webpage. (Arvinder ?)
If the goal is just to have a grid of some size with pixel-level
control, then a canvas of the appropriate size would do.
// create a blank canvas
<canvas id="canvas" width="100" height ="100"></canvas>
In JS:
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
// get a pixel from the canvas
var pixel= ctx.getImageData(x-coord, y-coord, 1, 1);
// pixelData is an array of unsigned 8-bit integers representing
pixel data in RGBA order. If 'pixel' was more than a single pixel, the
data would be ordered row by row
var pixelData = pixel.data;
// make the pixel black
pixelData[0] = 0;
pixelData[1] = 0;
pixelData[2] = 0;
// write the pixel back to the canvas
ctx.putImageData(pixel, x-coord, y-coord);
Is this any help? I think I may have missed the goal of what you
wanted from the grid since the resulting image from all the above
could just be done in C.
- [ft-devel] [GSoC] [Doubt] Bitmap rendering, k kushal, 2017/06/14
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, k kushal, 2017/06/18
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, Werner LEMBERG, 2017/06/18
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, k kushal, 2017/06/19
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, Werner LEMBERG, 2017/06/20
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, k kushal, 2017/06/23
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering,
Arvinder Bhathal <=
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, k kushal, 2017/06/23
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, Arvinder Bhathal, 2017/06/23
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, Werner LEMBERG, 2017/06/24
- Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, k kushal, 2017/06/25
Re: [ft-devel] [GSoC] [Doubt] Bitmap rendering, Werner LEMBERG, 2017/06/18