Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function META:Fill(callback)
- check(callback, "function")
- local img = self:GetPixelTable(true)
- local w = self:GetSize()
- local x, y = 0, 0
- for i = 0, self:GetPixelLength() do
- if x >= w then
- x = 0
- y = y + 1
- else
- x = x + 1
- end
- local r, g, b, a = callback(x, y, img[i].r, img[i].g, img[i].b, img[i].a)
- img[i].r = r*255 or img[i].r
- img[i].g = g*255 or img[i].g
- img[i].b = b*255 or img[i].b
- img[i].a = a*255 or img[i].a
- end
- self:SetPixelTable(img)
- end
Advertisement
Add Comment
Please, Sign In to add comment