I'm not sure if there is a library or demo on this (and if there is, please point it out to me), but I would like to know how to dynamically create an icon. For example, let's say I wanted to create myself a grass icon, but I am too lazy to icon it the traditional way, and wanted to create a grass icon through the programming using a bunch of randomly place multi-green-shaded pixels. How would I go about doing this?
I took a quick look at the icon procs listed by the Reference and saw the GetPixel proc. I think I would be using this proc, but am unsure of how to utilize it. This is something I have never done, sadly.
ID:273731
Feb 16 2011, 1:55 am
|
|
In response to Toadfish
|
|
And then how would I save such icon as an actual .dmi file?
Would I do this to create the random values? var/icon/i = new |
In response to Spunky_Girl
|
|
I'm pretty sure we have such procs as ftp for saving. You would do something like "usr << ftp(icon file)".
To decide on a random color value, you can do something like rgb(0,rand(100,200),0). However, you want to randomise the value again for every box. So no, your example won't work, it will create one big green rectangle. You need to loop through every coordinate. |
In response to Toadfish
|
|
var/icon/i = new This is all I would have to do? EDIT The ftp proc is not what I want, I don't think. It didn't work. I tried doing a savefile instead, but that did not work either. var/savefile/s = new("Dynamic Grass.dmi") |
In response to Spunky_Girl
|
|
var/icon/i = new('blank.dmi') // icon with one empty icon state |
In response to Toadfish
|
|
Ohhh... I was using the same file that that I did in the icon/new proc, in the ftp proc. Thank you so much, Toadfish :)
|
for every coordinate in icon
decide on a random, green color value
use DrawBox to fill that coordinate with a rectangle of that color