Engauge Digitizer 2
Loading...
Searching...
No Matches
mmsubs.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef MM_SUBS_H
8#define MM_SUBS_H
9
10#include <QRgb>
11
12class QImage;
13class QPointF;
14
16extern double angleBetweenVectors (const QPointF &v1,
17 const QPointF &v2);
18
21extern double angleFromBasisVectors (double xBasis0,
22 double yBasis0,
23 double xBasis1,
24 double yBasis1,
25 double x,
26 double y);
27
29extern double angleFromVectorToVector (const QPointF &vFrom,
30 const QPointF &vTo);
31
33extern double dot (const QPointF &vec1,
34 const QPointF &vec2);
35
39extern void ellipseFromParallelogram (double xTL,
40 double yTL,
41 double xTR,
42 double yTR,
43 double xBR,
44 double yBR,
45 double &angleRadians,
46 double &aAligned,
47 double &bAligned);
48
50extern double magnitude (const QPointF &vec);
51
53extern QPointF normalize (const QPointF &vec);
54
56extern QRgb pixelRGB (const QImage &image, int x, int y);
57
59extern QRgb pixelRGB1 (const QImage &image1Bit, int x, int y);
60
62extern QRgb pixelRGB8 (const QImage &image8Bit, int x, int y);
63
65extern QRgb pixelRGB32 (const QImage &image32Bit, int x, int y);
66
81extern void projectPointOntoLine(double xToProject,
82 double yToProject,
83 double xStart,
84 double yStart,
85 double xStop,
86 double yStop,
87 double *xProjection,
88 double *yProjection,
89 double *projectedDistanceOutsideLine,
90 double *distanceToLine);
91
93extern void setPixelRGB (QImage &image, int x, int y, QRgb q);
94
96extern void setPixelRGB1 (QImage &image1Bit, int x, int y, QRgb q);
97
99extern void setPixelRGB8 (QImage &image8Bit, int x, int y, QRgb q);
100
102extern void setPixelRGB32 (QImage &image32Bit, int x, int y, QRgb q);
103
104#endif // MM_SUBS_H
QRgb pixelRGB8(const QImage &image8Bit, int x, int y)
Get pixel method for 8 bit depth.
Definition mmsubs.cpp:235
double angleFromVectorToVector(const QPointF &vFrom, const QPointF &vTo)
Angle between two vectors. Direction is positive when rotation is about +z vector,...
Definition mmsubs.cpp:43
QRgb pixelRGB32(const QImage &image32Bit, int x, int y)
Get pixel method for 32 bit depth.
Definition mmsubs.cpp:241
double dot(const QPointF &vec1, const QPointF &vec2)
Vector dot product.
Definition mmsubs.cpp:63
QRgb pixelRGB(const QImage &image, int x, int y)
Get pixel method for any bit depth.
Definition mmsubs.cpp:209
void setPixelRGB8(QImage &image8Bit, int x, int y, QRgb q)
Set pixel method for 8 bit depth.
Definition mmsubs.cpp:359
double magnitude(const QPointF &vec)
Norm of vector.
Definition mmsubs.cpp:193
double angleBetweenVectors(const QPointF &v1, const QPointF &v2)
Angle between two vectors. Direction is unimportant, so result is between 0 to pi radians.
Definition mmsubs.cpp:14
void setPixelRGB(QImage &image, int x, int y, QRgb q)
Set pixel method for any bit depth.
Definition mmsubs.cpp:321
void setPixelRGB1(QImage &image1Bit, int x, int y, QRgb q)
Set pixel method for one bit depth.
Definition mmsubs.cpp:337
void projectPointOntoLine(double xToProject, double yToProject, double xStart, double yStart, double xStop, double yStop, double *xProjection, double *yProjection, double *projectedDistanceOutsideLine, double *distanceToLine)
Find the projection of a point onto a line segment such that the line through the point and its proje...
Definition mmsubs.cpp:251
double angleFromBasisVectors(double xBasis0, double yBasis0, double xBasis1, double yBasis1, double x, double y)
Four quadrant angle to specified vector, given two orthogonal basis vectors corresonding to +x and +y...
Definition mmsubs.cpp:31
void ellipseFromParallelogram(double xTL, double yTL, double xTR, double yTR, double xBR, double yBR, double &angleRadians, double &aAligned, double &bAligned)
Calculate ellipse parameters that is incribed in a parallelogram centered at the origin,...
Definition mmsubs.cpp:70
QPointF normalize(const QPointF &vec)
Return normalized vector.
Definition mmsubs.cpp:198
QRgb pixelRGB1(const QImage &image1Bit, int x, int y)
Get pixel method for one bit depth.
Definition mmsubs.cpp:222
void setPixelRGB32(QImage &image32Bit, int x, int y, QRgb q)
Set pixel method for 32 bit depth.
Definition mmsubs.cpp:370