summaryrefslogtreecommitdiff
path: root/gfx/record.c
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/record.c')
-rw-r--r--gfx/record.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gfx/record.c b/gfx/record.c
index 9ef184c..5a17b6b 100644
--- a/gfx/record.c
+++ b/gfx/record.c
@@ -359,6 +359,31 @@ void record_replay(const struct record *rec, enum gfx_extra extra)
}
+/* ----- Find text by position --------------------------------------------- */
+
+
+const char *record_find_text(const struct record *rec, enum gfx_extra extra,
+ int x, int y)
+{
+ const struct record_layer *layer;
+ const struct record_obj *obj;
+ struct record_bbox bbox;
+
+ for (layer = rec->layers; layer; layer = layer->next)
+ for (obj = layer->objs; obj; obj = obj->next) {
+ if (obj->extra && !(obj->extra & extra))
+ continue;
+ if (obj->type != ro_text)
+ continue;
+ bbox = obj->u.text.bbox;
+ if (x >= bbox.xmin && x <= bbox.xmax &&
+ y >= bbox.ymin && y <= bbox.ymax)
+ return obj->u.text.s;
+ }
+ return NULL;
+}
+
+
/* ----- Bounding box ------------------------------------------------------ */