imgILoader 编辑

modules/libpr0n/public/imgILoader.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)

Implemented by @mozilla.org/image/loader;1 as a service:

var imgILoader = Components.classes["@mozilla.org/image/loader;1"]
                 .getService(Components.interfaces.imgILoader);

Method overview

imgIRequest loadImage(in nsIURI aURI, in nsIURI aInitialDocumentURL, in nsIURI aReferrerURI, in nsIPrincipal aLoadingPrincipal, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest, in nsIChannelPolicy channelPolicy);
imgIRequest loadImageWithChannel(in nsIChannel aChannel, in imgIDecoderObserver aObserver, in nsISupports cx, out nsIStreamListener aListener);
boolean supportImageWithMimeType(in string mimeType);

Constants

ConstantValueDescription
LOAD_CORS_ANONYMOUS1 << 16
LOAD_CORS_USE_CREDENTIALS1 << 17

Methods

loadImage()

Start the load and decode of an image.

imgIRequest loadImage(
  in nsIURI aURI,
  in nsIURI aInitialDocumentURL,
  in nsIURI aReferrerURI,
  in nsIPrincipal aLoadingPrincipal,
  in nsILoadGroup aLoadGroup,
  in imgIDecoderObserver aObserver,
  in nsISupports aCX,
  in nsLoadFlags aLoadFlags,
  in nsISupports cacheKey,
  in imgIRequest aRequest,
  in nsIChannelPolicy channelPolicy
);
Parameters
aURI
The URI to load.
aInitialDocumentURL
aReferrerURI
The 'referring' URI.
aLoadingPrincipal
The principal of the loading document.
aLoadGroup
Loadgroup to put the image load into.
aObserver
The observer (may be null)
aCX
Some random data.
aLoadFlags
Load flags for the request.
cacheKey
aRequest
A newly created, unused imgIRequest object or null for one to be created for you. libpr0n does NOT keep a strong ref to the observer; this prevents reference cycles. This means that callers of loadImage should make sure to Cancel() the resulting request before the observer goes away.
channelPolicy
Return value

loadImageWithChannel()

Start the load and decode of an image.

libpr0n does NOT keep a strong ref to the observer; this prevents reference cycles. This means that callers of loadImageWithChannel should make sure to Cancel() the resulting request before the observer goes away.

imgIRequest loadImageWithChannel(
  in nsIChannel aChannel,
  in imgIDecoderObserver aObserver,
  in nsISupports cx,
  out nsIStreamListener aListener
);
Parameters
aChannel
The channel to load the image from. This must already be opened before this method is called, and there must have been no OnDataAvailable calls for it yet.
aObserver
The observer (may be null)
cx
Some random data.
aListener
A listener that you must send the channel's notifications and data to. Can be null, in which case imagelib has found a cached image and is not interested in the data. aChannel will be canceled for you in this case.
Return value

 

supportImageWithMimeType()

Checks if a decoder for the an image with the given mime type is available.

boolean supportImageWithMimeType(
  in string mimeType
);
Parameters
mimeType
The type to find a decoder for.
Return value

true if a decoder is available, false otherwise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:104 次

字数:5951

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文