bitmap

Generated by tinox doc

An in-memory RGB(A)-style pixel buffer with basic 2D drawing primitives: create, get/setPixel, fillRect, drawLine, drawCircle.

ModuleVersionGroup
mathf1.0.0tinox.core

Draw shapes

import tinox.core.bitmap;

class Main
{
    fnc main() -> Int32
    {
        let img: Bitmap = Bitmap::create(64, 64, 0);
        Bitmap::fillRect(img, 10, 10, 20, 20, 16711680);
        Bitmap::drawLine(img, 0, 0, 63, 63, 65280);
        Bitmap::drawCircle(img, 32, 32, 10, 255);

        println("pixel at (15,15): " + Bitmap::getPixel(img, 15, 15).toString());
        return 0;
    }
}

class Bitmap

Fields

widthInt64
heightInt64
pixelsList<Int64>

Methods

fn create(width: Int64, height: Int64, color: Int64) → Bitmap
fn getPixel(bitmap: Bitmap, x: Int64, y: Int64) → Int64
fn setPixel(bitmap: Bitmap, x: Int64, y: Int64, color: Int64) → Nothing
fn fillRect(bitmap: Bitmap, x: Int64, y: Int64, w: Int64, h: Int64, color: Int64) → Nothing
fn drawLine(bitmap: Bitmap, x0: Int64, y0: Int64, x1: Int64, y1: Int64, color: Int64) → Nothing
fn drawCircle(bitmap: Bitmap, cx: Int64, cy: Int64, radius: Int64, color: Int64) → Nothing