Author Topic: Pixel Color  (Read 3168 times)


Actually this is perfect! I can put a bitmap image over the play gui and get pixel colours from there.

Ladios' method is pretty neat though - A.C.M City


Wow. This is cool.

The issue with very big builds is that my monitor is not large enough to take a screenshot of the end product. Is it possible to save a bitmap image from a gui?

The issue with very big builds is that my monitor is not large enough to take a screenshot of the end product. Is it possible to save a bitmap image from a gui?
I know the DOF screenshot is able to output files larger than the screensize, but I agree a direct to file outputter thing would be more useful. Is there any documentation on how the server preview image saves its data?

Is it possible to save a bitmap image from a gui?
What do you mean? If there is a bitmap in Blockland, then the file already exists somewhere in the Blockland folder.

I know the DOF screenshot is able to output files larger than the screensize, but I agree a direct to file outputter thing would be more useful. Is there any documentation on how the server preview image saves its data?
I've been looking for how the server preview works everywhere with no luck :( I assume it works much the same way as the way I do it though, with "scans".

What do you mean? If there is a bitmap in Blockland, then the file already exists somewhere in the Blockland folder.
I mean, if it's possible to save the image inside a bitmap gui control object.

I mean, if it's possible to save the image inside a bitmap gui control object.
But there's no point. Any image used in a GuiBitmapCtrl already exists. Just look at it's file path.

If you don't use any image for it, the background becomes the image :p

Actually it's significantly easier than this. Sorry that I didn't get here sooner.

The GuiBitmapCtrl has a getPixelColor( x , y ) method. If you don't bind an image it'll get the pixel color of the pixel behind it. It also isn't constrained by the bounds of the object.

So..


function getPixelColor(%x, %y) {
    if(!isObject(getPixelColorObject))
        new GuiBitmapCtrl(getPixelColorObject) { position = "0 0"; extent = "0 0"; };
    return getPixelColorObject.getPixelC olor(%x, %y);
}


That should work perfectly for you.

.. or at least i assume
« Last Edit: May 16, 2015, 09:37:25 AM by General »

The background does become the image. I actually think GuiBitmapCtrl::getPixelColor is broken; I believe 0,0 is always 0,0 on your monitor regardless of the location of the bitmap control on your screen. Oddly enough it scans your screen to get the pixel instead of getting the pixel data from the image it contains, which is what the function implies from its name. I discovered this odd behavior with Trigun while trying to find a way to send image data across a connection (loading the image into a bitmap control then getting the color of each pixel and sending the color data).