tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
MaskPosition.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
7 struct MaskPosition {
8 MaskPosition() = default;
9 explicit MaskPosition(const nl::json& json) {
10 fromJson(json);
11 }
12
15 std::string point;
16
19 float xShift{};
20
23 float yShift{};
24
26 float scale{};
27
28
31 nl::json toJson() const {
32 nl::json json = nl::json::object();
33 OBJECT_SERIALIZE_FIELD(json, "point", point);
34 OBJECT_SERIALIZE_FIELD(json, "x_shift", xShift);
35 OBJECT_SERIALIZE_FIELD(json, "y_shift", yShift);
36 OBJECT_SERIALIZE_FIELD(json, "scale", scale);
37 return json;
38 }
39
41 void fromJson(const nl::json& json) {
42 OBJECT_DESERIALIZE_FIELD(json, "point", point, "", false);
43 OBJECT_DESERIALIZE_FIELD(json, "x_shift", xShift, 0.0f, false);
44 OBJECT_DESERIALIZE_FIELD(json, "y_shift", yShift, 0.0f, false);
45 OBJECT_DESERIALIZE_FIELD(json, "scale", scale, 0.0f, false);
46 }
47 };
48}
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:44
This object describes the position on faces where a mask should be placed by default....
float scale
Mask scaling coefficient. For example, 2.0 means double size.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
MaskPosition(const nl::json &json)
nl::json toJson() const
Serializes this object to JSON.
float xShift
Shift by X-axis measured in widths of the mask scaled to the face size, from left to right....
std::string point
The part of the face relative to which the mask should be placed. One of “forehead”,...
float yShift
Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom....