// First, find rectangle that covers the rotated image; to do that,
// rotate the four corners
- const wxRotationPoint & p0 = centre_of_rotation;
+ const wxRotationPoint p0 = centre_of_rotation;
wxRotationPoint p1 = rotated_point (0, 0, cos_angle, sin_angle, p0);
wxRotationPoint p2 = rotated_point (0, img.GetHeight(), cos_angle, sin_angle, p0);
wxRotationPoint p3 = rotated_point (img.GetWidth(), 0, cos_angle, sin_angle, p0);
wxRotationPoint p4 = rotated_point (img.GetWidth(), img.GetHeight(), cos_angle, sin_angle, p0);
- int x1 = floor (min (min(p1.x, p2.x), min(p3.x, p4.x)));
- int y1 = floor (min (min(p1.y, p2.y), min(p3.y, p4.y)));
+ int x1 = (int) floor (wxMin (wxMin(p1.x, p2.x), wxMin(p3.x, p4.x)));
+ int y1 = (int) floor (wxMin (wxMin(p1.y, p2.y), wxMin(p3.y, p4.y)));
- int x2 = ceil (max (max(p1.x, p2.x), max(p3.x, p4.x)));
- int y2 = ceil (max (max(p1.y, p2.y), max(p3.y, p4.y)));
+ int x2 = (int) ceil (wxMax (wxMax(p1.x, p2.x), wxMax(p3.x, p4.x)));
+ int y2 = (int) ceil (wxMax (wxMax(p1.y, p2.y), wxMax(p3.y, p4.y)));
wxImage rotated (x2 - x1 + 1, y2 - y1 + 1);
else
{
// weights for the weighted average are proportional to the inverse of the distance
- const w1 = 1/d1, w2 = 1/d2, w3 = 1/d3, w4 = 1/d4;
+ const double w1 = 1/d1, w2 = 1/d2, w3 = 1/d3, w4 = 1/d4;
for (int i = 0; i < 3; i++) // repeat calculation for R, G, and B
{
result_data[y][x].rgb[i] =
- static_cast<unsigned char> ( (w1 * v1.rgb[i] + w2 * v2.rgb[i] +
+ (unsigned char) ( (w1 * v1.rgb[i] + w2 * v2.rgb[i] +
w3 * v3.rgb[i] + w4 * v4.rgb[i]) /
(w1 + w2 + w3 + w4) );
}
}
else
{
- const int & xs = wxCint (src.x); // wxCint performs rounding to the
- const int & ys = wxCint (src.y); // closest integer
+ const int xs = wxCint (src.x); // wxCint performs rounding to the
+ const int ys = wxCint (src.y); // closest integer
if (0 <= xs && xs < img.GetWidth() &&
0 <= ys && ys < img.GetHeight())