From 65d3557f63d83beff460a825044395509a3a4e54 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 14 Dec 2020 17:16:57 +0300 Subject: [PATCH] Add outline support for sticker set thumbnails. --- td/generate/scheme/td_api.tl | 10 ++++++---- td/generate/scheme/td_api.tlo | Bin 191132 -> 191256 bytes td/telegram/InlineQueriesManager.cpp | 2 +- td/telegram/StickersManager.cpp | 10 ++++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 8bdfd4b28..3643ff09e 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -274,8 +274,8 @@ photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Ph //@description Describes a sticker @set_id The identifier of the sticker set to which the sticker belongs; 0 if none @width Sticker width; as defined by the sender @height Sticker height; as defined by the sender //@emoji Emoji corresponding to the sticker @is_animated True, if the sticker is an animated sticker in TGS format @is_mask True, if the sticker is a mask @mask_position Position where the mask should be placed; may be null -//@contours Sticker contours; may be empty. The coordinate system origin is in the upper-left corner @thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @sticker File containing the sticker -sticker set_id:int64 width:int32 height:int32 emoji:string is_animated:Bool is_mask:Bool mask_position:maskPosition contours:vector thumbnail:thumbnail sticker:file = Sticker; +//@outline Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner @thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @sticker File containing the sticker +sticker set_id:int64 width:int32 height:int32 emoji:string is_animated:Bool is_mask:Bool mask_position:maskPosition outline:vector thumbnail:thumbnail sticker:file = Sticker; //@description Describes a video file @duration Duration of the video, in seconds; as defined by the sender @width Video width; as defined by the sender @height Video height; as defined by the sender //@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender @@ -1977,17 +1977,19 @@ emojis emojis:vector = Emojis; //@description Represents a sticker set //@id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @thumbnail Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed +//@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@is_installed True, if the sticker set has been installed by the current user @is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously //@is_official True, if the sticker set is official @is_animated True, is the stickers in the set are animated @is_masks True, if the stickers in the set are masks @is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set @emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @thumbnail Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null +//@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@is_installed True, if the sticker set has been installed by current user @is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously //@is_official True, if the sticker set is official @is_animated True, is the stickers in the set are animated @is_masks True, if the stickers in the set are masks @is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set @covers Contains up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full set should be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index aaf2e4f6e23049716958ab763e89a12e52cfc402..2adc10609ea88c28cdce92193c41d41ecfb67478 100644 GIT binary patch delta 636 zcmbPpm3ziD?hOW7Jn8a#nAn3$GLy4YizXhBV9E4w`aL;9ONFIF{f+PD1}&C)7Lbz3 z9V-(cj5jM~APk;W3J`_?j1dB5Y_3?fLJ=bO;JCtOmoqwyG62Ek zj~~^y3-mI!D2jreQ4Dbgh<)>zkPp}NMnfj`=@-^9p5b86FD=Q*%uAgvuz*o^`qA}_ z;VK|yAX7l#svK7g$mLv6BZ5;)7(o2#3OgAkrVG?D3QYEiRG4mH%cL-Uj|`KFpkPTx zX>L+pVrEV}#N_FQCmH3ZA6d^Ru>H&iMixd^uq&q*GBZj~|FDr!Ljz z=?5~HWVUl`WnAD4j=kv(*BBMHpZUQUqYjCKhBG?bBNUhdIKk4BGIgfk&}4D}bG9pJ zF&z-%1o;gV;;hpXPcvyu_KlPW1yut?$rf9t1)gvvjG#zSo}S>!#K{cQwY{gE>53M_ gUY_}k1`sVXHZc__gP9=PEUqzmK*U?FF-eF30K&Q3YybcN delta 543 zcmbPnjeE{j?hOW7JWoyLaI*)OWF}{)7EL@L!SXKep3&q8EftpX^Pe?0H)yfcvw)OL z?pT=sVZ2!>17Yy2Qh+cFV2ltbV{^r-6^anK2gemQyPWwE4CZZjP+(k;!wE8vkpT!M zfBdMvU7(k-MNt&&jADp0K!0mKKH!ZY1*17rJkj*W~gj9^zx7udw;q6?CSXohG9 zd6y5N-7_yOp8+I>WQ50NMg>L*xa)zsi=5eXIBeSvf)q|~*uq!>4z=kUdYBZZOKfHI zUQ|DkCVslqY}4gE&u=k diff --git a/td/telegram/InlineQueriesManager.cpp b/td/telegram/InlineQueriesManager.cpp index 3c1f3e093..4bb8e398a 100644 --- a/td/telegram/InlineQueriesManager.cpp +++ b/td/telegram/InlineQueriesManager.cpp @@ -1014,7 +1014,7 @@ template <> tl_object_ptr copy(const td_api::sticker &obj) { return make_tl_object( obj.set_id_, obj.width_, obj.height_, obj.emoji_, obj.is_animated_, obj.is_mask_, copy(obj.mask_position_), - transform(obj.contours_, copy_closed_vector_path), copy(obj.thumbnail_), copy(obj.sticker_)); + transform(obj.outline_, copy_closed_vector_path), copy(obj.thumbnail_), copy(obj.sticker_)); } template <> diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index aaba857c1..a08fb79bb 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -1698,8 +1698,9 @@ tl_object_ptr StickersManager::get_sticker_set_object(Sticke sticker_set->is_animated ? PhotoFormat::Tgs : PhotoFormat::Webp); return make_tl_object( sticker_set->id.get(), sticker_set->title, sticker_set->short_name, std::move(thumbnail), - sticker_set->is_installed && !sticker_set->is_archived, sticker_set->is_archived, sticker_set->is_official, - sticker_set->is_animated, sticker_set->is_masks, sticker_set->is_viewed, std::move(stickers), std::move(emojis)); + get_sticker_minithumbnail(sticker_set->minithumbnail), sticker_set->is_installed && !sticker_set->is_archived, + sticker_set->is_archived, sticker_set->is_official, sticker_set->is_animated, sticker_set->is_masks, + sticker_set->is_viewed, std::move(stickers), std::move(emojis)); } tl_object_ptr StickersManager::get_sticker_sets_object(int32 total_count, @@ -1743,8 +1744,9 @@ tl_object_ptr StickersManager::get_sticker_set_info_obje sticker_set->is_animated ? PhotoFormat::Tgs : PhotoFormat::Webp); return make_tl_object( sticker_set->id.get(), sticker_set->title, sticker_set->short_name, std::move(thumbnail), - sticker_set->is_installed && !sticker_set->is_archived, sticker_set->is_archived, sticker_set->is_official, - sticker_set->is_animated, sticker_set->is_masks, sticker_set->is_viewed, + get_sticker_minithumbnail(sticker_set->minithumbnail), sticker_set->is_installed && !sticker_set->is_archived, + sticker_set->is_archived, sticker_set->is_official, sticker_set->is_animated, sticker_set->is_masks, + sticker_set->is_viewed, sticker_set->was_loaded ? narrow_cast(sticker_set->sticker_ids.size()) : sticker_set->sticker_count, std::move(stickers)); }