Let the coordinates of the point \(P\) be \((x,y)\).
The distance of \(P\) from the point \((1,1)\) is given by:
\[
d_1 = \sqrt{(x-1)^2 + (y-1)^2}.
\]
The distance of \(P\) from the line \(x - y + 2 = 0\) is given by the formula for the distance from a point to a line:
\[
d_2 = \frac{|x - y + 2|}{\sqrt{1^2 + (-1)^2}} = \frac{|x - y + 2|}{\sqrt{2}}.
\]
According to the given condition, the ratio of these distances is:
\[
\frac{d_1}{d_2} = \frac{1}{\sqrt{2}}.
\]
Thus,
\[
\frac{\sqrt{(x-1)^2 + (y-1)^2}}{\frac{|x - y + 2|}{\sqrt{2}}} = \frac{1}{\sqrt{2}}.
\]
Simplifying:
\[
\sqrt{2} \sqrt{(x-1)^2 + (y-1)^2} = |x - y + 2|.
\]
Squaring both sides:
\[
2((x-1)^2 + (y-1)^2) = (x - y + 2)^2.
\]
Expanding both sides:
\[
2(x^2 - 2x + 1 + y^2 - 2y + 1) = x^2 - 2xy + y^2 + 4x - 4y + 4.
\]
Simplifying:
\[
2x^2 - 4x + 2 + 2y^2 - 4y + 2 = x^2 - 2xy + y^2 + 4x - 4y + 4.
\]
Collecting like terms:
\[
x^2 + 2xy + 3y^2 - 12x - 4y + 4 = 0.
\]
Thus, the equation of the locus of \(P\) is \(\boxed{3x^2 + 2xy + 3y^2 - 12x - 4y + 4 = 0}\).