forked from revery-ui/esy-skia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sk_textblob.cpp
56 lines (41 loc) · 2.24 KB
/
sk_textblob.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright 2014 Google Inc.
* Copyright 2015 Xamarin Inc.
* Copyright 2017 Microsoft Corporation. All rights reserved.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTextBlob.h"
#include "sk_textblob.h"
#include "sk_types_priv.h"
void sk_textblob_ref(const sk_textblob_t* blob) {
SkSafeRef(AsTextBlob(blob));
}
void sk_textblob_unref(const sk_textblob_t* blob) {
SkSafeUnref(AsTextBlob(blob));
}
uint32_t sk_textblob_get_unique_id(const sk_textblob_t* blob) {
return AsTextBlob(blob)->uniqueID();
}
void sk_textblob_get_bounds(const sk_textblob_t* blob, sk_rect_t* bounds) {
*bounds = ToRect(AsTextBlob(blob)->bounds());
}
sk_textblob_builder_t* sk_textblob_builder_new() {
return ToTextBlobBuilder(new SkTextBlobBuilder());
}
void sk_textblob_builder_delete(sk_textblob_builder_t* builder) {
delete AsTextBlobBuilder(builder);
}
sk_textblob_t* sk_textblob_builder_make(sk_textblob_builder_t* builder) {
return ToTextBlob(AsTextBlobBuilder(builder)->make().release());
}
void sk_textblob_builder_alloc_run_text(sk_textblob_builder_t* builder, const sk_paint_t* font, int count, float x, float y, int textByteCount, const sk_string_t* lang, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer) {
*runbuffer = ToTextBlobBuilderRunBuffer(AsTextBlobBuilder(builder)->allocRunText(AsPaint(*font), count, x, y, textByteCount, *AsString(lang), AsRect(bounds)));
}
void sk_textblob_builder_alloc_run_text_pos_h(sk_textblob_builder_t* builder, const sk_paint_t* font, int count, float y, int textByteCount, const sk_string_t* lang, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer) {
*runbuffer = ToTextBlobBuilderRunBuffer(AsTextBlobBuilder(builder)->allocRunTextPosH(AsPaint(*font), count, y, textByteCount, *AsString(lang), AsRect(bounds)));
}
void sk_textblob_builder_alloc_run_text_pos(sk_textblob_builder_t* builder, const sk_paint_t* font, int count, int textByteCount, const sk_string_t* lang, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer) {
*runbuffer = ToTextBlobBuilderRunBuffer(AsTextBlobBuilder(builder)->allocRunTextPos(AsPaint(*font), count, textByteCount, *AsString(lang), AsRect(bounds)));
}