Drawing image from array values

Post Reply
matt7
Posts: 115
Joined: Sun Jul 12, 2015 5:00 pm
My devices: iPhone
Location: USA

Drawing image from array values

Post by matt7 »

I have looked through the documentation and cannot find a quick way to convert an array of values to an image.

Let's say I have a 3-dimensional array sized N x M x 3. N x M is the size of my image in pixels, and I have three layers which contain R, G, and B values. (Or maybe I want to include a fourth layer with alpha values, or maybe only one layer for a black and white image.)

Currently I am looping through i (0 to N-1) and j (0 to M-1) values and drawing each pixel which is very time consuming. Is there a faster or simpler way to draw the image using data in this format that I'm missing?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Drawing image from array values

Post by Mr. Kibernetik »

No, currently smart BASIC cannot work with raw bitmaps.
Depending on what kind of bitmap data you have, you can yourself create for example BMP image file (which is basically a raw bitmap) from your data and then draw it.

matt7
Posts: 115
Joined: Sun Jul 12, 2015 5:00 pm
My devices: iPhone
Location: USA

Re: Drawing image from array values

Post by matt7 »

Ah, ok I will look into that. Thank you!

Post Reply