mirror of
https://github.com/reactos/reactos.git
synced 2024-09-10 12:54:51 +00:00
![Klemens Friedl](/assets/img/avatar_default.png)
* sumatrapdf - vendor import * everything compiles (libjpeg, poppler, fitz, sumatrapdf) * does NOT link (remove the comment tags in the parent directory.rbuild file (rosapps dir) to build it) svn path=/trunk/; revision=29295
74 lines
1.8 KiB
C++
74 lines
1.8 KiB
C++
/* Written by Krzysztof Kowalczyk (http://blog.kowalczyk.info)
|
|
The author disclaims copyright to this source code. */
|
|
#ifndef GEOM_UTIL_H_
|
|
#define GEOM_UTIL_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
typedef struct RectI {
|
|
int x, y;
|
|
int dx, dy;
|
|
} RectI;
|
|
|
|
typedef struct RectD {
|
|
double x,y;
|
|
double dx,dy;
|
|
} RectD;
|
|
|
|
int RectI_Intersect(RectI *r1, RectI *r2, RectI *rIntersectOut);
|
|
void RectI_FromXY(RectI *rOut, int xs, int xe, int ys, int ye);
|
|
int RectI_Inside(RectI *r, int x, int y);
|
|
void RectD_FromXY(RectD *rOut, double xs, double xe, double ys, double ye);
|
|
void RectD_FromRectI(RectD *rOut, RectI *rIn);
|
|
void RectI_FromRectD(RectI *rOut, RectD *rIn);
|
|
void RectD_Copy(RectD *rOut, RectD *rIn);
|
|
void u_RectI_Intersect(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/* allow using from both C and C++ code */
|
|
#ifdef __cplusplus
|
|
class PointD {
|
|
public:
|
|
PointD() { x = 0; y = 0; }
|
|
PointD(double _x, double _y) { x = _x; y = _y; }
|
|
void set(double _x, double _y) { x = _x; y = _y; }
|
|
double x;
|
|
double y;
|
|
};
|
|
|
|
class SizeI {
|
|
public:
|
|
SizeI(int _dx, int _dy) { dx = _dx; dy = _dy; }
|
|
void set(int _dx, int _dy) { dx = _dx; dy = _dy; }
|
|
int dx;
|
|
int dy;
|
|
};
|
|
|
|
class SizeD {
|
|
public:
|
|
SizeD(double dx, double dy) { m_dx = dx; m_dy = dy; }
|
|
SizeD(int dx, int dy) { m_dx = (double)dx; m_dy = (double)dy; }
|
|
SizeD(SizeI si) { m_dx = (double)si.dx; m_dy = (double)si.dy; }
|
|
SizeD() { m_dx = 0; m_dy = 0; }
|
|
int dxI() { return (int)m_dx; }
|
|
int dyI() { return (int)m_dy; }
|
|
double dx() { return m_dx; }
|
|
double dy() { return m_dy; }
|
|
void setDx(double dx) { m_dx = dx; }
|
|
void setDy(double dy) { m_dy = dy; }
|
|
SizeI size() { return SizeI((int)dx(), (int)dy()); } /* @note: int casts */
|
|
private:
|
|
double m_dx;
|
|
double m_dy;
|
|
};
|
|
|
|
#endif
|
|
|
|
#endif
|