mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-28 03:59:15 +02:00
Added support for ENC maps
This commit is contained in:
@ -1,41 +0,0 @@
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <QtMath>
|
||||
#include "bitmapline.h"
|
||||
|
||||
|
||||
static QImage img2line(const QImage &img, int width)
|
||||
{
|
||||
Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied);
|
||||
QImage res(width, img.height(), QImage::Format_ARGB32_Premultiplied);
|
||||
const int srcBpl = img.bytesPerLine();
|
||||
const int dstBpl = res.bytesPerLine();
|
||||
const uchar *srcBits = img.bits();
|
||||
uchar *dstBits = res.bits();
|
||||
|
||||
for (int i = 0; i < img.height(); i++) {
|
||||
const uchar *srcLine = srcBits + srcBpl * i;
|
||||
uchar *dstLine = dstBits + dstBpl * i;
|
||||
|
||||
for (int j = dstBpl; j > 0; j -= srcBpl, dstLine += srcBpl)
|
||||
memcpy(dstLine, srcLine, qMin(j, srcBpl));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void BitmapLine::draw(QPainter *painter, const QPolygonF &line,
|
||||
const QImage &img)
|
||||
{
|
||||
for (int i = 1; i < line.size(); i++) {
|
||||
QLineF segment(line.at(i-1).x(), line.at(i-1).y(), line.at(i).x(),
|
||||
line.at(i).y());
|
||||
|
||||
painter->save();
|
||||
painter->translate(segment.p1());
|
||||
painter->rotate(-segment.angle());
|
||||
painter->drawImage(0.0, -img.height()/2.0, img2line(img,
|
||||
qCeil(segment.length())));
|
||||
painter->restore();
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#ifndef BITMAPLINE_H
|
||||
#define BITMAPLINE_H
|
||||
|
||||
class QPainter;
|
||||
class QImage;
|
||||
class QPolygonF;
|
||||
|
||||
namespace BitmapLine
|
||||
{
|
||||
void draw(QPainter *painter, const QPolygonF &line, const QImage &img);
|
||||
}
|
||||
|
||||
#endif // BITMAPLINE_H
|
@ -1,11 +1,10 @@
|
||||
#include "common/util.h"
|
||||
#include "bitstream.h"
|
||||
#include "nodfile.h"
|
||||
|
||||
using namespace Garmin;
|
||||
using namespace IMG;
|
||||
|
||||
#define ARRAY_SIZE(array) \
|
||||
(sizeof(array) / sizeof(array[0]))
|
||||
#define DELTA(val, llBits, maxBits) \
|
||||
(((int)((val) << (32 - (llBits))) >> (32 - (llBits))) << (32 - (maxBits)))
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "map/imgmap.h"
|
||||
#include "map/textpathitem.h"
|
||||
#include "map/textpointitem.h"
|
||||
#include "bitmapline.h"
|
||||
#include "map/bitmapline.h"
|
||||
#include "style.h"
|
||||
#include "lblfile.h"
|
||||
#include "rastertile.h"
|
||||
@ -357,7 +357,7 @@ void RasterTile::processStreetNames(QList<TextItem*> &textItems)
|
||||
? &style.textColor() : 0;
|
||||
|
||||
TextPathItem *item = new TextPathItem(poly.points,
|
||||
&poly.label.text(), _rect, fnt, color);
|
||||
&poly.label.text(), _rect, fnt, color, &haloColor);
|
||||
if (item->isValid() && !item->collides(textItems))
|
||||
textItems.append(item);
|
||||
else
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
private:
|
||||
QBrush _brush;
|
||||
QPen _pen;
|
||||
QColor _textColor;
|
||||
};
|
||||
|
||||
class Line {
|
||||
|
Reference in New Issue
Block a user