1 // Copyright (C) 2024 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <vector>
18 
19 namespace cuttlefish {
20 
21 struct RGBA8888 {
22   uint8_t r;
23   uint8_t g;
24   uint8_t b;
25   uint8_t a;
26 };
27 
28 // NOTE: Adjusts for the Vulkan coordinate system with (-1, -1) at the top left:
29 //
30 //   const std::vector<uint8_t> contents = CreateImageContentsWithFourCorners(
31 //          /*width=*/2,
32 //          /*height=*/2,
33 //          /*bottomLeft=*/<RED>,
34 //          /*bottomRight=*/<BLUE>,
35 //          /*topLeft=*/<GREEN>,
36 //          /*topRight=*/<BLACK>);
37 //
38 //   contents[ 0 through  3] == <GREEN>
39 //   contents[ 4 through  7] == <BLACK>
40 //   contents[ 8 through 11] == <RED>
41 //   contents[12 through 15] == <BLUE>
42 std::vector<uint8_t> CreateImageContentsWithFourCorners(
43     uint32_t width, uint32_t height, const RGBA8888& bottomLeft,
44     const RGBA8888& bottomRight, const RGBA8888& topLeft,
45     const RGBA8888& topRight);
46 
47 }  // namespace cuttlefish