public static SkryptObject Resize(SkryptEngine engine, SkryptObject self, Arguments arguments) { var width = arguments.GetAs <NumberInstance>(0); var height = arguments.GetAs <NumberInstance>(1); var newBitMap = ResizeBitmap(self.AsType <ImageInstance>().bitMap, (int)width, (int)height); self.AsType <ImageInstance>().bitMap = newBitMap; self.SetProperty("Width", width); self.SetProperty("Height", height); return(null); }
public static SkryptObject GetPixel(SkryptEngine engine, SkryptObject self, Arguments arguments) { var x = arguments.GetAs <NumberInstance>(0); var y = arguments.GetAs <NumberInstance>(1); var color = self.AsType <ImageInstance>().bitMap.GetPixel((int)x, (int)y); return(engine.GetValue("Color").AsType <ColorType>().Construct(color.R, color.G, color.B)); }
public static SkryptObject SetPixel(SkryptEngine engine, SkryptObject self, Arguments arguments) { var x = arguments.GetAs <NumberInstance>(0); var y = arguments.GetAs <NumberInstance>(1); var color = arguments.GetAs <ColorInstance>(2); self.AsType <ImageInstance>().bitMap.SetPixel((int)x, (int)y, color.color); return(null); }