Anki/proto/anki/image_occlusion.proto
jariji 33d1057a46 Add "hide all but one" occlusion mode.
This PR adds the "hide all but one" occlusion mode. An example use case
is a note containing a collection of pairs of selection, where each
selection is the prompt for the other in its pair.

For example, given a table like

| small | big |
|-------+-----|
|   a   |  A  |
|   b   |  B  |
|   c   |  C  |

in each card, five letters are occluded, and one is shown. The user is
prompted to state the occluded symbol that is adjacent to the shown symbol.
2025-11-04 01:03:09 +00:00

115 lines
2.7 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 ImageOcclusionShape {
string shape = 1;
repeated ImageOcclusionProperty properties = 2;
}
message ImageOcclusion {
repeated ImageOcclusionShape shapes = 1;
uint32 ordinal = 2;
}
enum OcclusionMode {
HIDE_ONE = 0;
HIDE_ALL = 1;
HIDE_ALL_BUT_ONE = 2;
}
message ImageOcclusionNote {
bytes image_data = 1;
repeated ImageOcclusion occlusions = 2;
string header = 3;
string back_extra = 4;
repeated string tags = 5;
string image_file_name = 6;
OcclusionMode occlusion_mode = 7;
}
oneof value {
ImageOcclusionNote 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;
}