Function to scale surfaces... Scale(surface,ratio,newsurface)

Sombody know where i can find a function like that or how can y program it?
a function that for example if a have a surface of 200100 and i use the function with a ratio of 0.5 its reduces it a half… the new surface will be a surface of 10050…
Can you undestand?