toolkit/components/places/mozIColorAnalyzer.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsISupports.idl"
michael@0 6
michael@0 7 interface nsIURI;
michael@0 8
michael@0 9 [function, scriptable, uuid(e4089e21-71b6-40af-b546-33c21b90e874)]
michael@0 10 interface mozIRepresentativeColorCallback : nsISupports
michael@0 11 {
michael@0 12 /**
michael@0 13 * Will be called when color analysis finishes.
michael@0 14 *
michael@0 15 * @param success
michael@0 16 * True if analysis was successful, false otherwise.
michael@0 17 * Analysis can fail if the image is transparent, imageURI doesn't
michael@0 18 * resolve to a valid image, or the image is too big.
michael@0 19 *
michael@0 20 * @param color
michael@0 21 * The representative color as an integer in RGB form.
michael@0 22 * e.g. 0xFF0102 == rgb(255,1,2)
michael@0 23 * If success is false, color is not provided.
michael@0 24 */
michael@0 25 void onComplete(in boolean success, [optional] in unsigned long color);
michael@0 26 };
michael@0 27
michael@0 28 [scriptable, uuid(d056186c-28a0-494e-aacc-9e433772b143)]
michael@0 29 interface mozIColorAnalyzer : nsISupports
michael@0 30 {
michael@0 31 /**
michael@0 32 * Given an image URI, find the most representative color for that image
michael@0 33 * based on the frequency of each color. Preference is given to colors that
michael@0 34 * are more interesting. Avoids the background color if it can be
michael@0 35 * discerned. Ignores sufficiently transparent colors.
michael@0 36 *
michael@0 37 * This is intended to be used on favicon images. Larger images take longer
michael@0 38 * to process, especially those with a larger number of unique colors. If
michael@0 39 * imageURI points to an image that has more than 128^2 pixels, this method
michael@0 40 * will fail before analyzing it for performance reasons.
michael@0 41 *
michael@0 42 * @param imageURI
michael@0 43 * A URI pointing to the image - ideally a data: URI, but any scheme
michael@0 44 * that will load when setting the src attribute of a DOM img element
michael@0 45 * should work.
michael@0 46 * @param callback
michael@0 47 * Function to call when the representative color is found or an
michael@0 48 * error occurs.
michael@0 49 */
michael@0 50 void findRepresentativeColor(in nsIURI imageURI,
michael@0 51 in mozIRepresentativeColorCallback callback);
michael@0 52 };

mercurial