Update sdk/platform-tools to version 26.0.0.
[android_tools.git] / sdk / platform-tools / systrace / catapult / telemetry / telemetry / internal / image_processing / image_util_bitmap_impl.py
blob18e4554c0f65e4e12bb34a0b801d6a3d4d00d4e4
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from __future__ import division
7 from telemetry.internal.image_processing import _bitmap
10 def Channels(bitmap):
11 return bitmap.bpp
13 def Width(bitmap):
14 return bitmap.width
16 def Height(bitmap):
17 return bitmap.height
19 def Pixels(bitmap):
20 return bitmap.pixels
22 def GetPixelColor(bitmap, x, y):
23 return bitmap.GetPixelColor(x, y)
25 def WritePngFile(bitmap, path):
26 bitmap.WritePngFile(path)
28 def FromRGBPixels(width, height, pixels, bpp):
29 return _bitmap.Bitmap(bpp, width, height, pixels)
31 def FromPng(png_data):
32 return _bitmap.Bitmap.FromPng(png_data)
34 def FromPngFile(path):
35 return _bitmap.Bitmap.FromPngFile(path)
37 def AreEqual(bitmap1, bitmap2, tolerance, _):
38 return bitmap1.IsEqual(bitmap2, tolerance)
40 def Diff(bitmap1, bitmap2):
41 return bitmap1.Diff(bitmap2)
43 def GetBoundingBox(bitmap, color, tolerance):
44 return bitmap.GetBoundingBox(color, tolerance)
46 def Crop(bitmap, left, top, width, height):
47 return bitmap.Crop(left, top, width, height)
49 def GetColorHistogram(bitmap, ignore_color, tolerance):
50 return bitmap.ColorHistogram(ignore_color, tolerance)