當前位置: 首頁>>代碼示例>>Java>>正文


Java Image.getAccelerationPriority方法代碼示例

本文整理匯總了Java中java.awt.Image.getAccelerationPriority方法的典型用法代碼示例。如果您正苦於以下問題:Java Image.getAccelerationPriority方法的具體用法?Java Image.getAccelerationPriority怎麽用?Java Image.getAccelerationPriority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Image的用法示例。


在下文中一共展示了Image.getAccelerationPriority方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSourceSurfaceData

import java.awt.Image; //導入方法依賴的package包/類
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:58,代碼來源:SurfaceData.java


注:本文中的java.awt.Image.getAccelerationPriority方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。