1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16import {Component, Input} from '@angular/core'; 17import {Transform} from 'trace/flickerlib/common'; 18 19@Component({ 20 selector: 'transform-matrix', 21 template: ` 22 <div *ngIf="transform" class="matrix" [matTooltip]="transform.getTypeAsString()"> 23 <p class="mat-body-1"> 24 {{ formatFloat(transform.matrix.dsdx) }} 25 </p> 26 <p class="mat-body-1"> 27 {{ formatFloat(transform.matrix.dsdy) }} 28 </p> 29 <p class="mat-body-1" matTooltip="Translate x"> 30 {{ formatFloat(transform.matrix.tx) }} 31 </p> 32 33 <p class="mat-body-1"> 34 {{ formatFloat(transform.matrix.dtdx) }} 35 </p> 36 <p class="mat-body-1"> 37 {{ formatFloat(transform.matrix.dtdy) }} 38 </p> 39 <p class="mat-body-1" matTooltip="Translate y"> 40 {{ formatFloat(transform.matrix.ty) }} 41 </p> 42 43 <p class="mat-body-1">0</p> 44 <p class="mat-body-1">0</p> 45 <p class="mat-body-1">1</p> 46 </div> 47 `, 48 styles: [ 49 ` 50 .matrix { 51 display: grid; 52 grid-gap: 1px; 53 grid-template-columns: repeat(3, 1fr); 54 text-align: center; 55 } 56 `, 57 ], 58}) 59export class TransformMatrixComponent { 60 @Input() transform!: Transform; 61 @Input() formatFloat!: (num: number) => number; 62} 63