Load raster data from node.

@param root The raster node.
@param color The raster color name.
@return The raster data.
509879
public static RasterData load(Xml root, String color)
    {
        final Xml node = root.getChild(color);
        final double force = node.readDouble(ATT_FORCE);
        final int amplitude = node.readInteger(ATT_AMPLITUDE);
        final int offset = node.readInteger(ATT_OFFSET);
        final int type = node.readInteger(ATT_TYPE);

        return new RasterData(force, amplitude, offset, type);
    }
940077
public String render(Node root, boolean processExtendRoots) {
    OutputList output = new OutputList(config.getMaxOutputSize());

    for (Node node : root.getChildren()) {
      lineNumber = node.getLineNumber();
      position = node.getStartPosition();
      String renderStr = node.getMaster().getImage();
      if (context.doesRenderStackContain(renderStr)) {
        // This is a circular rendering. Stop rendering it here.
        addError(new TemplateError(ErrorType.WARNING, ErrorReason.EXCEPTION, ErrorItem.TAG,
            "Rendering cycle detected: '" + renderStr + "'", null, getLineNumber(), node.getStartPosition(),
            null, BasicTemplateErrorCategory.IMPORT_CYCLE_DETECTED, ImmutableMap.of("string", renderStr)));
        output.addNode(new RenderedOutputNode(renderStr));
      } else {
        OutputNode out;
        context.pushRenderStack(renderStr);
        try {
          out = node.render(this);
        } catch (DeferredValueException e) {
          out = new RenderedOutputNode(node.getMaster().getImage());
        }
        context.popRenderStack();
        output.addNode(out);
      }
    }

    // render all extend parents, keeping the last as the root output
    if (processExtendRoots) {
      while (!extendParentRoots.isEmpty()) {
        context.getCurrentPathStack().push(context.getExtendPathStack().peek().orElse(""), lineNumber, position);
        Node parentRoot = extendParentRoots.removeFirst();
        output = new OutputList(config.getMaxOutputSize());

        for (Node node : parentRoot.getChildren()) {
          OutputNode out = node.render(this);
          output.addNode(out);
        }

        context.getExtendPathStack().pop();
        context.getCurrentPathStack().pop();
      }
    }

    resolveBlockStubs(output);

    return output.getValue();
  }
852193
public void setRoot(int root)
  {

    super.setRoot(root);

  	m_exprObj = FilterExprIteratorSimple.executeFilterExpr(root, 
  	                  m_lpi.getXPathContext(), m_lpi.getPrefixResolver(), 
  	                  m_lpi.getIsTopLevel(), m_lpi.m_stackFrame, m_expr);

  }
763702
private ViewNode getRootViewNode(HttpServletRequest request) throws Exception {
    String rooNodeID = getRootNodeID(request);
    if (rooNodeID == null){
      Debug.logError("[JdonFramework] root Id is null ! " , module);
      return null;
    }
    Debug.logVerbose("[JdonFramework] get the tree's root Node: " + rooNodeID, module);
    ViewNode rNode = new ViewNode(rooNodeID, rooNodeID, true);
    rNode.setRoot(true);
    return rNode;
  }
1059360
private TwoColors getRootPaneInteriorColors(Which type) {
        switch (type) {

        case BACKGROUND_ENABLED_WINDOWFOCUSED:
            return rootPaneActive;

        case BACKGROUND_ENABLED:
            return rootPaneInactive;
        }

        return null;
    }
777189
@Override
    public void initialise(String root) {
        functionCalls.clear();
        variables.clear();
        initCreator(root);
    }
1189177
public static List<File> getDirectories(File root) {
        if (root == null)
            return Collections.emptyList();

        FileFilter filter = new DirsOnlyFilter();

        File fileList[] = root.listFiles(filter);

        if (fileList == null)
            return Collections.emptyList();
        else
            return Arrays.asList(fileList);
    }
392086
private static URI createRaster(
            final Dimension targetSize, final RasterReference rasterReference,
            final Double rotation, final Color backgroundColor,
            final File workingDir) throws IOException {
        final File path = File.createTempFile("north-arrow-", ".png", workingDir);

        final BufferedImage newImage =
                new BufferedImage(targetSize.width, targetSize.height, BufferedImage.TYPE_4BYTE_ABGR);
        final Graphics2D graphics2d = newImage.createGraphics();
        try {
            final BufferedImage originalImage = ImageIO.read(rasterReference.inputStream);
            if (originalImage == null) {
                LOGGER.warn("Unable to load NorthArrow graphic: {}, it is not an image format that can be " +
                                    "decoded",
                            rasterReference.uri);
                throw new IllegalArgumentException();
            }

            // set background color
            graphics2d.setColor(backgroundColor);
            graphics2d.fillRect(0, 0, targetSize.width, targetSize.height);

            // scale the original image to fit the new size
            int newWidth;
            int newHeight;
            if (originalImage.getWidth() > originalImage.getHeight()) {
                newWidth = targetSize.width;
                newHeight = Math.min(
                        targetSize.height,
                        (int) Math.ceil(newWidth / (originalImage.getWidth() /
                                (double) originalImage.getHeight())));
            } else {
                newHeight = targetSize.height;
                newWidth = Math.min(
                        targetSize.width,
                        (int) Math.ceil(newHeight / (originalImage.getHeight() /
                                (double) originalImage.getWidth())));
            }

            // position the original image in the center of the new
            int deltaX = (int) Math.floor((targetSize.width - newWidth) / 2.0);
            int deltaY = (int) Math.floor((targetSize.height - newHeight) / 2.0);

            if (!FloatingPointUtil.equals(rotation, 0.0)) {
                final AffineTransform rotate = AffineTransform.getRotateInstance(
                        rotation, targetSize.width / 2.0, targetSize.height / 2.0);
                graphics2d.setTransform(rotate);
            }

            graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                        RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            graphics2d.drawImage(originalImage, deltaX, deltaY, newWidth, newHeight, null);

            ImageUtils.writeImage(newImage, "png", path);
        } finally {
            graphics2d.dispose();
        }
        return path.toURI();
    }
