Anki/proto/anki/image_occlusion.proto
Abdo 9e147c6335
Add text tool to image occlusion (#2705)
* Add text tool to IO

* Remove unnecessary parentheses

* Fix text objects always grouped

* Remove log

* Fix text objects hidden on back side

* Implement text scaling

* Add inverse text outline

* Warn about IO notes with only text objects

This will result in a different error message than the case where no
objects are added at all though, and the user can bypass the warning.
Maybe this is better to avoid discarding the user's work if they have
spent some time adding text.

* Add isValidType

* Use matches!

* Lock aspect ratio of text objects

* Reword misleading comment

The confusion probably comes from the Fabric docs, which apparently need updating: http://fabricjs.com/docs/fabric.Canvas.html#uniformScaling

* Do not count text objects when calculating current index

* Make text objects respond to size changes

* Fix uniform scaling not working when editing

* Use Arial font

* Escape colons and unify parsing

* Handle scale factor when restricting shape to view

* Use 'cloned'

* Add text background

* Tweak drawShape's params
2023-10-12 13:40:11 +10:00

102 lines
2.5 KiB
Protocol Buffer

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
syntax = "proto3";
option java_multiple_files = true;
package anki.image_occlusion;
import "anki/collection.proto";
import "anki/generic.proto";
service ImageOcclusionService {
rpc GetImageForOcclusion(GetImageForOcclusionRequest)
returns (GetImageForOcclusionResponse);
rpc GetImageOcclusionNote(GetImageOcclusionNoteRequest)
returns (GetImageOcclusionNoteResponse);
rpc GetImageOcclusionFields(GetImageOcclusionFieldsRequest)
returns (GetImageOcclusionFieldsResponse);
// Adds an I/O notetype if none exists in the collection.
rpc AddImageOcclusionNotetype(generic.Empty) returns (collection.OpChanges);
// These two are used by the standalone I/O page, but not used when using
// I/O inside Anki's editor
rpc AddImageOcclusionNote(AddImageOcclusionNoteRequest)
returns (collection.OpChanges);
rpc UpdateImageOcclusionNote(UpdateImageOcclusionNoteRequest)
returns (collection.OpChanges);
}
// Implicitly includes any of the above methods that are not listed in the
// backend service.
service BackendImageOcclusionService {}
message GetImageForOcclusionRequest {
string path = 1;
}
message GetImageForOcclusionResponse {
bytes data = 1;
string name = 2;
}
message AddImageOcclusionNoteRequest {
string image_path = 1;
string occlusions = 2;
string header = 3;
string back_extra = 4;
repeated string tags = 5;
int64 notetype_id = 6;
}
message GetImageOcclusionNoteRequest {
int64 note_id = 1;
}
message GetImageOcclusionNoteResponse {
message ImageOcclusionProperty {
string name = 1;
string value = 2;
}
message ImageOcclusion {
string shape = 1;
repeated ImageOcclusionProperty properties = 2;
}
message ImageClozeNote {
bytes image_data = 1;
repeated ImageOcclusion occlusions = 2;
string header = 3;
string back_extra = 4;
repeated string tags = 5;
}
oneof value {
ImageClozeNote note = 1;
string error = 2;
}
}
message UpdateImageOcclusionNoteRequest {
int64 note_id = 1;
string occlusions = 2;
string header = 3;
string back_extra = 4;
repeated string tags = 5;
}
message GetImageOcclusionFieldsRequest {
int64 notetype_id = 1;
}
message GetImageOcclusionFieldsResponse {
ImageOcclusionFieldIndexes fields = 1;
}
message ImageOcclusionFieldIndexes {
uint32 occlusions = 1;
uint32 image = 2;
uint32 header = 3;
uint32 back_extra = 4;
}