mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Compare commits
No commits in common. "af7696bfd7c0b542c9f65a161d25726a3d54a1e7" and "6ccfe0eb21d7586c261ff12aeba7ad4d0a5edfaa" have entirely different histories.
af7696bfd7
...
6ccfe0eb21
@ -59,8 +59,8 @@ static void getSubmatrix(int x, int y, const Matrix &m, SubMatrix &sm)
|
||||
sm.z9 = m.m(bottom, right);
|
||||
}
|
||||
|
||||
QImage HillShading::render(const Matrix &m, quint8 alpha, double z,
|
||||
double azimuth, double elevation)
|
||||
QImage HillShading::render(const Matrix &m, quint8 alpha, double azimuth,
|
||||
double elevation)
|
||||
{
|
||||
QImage img(m.w() - 2, m.h() - 2, QImage::Format_ARGB32_Premultiplied);
|
||||
uchar *bits = img.bits();
|
||||
@ -69,6 +69,7 @@ QImage HillShading::render(const Matrix &m, quint8 alpha, double z,
|
||||
Constants c;
|
||||
SubMatrix sm;
|
||||
Derivatives d;
|
||||
double z = (double)alpha / 0xFF;
|
||||
|
||||
getConstants(azimuth, elevation, c);
|
||||
|
||||
@ -85,7 +86,7 @@ QImage HillShading::render(const Matrix &m, quint8 alpha, double z,
|
||||
pixel = 0;
|
||||
else {
|
||||
quint8 val = (L < 0) ? 0 : L * alpha;
|
||||
pixel = (alpha - val)<<24;
|
||||
pixel = alpha<<24 | val<<16 | val<<8 | val;
|
||||
}
|
||||
|
||||
*(quint32*)(bits + (y - 1) * bpl + (x - 1) * 4) = pixel;
|
||||
|
@ -7,7 +7,7 @@
|
||||
class HillShading
|
||||
{
|
||||
public:
|
||||
static QImage render(const Matrix &m, quint8 alpha = 64, double z = 0.3,
|
||||
static QImage render(const Matrix &m, quint8 alpha = 64,
|
||||
double azimuth = 315, double elevation = 25);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user