1// The resources for a layout. 2syntax = "proto3"; 3 4package androidx.wear.tiles.testing.proto; 5 6 7option java_package = "androidx.wear.tiles.testing.proto"; 8option java_outer_classname = "ResourceProto"; 9 10// Format describing the contents of an image data byte array. 11enum ImageFormat { 12 // An undefined image format. 13 IMAGE_FORMAT_UNDEFINED = 0; 14 15 // An image format where each pixel is stored on 2 bytes, with red using 5 16 // bits, green using 6 bits and blue using 5 bits of precision. 17 IMAGE_FORMAT_RGB_565 = 1; 18} 19 20// An image resource which maps to an Android drawable by resource ID. 21message AndroidImageResourceByResId { 22 // The Android resource ID of this image. This must refer to a drawable under 23 // R.drawable. 24 int32 resource_id = 1; 25} 26 27// An image resource whose data is fully inlined, with no dependency on a 28// system or app resource. 29message InlineImageResource { 30 // The byte array representing the image. 31 bytes data = 1; 32 33 // The native width of the image, in pixels. Only required for formats 34 // (e.g. IMAGE_FORMAT_RGB_565) where the image data does not include size. 35 int32 width_px = 2; 36 37 // The native height of the image, in pixels. Only required for formats 38 // (e.g. IMAGE_FORMAT_RGB_565) where the image data does not include size. 39 int32 height_px = 3; 40 41 // The format of the byte array data representing the image. May be left 42 // unspecified or set to IMAGE_FORMAT_UNDEFINED in which case the platform 43 // will attempt to extract this from the raw image data. If the platform does 44 // not support the format, the image will not be decoded or displayed. 45 ImageFormat format = 4; 46} 47 48// An image resource, which can be used by layouts. This holds multiple 49// underlying resource types, which the underlying runtime will pick according 50// to what it thinks is appropriate. 51message ImageResource { 52 // An image resource that maps to an Android drawable by resource ID. 53 AndroidImageResourceByResId android_resource_by_resid = 1; 54 55 // An image resource that contains the image data inline. 56 InlineImageResource inline_resource = 2; 57} 58 59// The resources for a layout. 60message Resources { 61 // The version of this Resources instance. 62 // 63 // Each tile specifies the version of resources it requires. After fetching a 64 // tile, the renderer will use the resources version specified by the tile 65 // to separately fetch the resources. 66 // 67 // This value must match the version of the resources required by the tile 68 // for the tile to render successfully. 69 string version = 1; 70 71 // A map of resource_ids to images, which can be used by layouts. 72 map<string, ImageResource> id_to_image = 2; 73} 74