日期:2009-07-05  浏览次数:20934 次

<HTML>
<HEAD>
<TITLE>DirectX Transform Filters Interactive Demo</TITLE>


<SCRIPT LANGUAGE="javascript">
var browserCapable = true;    // Prevents errors on downlevel browsers
var startImage = "/workshop/graphics/tigerstripe.jpg";
var endImage = "/workshop/graphics/metablob.jpg";
var featuresHeader = "<B>Features:</B><BR>"

function copy2Clipboard()
{
  // Copy currently displayed code to user's clipboard.
  textRange = document.body.createTextRange();
  textRange.moveToElementText(oCodeSpan);
  textRange.execCommand("Copy");
}

function highlightText(whatToHighlight) {
  oRng = document.body.createTextRange();
  oRng.moveToElementText(oCodePre);
  oRng.execCommand("RemoveFormat");
  oHL = document.body.createTextRange();
  oHL.moveToElementText(oCodePre);
  oHL.findText(whatToHighlight);
  oHL.execCommand("Bold");
}

function switchContent(obj) {
    oContentHolder.innerHTML=obj.innerHTML;
    oImg.src=../../startImage;
    if (obj==filterSection){
        changeFilter();
        updateFilterCode();
    }
    else {
        changeTrans();
        updateTransCode();
    }
}

function getControlObject(controlName) {
   for (x=0; x < document.all(controlName).length; x++) {
       objTemp = document.all(controlName,x);
       if (objTemp.parentElement.isSource==null) {
           obj=objTemp;
       }
    }
    return(obj);
}

function changeFilter() {
    selectObject = getControlObject("oSelect");
    selectedValue = selectObject.options[selectObject.selectedIndex].value;
    transitionAsFilter = selectObject.options[selectObject.selectedIndex].TRANS;
    if (selectedValue != "empty") {
        if (selectedValue.indexOf('Blur')!=-1) {
            oControlsSpan.innerHTML = oBlurControls.innerHTML;
            blurFilterChange();
        }
        else if (selectedValue.indexOf('Pixelate')!=-1) {
            oControlsSpan.innerHTML = oPixelateControls.innerHTML;
            pixelateFilterChange();
        }
        else if (selectedValue.indexOf('DropShadow')!=-1) {
            oControlsSpan.innerHTML = oDropShadowControls.innerHTM