mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-23 19:25:55 +01:00
Code samples cleanup
This commit is contained in:
parent
98933deb0e
commit
3ef6c55d20
@ -23,7 +23,7 @@ QPixmap::loadFromData() functions. The zoom number is passed as ASCII string
|
|||||||
to the functions:
|
to the functions:
|
||||||
```cpp
|
```cpp
|
||||||
QPixmap pm;
|
QPixmap pm;
|
||||||
pm.loadFromData(tileData, QByteArray::number(zoom));
|
pm.loadFromData(data, QByteArray::number(zoom));
|
||||||
```
|
```
|
||||||
|
|
||||||
For a complete code sample see the [pbf2png](https://github.com/tumic0/pbf2png)
|
For a complete code sample see the [pbf2png](https://github.com/tumic0/pbf2png)
|
||||||
@ -33,9 +33,10 @@ conversion utility.
|
|||||||
The plugin supports vector scaling using QImageReader's setScaledSize() method,
|
The plugin supports vector scaling using QImageReader's setScaledSize() method,
|
||||||
so when used like in the following example:
|
so when used like in the following example:
|
||||||
```cpp
|
```cpp
|
||||||
|
QImage img;
|
||||||
QImageReader reader(file, QByteArray::number(zoom));
|
QImageReader reader(file, QByteArray::number(zoom));
|
||||||
reader.setScaledSize(QSize(1024, 1024));
|
reader.setScaledSize(QSize(1024, 1024));
|
||||||
reader.read(&image);
|
reader.read(&img);
|
||||||
```
|
```
|
||||||
you will get 1024x1024px tiles with a pixel ratio of 2 (= HiDPI tiles).
|
you will get 1024x1024px tiles with a pixel ratio of 2 (= HiDPI tiles).
|
||||||
|
|
||||||
@ -44,8 +45,8 @@ Since version 2.7 tile overzoom is supported. If you set *format* to
|
|||||||
`$zoom;$overzoom`:
|
`$zoom;$overzoom`:
|
||||||
```cpp
|
```cpp
|
||||||
QPixmap pm;
|
QPixmap pm;
|
||||||
pm.loadFromData(tileData, QByteArray::number(zoom) + ';' +
|
QByteArray fmt(QByteArray::number(zoom) + ';' + QByteArray::number(overzoom));
|
||||||
QByteArray::number(overzoom));
|
pm.loadFromData(data, fmt);
|
||||||
```
|
```
|
||||||
you will get (512<<overzoom)x(512<<overzoom)px tiles with a pixel ratio of 1.
|
you will get (512<<overzoom)x(512<<overzoom)px tiles with a pixel ratio of 1.
|
||||||
When overzoom is combined with setScaledSize(), the base size is the overzoomed
|
When overzoom is combined with setScaledSize(), the base size is the overzoomed
|
||||||
|
Loading…
Reference in New Issue
Block a user