| 756 | } |
| 757 | |
| 758 | static Handle<Value> sdl::GetRGBA(const Arguments& args) { |
| 759 | HandleScope scope; |
| 760 | |
| 761 | if (!(args.Length() == 2 && args[0]->IsNumber() && args[1]->IsObject())) { |
| 762 | return ThrowException(Exception::TypeError(String::New("Invalid arguments: Expected GetRGBA(Number, PixelFormat)"))); |
| 763 | } |
| 764 | |
| 765 | int pixel = args[0]->Int32Value(); |
| 766 | SDL_PixelFormat* fmt = UnwrapPixelFormat(args[1]->ToObject()); |
| 767 | ::Uint8 r, g, b, a; |
| 768 | |
| 769 | SDL_GetRGBA(pixel, fmt, &r, &g, &b, &a); |
| 770 | |
| 771 | Local<Object> rgba = Object::New(); |
| 772 | rgba->Set(String::New("r"), Number::New(r)); |
| 773 | rgba->Set(String::New("g"), Number::New(g)); |
| 774 | rgba->Set(String::New("b"), Number::New(b)); |
| 775 | rgba->Set(String::New("a"), Number::New(a)); |
| 776 | |
| 777 | return scope.Close(rgba); |
| 778 | } |
| 779 | |
| 780 | |
| 781 | static Handle<Value> sdl::TTF::Init(const Arguments& args) { |
nothing calls this directly
no test coverage detected