Skip to content

Commit c411267

Browse files
committed
0 is the image, 1 is x, and 2 is y. :|
1 parent 0dfd515 commit c411267

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/robotjs.cc

+11-11
Original file line numberDiff line numberDiff line change
@@ -746,37 +746,37 @@ BMP buildBMP(Local<Object> info)
746746

747747
char* buf = node::Buffer::Data(obj->Get(Nan::New("image").ToLocalChecked()));
748748

749-
//Convert the buffer to a uint8_t which createMMBitmap requires.
749+
//Convert the buffer to a uint8_t which createMMBitmap requires.
750750
img.image = (uint8_t *)malloc(img.byteWidth * img.height);
751751
memcpy(img.image, buf, img.byteWidth * img.height);
752752

753753
return img;
754754
}
755755

756-
NAN_METHOD(getColor)
757-
{
756+
NAN_METHOD(getColor)
757+
{
758758
MMBitmapRef bitmap;
759759
MMRGBHex color;
760-
761-
size_t x = info[0]->Int32Value();
762-
size_t y = info[1]->Int32Value();
763-
760+
761+
size_t x = info[1]->Int32Value();
762+
size_t y = info[2]->Int32Value();
763+
764764
//Get our image object from JavaScript.
765765
BMP img = buildBMP(Nan::To<v8::Object>(info[0]).ToLocalChecked());
766-
766+
767767
//Create the bitmap.
768768
bitmap = createMMBitmap(img.image, img.width, img.height, img.byteWidth, img.bitsPerPixel, img.bytesPerPixel);
769769

770770
color = MMRGBHexAtPoint(bitmap, x, y);
771771

772772
char hex[7];
773-
773+
774774
padHex(color, hex);
775775

776776
destroyMMBitmap(bitmap);
777-
777+
778778
info.GetReturnValue().Set(Nan::New(hex).ToLocalChecked());
779-
779+
780780
}
781781

782782
NAN_MODULE_INIT(InitAll)

0 commit comments

Comments
 (0)