A working configure&makefile; now in the process of getting it to build on gcc

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@182 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-01-28 22:38:59 +00:00
parent fc03b5efa1
commit 1cd80a3710
18 changed files with 8146 additions and 33 deletions
+1 -1
View File
@@ -249,4 +249,4 @@ bool intersect_line_ray(const Vector2D& p1, const Vector2D& p2, const Vector2D&
double intersectX = p1.x + t * dx;
return intersectX <= pos.x; // intersection is left of pos
}
}
}
+3 -3
View File
@@ -37,9 +37,9 @@ void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2
// d = a * (w^2 x1 dx + h^2 y1 dy)
if (x1==x2 && y1==y2) throw Error(_ERROR_("coordinates for blending overlap"));
double a = fixed / (sqr(width) * sqr(x1-x2) + sqr(height) * sqr(y1-y2));
int xm = (x2 - x1) * width * a;
int ym = (y2 - y1) * height * a;
int d = - (x1 * width * xm + y1 * width * ym);
int xm = to_int( (x2 - x1) * width * a );
int ym = to_int( (y2 - y1) * height * a );
int d = to_int( - (x1 * width * xm + y1 * width * ym) );
Byte *data1 = img1.GetData(), *data2 = img2.GetData();
// blend pixels
+6 -6
View File
@@ -11,9 +11,9 @@
// ----------------------------------------------------------------------------- : Color utility functions
Color lerp(const Color& a, const Color& b, double t) {
return Color(a.Red() + (b.Red() - a.Red() ) * t,
a.Green() + (b.Green() - a.Green()) * t,
a.Blue() + (b.Blue() - a.Blue() ) * t);
return Color(static_cast<int>( a.Red() + (b.Red() - a.Red() ) * t ),
static_cast<int>( a.Green() + (b.Green() - a.Green()) * t ),
static_cast<int>( a.Blue() + (b.Blue() - a.Blue() ) * t ));
}
@@ -51,8 +51,8 @@ Color saturate(const Color& c, double amount) {
int r = c.Red(), g = c.Green(), b = c.Blue();
double l = (r + g + b) / 3;
return Color(
col((r - amount * l) / (1 - amount)),
col((g - amount * l) / (1 - amount)),
col((b - amount * l) / (1 - amount))
col(static_cast<int>( (r - amount * l) / (1 - amount) )),
col(static_cast<int>( (g - amount * l) / (1 - amount) )),
col(static_cast<int>( (b - amount * l) / (1 - amount) ))
);
}
+4 -4
View File
@@ -88,10 +88,10 @@ void downsample_to_alpha(Image& img_in, Image& img_out) {
// (wc,hc) = the corner where drawing should begin, (0,0) for top-left, (1,1) for bottom-right
void draw_resampled_text(DC& dc, const RealRect& rect, int wc, int hc, int angle, const String& text) {
// enlarge slightly
int w = rect.width + 1, h = rect.height + 1;
int w = static_cast<int>(rect.width) + 1, h = static_cast<int>(rect.height) + 1;
// determine sub-pixel position
int xi = rect.x, yi = rect.y;
int xsub = text_scaling * (rect.x - xi), ysub = text_scaling * (rect.y - yi);
int xi = static_cast<int>(rect.x), yi = static_cast<int>(rect.y);
int xsub = static_cast<int>(text_scaling * (rect.x - xi)), ysub = static_cast<int>(text_scaling * (rect.y - yi));
// draw text
Bitmap buffer(w * text_scaling, h * text_scaling, 24); // should be initialized to black
wxMemoryDC mdc;
@@ -109,6 +109,6 @@ void draw_resampled_text(DC& dc, const RealRect& rect, int wc, int hc, int angle
fill_image(img_small, dc.GetTextForeground());
downsample_to_alpha(img_large, img_small);
// step 3. draw to dc
dc.DrawBitmap(img_small, xi + wc * (rect.width - w), yi + hc * (rect.height - h));
dc.DrawBitmap(img_small, xi + static_cast<int>(wc * (rect.width - w)), yi + static_cast<int>(hc * (rect.height - h)));
}