Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Unified Diff: tools/telemetry/telemetry/image_processing/image_util_bitmap_impl.py

Issue 668753002: [Telemetry] Migrate bitmap.py from bitmaptools.cc to numpy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/image_processing/image_util_bitmap_impl.py
diff --git a/tools/telemetry/telemetry/image_processing/image_util_bitmap_impl.py b/tools/telemetry/telemetry/image_processing/image_util_bitmap_impl.py
new file mode 100644
index 0000000000000000000000000000000000000000..aafcc84e07da7ecfa96c7b90b9b93f9a6d7af835
--- /dev/null
+++ b/tools/telemetry/telemetry/image_processing/image_util_bitmap_impl.py
@@ -0,0 +1,50 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from __future__ import division
+
+from telemetry.core import _bitmap
+
+
+def Channels(bitmap):
+ return bitmap.bpp
+
+def Width(bitmap):
+ return bitmap.width
+
+def Height(bitmap):
+ return bitmap.height
+
+def Pixels(bitmap):
+ return bitmap.pixels
+
+def GetPixelColor(bitmap, x, y):
+ return bitmap.GetPixelColor(x, y)
+
+def WritePngFile(bitmap, path):
+ bitmap.WritePngFile(path)
+
+def FromRGBPixels(width, height, pixels, bpp):
+ return _bitmap.Bitmap(bpp, width, height, pixels)
+
+def FromPng(png_data):
+ return _bitmap.Bitmap.FromPng(png_data)
+
+def FromPngFile(path):
+ return _bitmap.Bitmap.FromPngFile(path)
+
+def AreEqual(bitmap1, bitmap2, tolerance, _):
+ return bitmap1.IsEqual(bitmap2, tolerance)
+
+def Diff(bitmap1, bitmap2):
+ return bitmap1.Diff(bitmap2)
+
+def GetBoundingBox(bitmap, color, tolerance):
+ return bitmap.GetBoundingBox(color, tolerance)
+
+def Crop(bitmap, left, top, width, height):
+ return bitmap.Crop(left, top, width, height)
+
+def GetColorHistogram(bitmap, ignore_color, tolerance):
+ return bitmap.ColorHistogram(ignore_color, tolerance)

Powered by Google App Engine
This is Rietveld 408576698