1201517
private void readAllImagesAndVariations(String root) {

        File basedir = new File(CmsImageLoader.getImageRepositoryPath() + root);
        visitImages(m_clonedCms, basedir);
        m_variations = Collections.unmodifiableMap(m_variations);
        m_sizes = Collections.unmodifiableMap(m_sizes);
        m_lengths = Collections.unmodifiableMap(m_lengths);

    }
1347877
public static boolean start(RootDoc root) {
        try {
            String filename = "classes.xmi";
            PrintWriter out = new PrintWriter((Writer)new FileWriter(filename));
            XMIDoclet doclet = new XMIDoclet(out);
            doclet.process(root);
            out.flush();
            return true;
        } catch (Exception e) {
            System.err.println(e.toString());
            return false;
        }
    }
396739
def SetLineColor(self, color):
        
        self._linecolor = Color(color)
        if isinstance(self, ROOT.TAttLine):
            ROOT.TAttLine.SetLineColor(self, self._linecolor('root'))
861858
static void processRoot(final File root, final ProcessedLayers layers, final LayerPathSetter setter) throws IOException {
        final LayersConfig layersConfig = LayersConfig.getLayersConfig(root);
        // Process layers
        final File layersDir = new File(root, layersConfig.getLayersPath());
        if (!layersDir.exists()) {
            if (layersConfig.isConfigured()) {
                // Bad config from user
                throw PatchLogger.ROOT_LOGGER.installationNoLayersConfigFound(layersDir.getAbsolutePath());
            }
            // else this isn't a root that has layers and add-ons
        } else {
            // check for a valid layer configuration
            for (final String layer : layersConfig.getLayers()) {
                File layerDir = new File(layersDir, layer);
                if (!layerDir.exists()) {
                    if (layersConfig.isConfigured()) {
                        // Bad config from user
                        throw PatchLogger.ROOT_LOGGER.installationMissingLayer(layer, layersDir.getAbsolutePath());
                    }
                    // else this isn't a standard layers and add-ons structure
                    return;
                }
                layers.addLayer(layer, layerDir, setter);
            }
        }
        // Finally process the add-ons
        final File addOnsDir = new File(root, layersConfig.getAddOnsPath());
        final File[] addOnsList = addOnsDir.listFiles();
        if (addOnsList != null) {
            for (final File addOn : addOnsList) {
                layers.addAddOn(addOn.getName(), addOn, setter);
            }
        }
    }
911247
@Override
    public void load(boolean alpha)
    {
        ImageBuffer surface = Graphics.getImageBuffer(media);

        if (0 != Double.compare(factorH, 1.0) || 0 != Double.compare(factorV, 1.0))
        {
            final int x = (int) (surface.getWidth() * factorH);
            final int y = (int) (surface.getHeight() * factorV);
            surface = Graphics.resize(surface, x, y);
        }

        lineWidth = (int) Math.floor(surface.getWidth() * sx / 100.0);
        lineHeight = (int) Math.floor(surface.getHeight() / (double) linesNumber * sy / 100.0);
        lines = Graphics.splitImage(surface, 1, linesNumber);

        final double factH = sx / 100.0 / AMPLITUDE_FACTOR;

        for (int i = 0; i < linesNumber; i++)
        {
            final int width = (int) Math.ceil(lines[i].getWidth() * (sx + i * 2 * factH) / 100);
            final int height = lines[i].getHeight() * sy / 100;
            lines[i] = Graphics.resize(lines[i], width, height);
        }
    }
172525
public void setColor(final Color COLOR) {
        if (null == color) {
            _color = COLOR;
        } else {
            color.set(COLOR);
        }
    }
822008
public boolean write( RasterData rasterData ) throws RasterWritingFailureException {
        try {
            return writer.write(rasterData);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RasterWritingFailureException(e.getLocalizedMessage());
        }

    }
858706
public short getPixelValue(WritableRaster raster, int x, int y) {
		Object pixelData = raster.getDataElements(x, y, null);
		short sdata[] = (short[]) pixelData;
		if (sdata.length != 1) {
			throw new UnsupportedOperationException(
					"This method is not supported by this color model");
		}
		short pixelValue = sdata[0];

		return pixelValue;
	}
1235062
def _load_shader(filename):
    """"""
    curdir = op.dirname(op.realpath(__file__))
    glsl_path = op.join(curdir, 'glsl')
    path = op.join(glsl_path, filename)
    with open(path, 'r') as f:
        return f.read()