Adds custom images to Artprovider
763187
def CreateBitmap(self, artid, client, size):
        """"""

        if artid in self.extra_icons:
            return wx.Bitmap(self.extra_icons[artid], wx.BITMAP_TYPE_ANY)

        else:
            return wx.ArtProvider.GetBitmap(artid, client, size)
503015
function insertImage(map) {
    let src = map.selectNode().image.src;

    if (src === "") {
        let value = prompt("Please enter your name", "example/img/material-icons/add.svg");

        if (value) {
            map.updateNode("imageSrc", value);
        }
    } else {
        map.updateNode("imageSrc", "");
    }
}
1229932
private function createCoreImages()
    {
        Helper::createFolderIfNoExist(PATH_HOME . "assetsPublic/img");
        $config = json_decode(file_get_contents(PATH_HOME . "_config/config.json"), true);
        copy(PATH_HOME . VENDOR . "config/public/assets/dino.png", PATH_HOME . "assetsPublic/img/dino.png");
        copy(PATH_HOME . VENDOR . "config/public/assets/file.png", PATH_HOME . "assetsPublic/img/file.png");
        copy(PATH_HOME . VENDOR . "config/public/assets/save.gif", PATH_HOME . "assetsPublic/img/save.gif");
        copy(PATH_HOME . VENDOR . "config/public/assets/file_type.svg", PATH_HOME . "assetsPublic/img/file_type.svg");
        copy(PATH_HOME . VENDOR . "config/public/assets/image-not-found.png", PATH_HOME . "assetsPublic/img/img.png");

        if(file_exists(PATH_HOME . (!empty($config['favicon']) ? "uploads/site/favicon.png" : VENDOR . "config/public/assets/favicon.png")))
        copy(PATH_HOME . (!empty($config['favicon']) ? "uploads/site/favicon.png" : VENDOR . "config/public/assets/favicon.png"), PATH_HOME . "assetsPublic/img/favicon.png");

        if(!empty($config['logo']) && file_exists(PATH_HOME . "uploads/site/logo.png"))
            copy(PATH_HOME . "uploads/site/logo.png", PATH_HOME . "assetsPublic/img/logo.png");

        elseif(file_exists(PATH_HOME . "assetsPublic/img/logo.png"))
            unlink(PATH_HOME . "assetsPublic/img/logo.png");
    }
179311
protected void addToClassPath(Iterable<ArtifactContainer> artifacts) {

        for (ArtifactContainer art : artifacts) {
            smartClassPath.addArtifactContainer(art);
        }
    }
