Skip to content

Commit

Permalink
Opacity adjustments
Browse files Browse the repository at this point in the history
Opacity adjusted for tmxrasterizer and minimaprederer
  • Loading branch information
jcbk101 committed Aug 15, 2024
1 parent e9fa5b9 commit b65718f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/reference/json-map-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Object
polyline, array, "Array of :ref:`Points <json-point>`, in case the object is a polyline"
properties, array, "Array of :ref:`Properties <json-property>`"
rotation, double, "Angle in degrees clockwise"
opacity, double, "The opacity of the object as a value from 0 to 1. Defaults to 1."
template, string, "Reference to a template file, in case object is a :doc:`template instance </manual/using-templates>`"
text, :ref:`json-object-text`, "Only used for text objects"
type, string, "The class of the object (was saved as ``class`` in 1.9, optional)"
Expand All @@ -241,6 +242,7 @@ Object Example
"value":12
}],
"rotation":0,
"opacity":1,
"type":"npc",
"visible":true,
"width":0,
Expand All @@ -259,6 +261,7 @@ Ellipse Example
"id":13,
"name":"",
"rotation":0,
"opacity":1,
"type":"",
"visible":true,
"width":248,
Expand All @@ -276,6 +279,7 @@ Rectangle Example
"id":14,
"name":"",
"rotation":0,
"opacity":1,
"type":"",
"visible":true,
"width":368,
Expand All @@ -294,6 +298,7 @@ Point Example
"name":"",
"point":true,
"rotation":0,
"opacity":1,
"type":"",
"visible":true,
"width":0,
Expand Down Expand Up @@ -332,6 +337,7 @@ Polygon Example
"y":-288
}],
"rotation":0,
"opacity":1,
"type":"",
"visible":true,
"width":0,
Expand Down Expand Up @@ -374,6 +380,7 @@ Polyline Example
"y":0
}],
"rotation":0,
"opacity":1,
"type":"",
"visible":true,
"width":0,
Expand All @@ -396,6 +403,7 @@ Text Example
"wrap":true
},
"rotation":0,
"opacity":1,
"type":"",
"visible":true,
"width":248,
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/tmx-map-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@ Can contain any number: :ref:`tmx-object`
- **height:** The height of the object in pixels. (defaults to 0)
- **rotation:** The rotation of the object in degrees clockwise around (x, y).
(defaults to 0)
- **opacity:** The opacity of the object as a value from 0 to 1. (defaults
to 1)
- **gid:** A reference to a tile. (optional)
- **visible:** Whether the object is shown (1) or hidden (0). (defaults to
1)
Expand Down
2 changes: 2 additions & 0 deletions src/libtiled/minimaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ void MiniMapRenderer::renderToImage(QImage &image, RenderFlags renderFlags) cons
painter.translate(-origin);
}

painter.setOpacity(object->opacity());

mRenderer->drawMapObject(&painter, object, object->effectiveColors());

if (object->rotation() != qreal(0))
Expand Down
2 changes: 2 additions & 0 deletions src/tmxrasterizer/tmxrasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ void TmxRasterizer::drawMapLayers(const MapRenderer &renderer,
painter.translate(-origin);
}

painter.setOpacity(object->opacity());

renderer.drawMapObject(&painter, object, object->effectiveColors());

if (object->rotation() != qreal(0))
Expand Down

0 comments on commit b65718f

Please sign in to comment.