Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 1999-2101 Alibaba Group.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.alibaba.simpleimage.jai.scale;
 
 
 import  javax.media.jai.JAI;
 import  javax.media.jai.OperationDescriptorImpl;
 import  javax.media.jai.ParameterBlockJAI;
 import  javax.media.jai.RenderableOp;
 import  javax.media.jai.RenderedOp;
 import  javax.media.jai.registry.RenderableRegistryMode;
 import  javax.media.jai.registry.RenderedRegistryMode;
 import  javax.media.jai.util.Range;

TODO Comment of LanczosDescriptor

Author(s):
wendell
 
 @SuppressWarnings("unchecked")
 public class LanczosDescriptor extends OperationDescriptorImpl {

    
 
     private static final long serialVersionUID = 4737776871201566774L;

    
The resource strings that provide the general documentation and specify the parameter list for this operation.
 
     private static final String[][] resources = {
         {"GlobalName",  "Lanczos"},
         {"LocalName",   "Lanczos"},
         {"Vendor",      "www.alibaba.com"},
         {"Description""scale algthrom"},
         {"DocURL",      ""},
         {"Version",     "1.0"},
         {"arg0Desc",    "the scale factor of X"},
         {"arg1Desc",    "the scale factor of Y"}
     };

    
The parameter class list for this operation.
 
     private static final Class[] paramClasses = {
         java.lang.Double.classjava.lang.Double.class
     };

    
The parameter name list for this operation.
 
     private static final String[] paramNames = {
         "scaleX""scaleY"
     };

    
The parameter default value list for this operation.
 
     private static final Object[] paramDefaults = {
         new Double(0.5), new Double(0.5)
     };

    
The allowable Ranges of parameter values.
 
     private static final Object[] validParamValues = {
         new Range(Double.classnew Double(.), new Double(.)),
         new Range(Double.classnew Double(.), new Double(.))
     };
 
     public LanczosDescriptor() {
         super(,
               new String[] {RenderedRegistryMode.MODE_NAME,
                             RenderableRegistryMode.MODE_NAME},
               1,
               ,
               ,
               ,
               );
     }
     
     protected boolean validateParameters(String modeName,
                                          ParameterBlock args,
                                          StringBuffer msg) {
         if (!super.validateParameters(modeNameargsmsg)) {
             return false;
         }
 
         if(args.getNumParameters() < 2 || args.getObjectParameter(1) == null) {
            args.set(args.getObjectParameter(0), 1);
        }
        return true;
    }
    
    public static RenderedOp create(RenderedImage source0,
                                    Double scaleX,
                                    Double scaleY,
                                    RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Lanczos",
                                  RenderedRegistryMode.MODE_NAME);
        pb.setSource("source0"source0);
        pb.setParameter("scaleX"scaleX);
        pb.setParameter("scaleY"scaleY);
        return JAI.create("Lanczos"pbhints);
    }
    
    public static RenderableOp createRenderable(RenderableImage source0,
                                                Double scaleX,
                                                Double scaleY,
                                                RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Lanczos",
                                  RenderableRegistryMode.MODE_NAME);
        pb.setSource("source0"source0);
        pb.setParameter("scaleX"scaleX);
        pb.setParameter("scaleY"scaleY);
        return JAI.createRenderable("Lanczos"pbhints);
    }
New to GrepCode? Check out our FAQ X