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
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
)