1146954
public void setForegroundIcon(final PROVIDER iconProvider, final Color color) {
        // copy old images to replace later.
        final Shape oldForegroundIcon = foregroundIcon;
        final Shape oldForegroundFadeIcon = foregroundFadeIcon;

        // create new images.
        this.foregroundIcon = createIcon(iconProvider, Layer.FOREGROUND);
        this.foregroundFadeIcon = createColorFadeIcon(iconProvider, Layer.FOREGROUND);

        // setup icon color
        if (color != null) {
            setForegroundIconColor(color);
        }

        // replace old icons with new ones.
        getChildren().replaceAll((node) -> {
            if (node.equals(oldForegroundIcon)) {
                return foregroundIcon;
            } else if (node.equals(oldForegroundFadeIcon)) {
                return foregroundFadeIcon;
            } else {
                return node;
            }
        }
806088
function legendProvider(publicAPI, model) {
  publicAPI.addLegendEntry = (name) => {
    if (model.legendEntries.indexOf(name) === -1 && name) {
      model.legendEntries.push(name);
      model.legendDirty = true;
    }
  };

  publicAPI.removeLegendEntry = (name) => {
    if (model.legendEntries.indexOf(name) !== -1 && name) {
      model.legendEntries.splice(model.legendEntries.indexOf(name), 1);
      model.legendDirty = true;
    }
  };
  publicAPI.removeAllLegendEntry = () => {
    model.legendEntries = [];
    model.legendDirty = true;
  };

  publicAPI.assignLegend = (newPriority = null) => {
    if (newPriority) {
      model.legendPriorities = newPriority;
      model.legendDirty = true;
    }
    if (model.legendDirty) {
      const shapesArray = Object.keys(model.legendShapes);
      model.legendDirty = false;
      model.legendMapping = {};

      if (model.legendPriorities && model.legendPriorities.length) {
        const defaultColor = model.legendColors[0];
        const defaultShape = shapesArray[0];

        const iterator = createSortedIterator(
          model.legendPriorities,
          { colors: model.legendColors, shapes: shapesArray },
          { colors: defaultColor, shapes: defaultShape }
        );

        model.legendEntries.forEach((name) => {
          model.legendMapping[name] = convert(iterator.get(), model);
          iterator.next();
        });
      } else {
        model.legendEntries.forEach((name, idx) => {
          model.legendMapping[name] = {
            color: model.legendColors[idx % model.legendColors.length],
            shape: model.legendShapes[shapesArray[idx % shapesArray.length]],
          };
        });
      }
    }
  };

  publicAPI.useLegendPalette = (name) => {
    const colorSet = palettes[name];
    if (colorSet) {
      model.legendColors = [].concat(colorSet);
      model.legendDirty = true;
    }
  };

  publicAPI.updateLegendSettings = (settings) => {
    [
      'legendShapes',
      'legendColors',
      'legendEntries',
      'legendPriorities',
    ].forEach((key) => {
      if (settings[key]) {
        model[key] = [].concat(settings.key);
        model.legendDirty = true;
      }
    });
  };

  publicAPI.listLegendColorPalettes = () => Object.keys(palettes);

  publicAPI.getLegend = (name) => {
    if (model.legendDirty) {
      publicAPI.assignLegend();
    }
    return model.legendMapping[name];
  };
}
1201133
def before_render(self):
        
        # Render the Add button if the user has the AddClient permission
        if check_permission(AddMethod, self.context):
            self.context_actions[_("Add")] = {
                "url": "createObject?type_name=Method",
                "icon": "++resource++bika.lims.images/add.png"
            }
        # Don't allow any context actions on the Methods folder
        self.request.set("disable_border", 1)
782643
def _repaint(self, drawing_context: DrawingContext.DrawingContext):
        """"""

        # canvas size
        canvas_width = self.canvas_size.width
        canvas_height = self.canvas_size.height

        with drawing_context.saver():
            if self.__color_map_data is not None:
                rgba_image = numpy.empty((4,) + self.__color_map_data.shape[:-1], dtype=numpy.uint32)
                Image.get_rgb_view(rgba_image)[:] = self.__color_map_data[numpy.newaxis, :, :]  # scalar data assigned to each component of rgb view
                Image.get_alpha_view(rgba_image)[:] = 255
                drawing_context.draw_image(rgba_image, 0, 0, canvas_width, canvas_height)
322484
def add_image(image)
      raise ArgumentError, "Invalid argument 'image'. Expected Image, got #{image.class}." unless image.is_a?(Image)
      @images << image
      @associated_images[image.uid] = image
    end
245881
function(imageIdentifier, options) {
        if (typeof imageIdentifier !== 'string' || imageIdentifier.length === 0) {
            throw new Error(
                '`imageIdentifier` must be a non-empty string, was "' + imageIdentifier + '"' +
                ' (' + typeof imageIdentifier + ')'
            );
        }

        options = options || {};

        return new ImageUrl({
            baseUrl: this.getHostForImageIdentifier(
                imageIdentifier,
                options.usePrimaryHost
            ),
            path: options.path,
            user: this.options.user,
            publicKey: this.options.publicKey,
            privateKey: this.options.privateKey,
            imageIdentifier: imageIdentifier
        });
    }
411938
def set_image(self, user, image_path):
        """"""
        _, ext = os.path.splitext(image_path)
        shutil.copy(image_path, self._custom_image_path(user, ext))
1133518
def add_image(image)
      raise ArgumentError, "Invalid argument 'image'. Expected Image, got #{image.class}." unless image.is_a?(Image)
      @images << image unless @frame.image(image.uid)
      @slices[image.uid] = image.pos_slice
      @image_positions[image.pos_slice.round(2)] = image
      @sop_uids[image.pos_slice] = image.uid
      # The link between image uid and image instance is kept in the Frame, instead of the ImageSeries:
      @frame.add_image(image) unless @frame.image(image.uid)
    end
917802
def _updateImage(self):
        """"""
        # Fill the background of the image
        if self.backgroundColor is not None:
            self.textImage.fill(self.backgroundColor)

        # Render the text as a single line, and blit it onto the textImage surface
        if self.mask is None:
            lineSurface = self.font.render(self.text, True, self.textColor)
        else:
            nChars = len(self.text)
            maskedText = self.mask * nChars
            lineSurface = self.font.render(maskedText, True, self.textColor)
        self.textImage.blit(lineSurface, (0, 0))
638557
function preloadImages( images, callback ) {

    function _preload( asset ) {
        asset.img = new Image();
        asset.img.src = 'img/' + asset.id+'.png';

        asset.img.addEventListener("load", function() {
            _check();
        }, false);

        asset.img.addEventListener("error", function(err) {
            _check(err, asset.id);
        }, false);
    }

    var loadc = 0;
    function _check( err, id ) {
        if ( err ) {
            alert('Failed to load ' + id );
        }
        loadc++;
        if ( images.length == loadc )
            return callback()
    }

    images.forEach(function(asset) {
        _preload( asset );
    });
}
530215
protected function addImageStyle()
    {
        $this->controlAccess('image_style_add');

        if ($this->image_style->add($this->getSubmitted())) {
            $this->redirect('admin/settings/imagestyle', $this->text('Image style has been added'), 'success');
        }

        $this->redirect('', $this->text('Image style has not been added'), 'warning');
    }
486633
function drawImage(editor) {
	var cm = editor.codemirror;
	var stat = getState(cm);
	var options = editor.options;
	var url = "http://";
	if(options.promptURLs) {
		url = prompt(options.promptTexts.image);
		if(!url) {
			return false;
		}
	}
	_replaceSelection(cm, stat.image, options.insertTexts.image, url);
}
581445
def _generate_art(self, image, width, height):
        
        image = image.resize((width, height), Image.ANTIALIAS).convert("RGB")
        pixels = list(image.getdata())

        for y in range(0, height - 1, 2):
            for x in range(width):
                i = y * width + x
                bg = rgb2short(*(pixels[i]))
                fg = rgb2short(*(pixels[i + width]))
                yield (fg, bg)