Complete configuration object for fractal generation
Uint8ClampedArray containing RGBA pixel data (4 bytes per pixel)
import { generateMandelbrotData } from './mandelbrot.js';
const config: MandelbrotConfig = {
width: 800,
height: 600,
centerX: -0.5,
centerY: 0,
zoom: 1,
maxIterations: 100,
escapeRadius: 2,
colorPalette: 'classic'
};
const imageData = generateMandelbrotData(config);
// imageData is ready to be used with Canvas ImageData constructor
const canvas = document.getElementById('canvas') as HTMLCanvasElement;
const ctx = canvas.getContext('2d')!;
const imgData = new ImageData(imageData, config.width, config.height);
ctx.putImageData(imgData, 0, 0);
Generates RGBA image data for the complete Mandelbrot fractal
This function creates a pixel-by-pixel representation of the Mandelbrot set by sampling each point in the complex plane and computing its escape time. The resulting iteration counts are mapped to colors using the specified palette.