GD-based icon generation worker
435926
private function generateGD()
    {
        $color   = $this->toRGB($this->color);
        $bgcolor = $this->toRGB($this->bgcolor);

        // create an image, setup colors
        $image   = imagecreate($this->width, $this->height);
        $color   = imagecolorallocate($image, $color[0], $color[1], $color[2]);
        $bgcolor = imagecolorallocate($image, $bgcolor[0], $bgcolor[1], $bgcolor[2]);

        imagefilledrectangle($image, 0, 0, $this->width, $this->height, $bgcolor);

        // draw the grid created in self::generate()
        foreach ($this->grid as $item) {
            if ($item['active']) {
                imagefilledrectangle($image, $item['x1'], $item['y1'], $item['x2'], $item['y2'], $color);
            }
        }

        // generate an image and save it to a variable
        ob_start();
        imagepng($image, null, 6, PNG_ALL_FILTERS);
        $this->binary = ob_get_contents();
        ob_end_clean();

        // cleanup
        imagedestroy($image);
    }
184972
function(f) {
				f.mime && f.mime !== 'directory' && !addedBadges[f.mime] && addBadgeStyle(f.mime, f.name);
				return templates[list ? 'row' : 'icon']
						.replace(/\{([a-z0-9_]+)\}/g, function(s, e) { 
							return replacement[e] ? replacement[e](f, fm) : (f[e] ? f[e] : ''); 
						});
			}
913452
function(rm, oRoadMap, oStep){
		var fCreateIcon = function(rm, oRoadMap, sId, sIcon, sAdditonalClass){
			rm.write("<div");
			rm.writeAttribute("id", sId + "-ico");
			rm.addClass("sapUiRoadMapStepIco");
			if (sAdditonalClass) {
				rm.addClass(sAdditonalClass);
			}
			rm.writeClasses();
			rm.write("></div>");
		};

		var bIsExpanded = oStep.getExpanded();

		//Render the start step with an additional icon
		renderStep(rm, oRoadMap, oStep, bIsExpanded ? ["sapUiRoadMapExpanded"] : null, function(rm, oRoadMap, oStep){
			fCreateIcon(rm, oRoadMap, oStep.getId(), bIsExpanded ? "roundtripstart.gif" : "roundtrip.gif");
		});

		//Render the sub steps
		var aSteps = oStep.getSubSteps();
		for (var i = 0; i < aSteps.length; i++) {
			var aClasses = ["sapUiRoadMapSubStep"];
			if (!bIsExpanded && aSteps[i].getVisible()) {
				aClasses.push("sapUiRoadMapHidden");
			}
			renderStep(rm, oRoadMap, aSteps[i], aClasses);
		}

		//Render the end step with an additional icon
		aClasses = ["sapUiRoadMapExpanded", "sapUiRoadMapStepEnd"];
		if (!bIsExpanded) {
			aClasses.push("sapUiRoadMapHidden");
		}
		renderStep(rm, oRoadMap, oStep, aClasses, function(rm, oRoadMap, oStep){
			fCreateIcon(rm, oRoadMap, oStep.getId() + "-expandend", "roundtripend.gif");
		}, oStep.getId() + "-expandend");
	}
1164218
def _icon_by_painter(self, painter, options):
        """"""
        engine = CharIconEngine(self, painter, options)
        return QIcon(engine)
1041329
function toSvg(name, attrs = {}) {
  console.warn(
    'feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead.',
  );

  if (!name) {
    throw new Error('The required `key` (icon name) parameter is missing.');
  }

  if (!icons[name]) {
    throw new Error(
      `No icon matching '${
        name
      }'. See the complete list of icons at https://feathericons.com`,
    );
  }

  return icons[name].toSvg(attrs);
}
946337
function merge(target, source) {
  // Check if font name is changed
  if (source['font-name']) {
    target['font-name'] = source['font-name'];
  }

  // Check if root dir is changed
  if (source['root-dir']) {
    target['root-dir'] = source['root-dir'];
  }

  // Check for icon changes
  if (source.icons) {
    for (let icon of source['icons']) {
      let index = iconsIndex.indexOf(icon.name);

      // Icon is replaced
      if (index !== -1) {
        target.icons[index] = icon;
      }
      // New icon is added
      else {
        target.icons.push(icon);
        iconsIndex.push(icon.name);
      }
    }
  }

  return target;
}
621454
private void paintBackgroundTogetherIncrease(Graphics2D g, int width, int height) {
        Shape s = shapeGenerator.createScrollButtonTogetherIncrease(0, 0, width, height);

        dropShadow.fill(g, s);
        fillScrollBarButtonInteriorColors(g, s, isIncrease, buttonsTogether);
    }
1370826
def setup_icons(self, ):
        
        folder_icon = get_icon('glyphicons_144_folder_open.png', asicon=True)
        self.asset_open_pb.setIcon(folder_icon)
        self.shot_open_pb.setIcon(folder_icon)

        floppy_icon = get_icon('glyphicons_446_floppy_save.png', asicon=True)
        self.asset_save_pb.setIcon(floppy_icon)
        self.shot_save_pb.setIcon(floppy_icon)
443500
public static Bitmap createIcon(IconRow icon, float density, IconCache iconCache) {
        return iconCache.createIcon(icon, density);
    }
590903
private void paintMinimizeHover(Graphics2D g, JComponent c, int width, int height) {
        iconifyPainter.paintHover(g, c, width, height);
    }
44848
def _custom_icon(self, name, **kwargs):
        """"""
        options = dict(_default_options, **kwargs)
        if name in self.painters:
            painter = self.painters[name]
            return self._icon_by_painter(painter, options)
        else:
            return QIcon()
906645
def icon(self, *names, **kwargs):
        """"""
        cache_key = '{}{}'.format(names,kwargs)
        if cache_key not in self.icon_cache:
            options_list = kwargs.pop('options', [{}] * len(names))
            general_options = kwargs

            if len(options_list) != len(names):
                error = '"options" must be a list of size {0}'.format(len(names))
                raise Exception(error)

            if QApplication.instance() is not None:
                parsed_options = []
                for i in range(len(options_list)):
                    specific_options = options_list[i]
                    parsed_options.append(self._parse_options(specific_options,
                                                              general_options,
                                                              names[i]))

                # Process high level API
                api_options = parsed_options

                self.icon_cache[cache_key] = self._icon_by_painter(self.painter, api_options)
            else:
                warnings.warn("You need to have a running "
                              "QApplication to use QtAwesome!")
                return QIcon()
        return self.icon_cache[cache_key]
830392
function image(oIcon) {
				var oImage = new Image({
					id: sDialogId + "--icon",
					tooltip: rb && rb.getText("MSGBOX_ICON_" + oIcon),
					decorative: true
				});
				oImage.addStyleClass("sapUiMboxIcon");
				oImage.addStyleClass(mIconClass[oIcon]);
				return oImage;
			}
1338349
function (options, dir, callback) {
  var iconFile = path.join(dir, getPixmapPath(options))
  options.logger('Creating icon file at ' + iconFile)

  fs.copy(options.icon, iconFile, function (err) {
    callback(err && new Error('Error creating icon file: ' + (err.message || err)))
  })
}
592893
def run(arguments):
    """"""
    parser = argparse.ArgumentParser(
        description="Exports font icons as PNG images."
    )
    parser.add_argument(
        '--list',
        action='store_true',
        help="list all available icon names and exit"
    )
    parser.add_argument(
        '--download',
        choices=[x for x in AVAILABLE_ICON_FONTS.keys()],
        help="download latest icon font and exit"
    )

    required_group = parser.add_argument_group("required arguments")
    required_group.add_argument(
        '--ttf',
        metavar='TTF-FILE',
        type=open,
        help='path to TTF file'
    )
    required_group.add_argument(
        '--css',
        metavar='CSS-FILE',
        type=open,
        help="path to CSS file"
    )

    exp_group = parser.add_argument_group("exporting icons")
    exp_group.add_argument(
        'icons',
        type=str,
        nargs='*',
        help="names of the icons to export (or 'ALL' for all icons)"
    )
    exp_group.add_argument(
        '--size',
        type=int,
        default=16,
        help="icon size in pixels (default: 16)"
    )
    exp_group.add_argument(
        '--scale',
        type=str,
        default='auto',
        help="scaling factor between 0 and 1, or 'auto' for automatic scaling "
             "(default: auto); be careful, as setting it may lead to icons "
             "being cropped"
    )
    exp_group.add_argument(
        '--color',
        type=str,
        default='black',
        help="color name or hex value (default: black)"
    )
    exp_group.add_argument(
        '--filename',
        type=str,
        help="name of the output file (without '.png' extension); "
             "it's used as a prefix if multiple icons are exported"
    )
    exp_group.add_argument(
        '--keep_prefix',
        default=False,
        action='store_true',
        help="do not remove common icon prefix "
             "(i.e. 'fa-arrow-right' instead of 'arrow-right')"
    )

    args = parser.parse_args(arguments)

    # Parse '--download' argument first
    if args.download:
        downloader = download_icon_font(args.download, os.getcwd())
        downloader.download_files()
        print("Icon font '{name}' successfully downloaded".format(
            name=args.download)
        )
        parser.exit()

    # If not '--download', then css and tff files are required
    if not args.css or not args.ttf:
        parser.error("You have to provide CSS and TTF files")

    icon_font = IconFont(css_file=args.css.name,
                         ttf_file=args.ttf.name,
                         keep_prefix=args.keep_prefix)
    args.css.close()
    args.ttf.close()

    # Then '--list'
    if args.list:
        for icon in icon_font.css_icons.keys():
            print(icon)
        parser.exit()

    # If not '--list' or '--download', parse passed icons
    selected_icons = list()
    if not args.icons:
        parser.error("You have to pass at least one icon name")
    elif args.icons == ['ALL']:
        selected_icons = icon_font.css_icons.keys()
    else:
        for icon in args.icons:
            if (args.keep_prefix and
                    not icon.startswith(icon_font.common_prefix)):
                # Prepend icon name with prefix
                icon = icon_font.common_prefix + icon
            elif (not args.keep_prefix and
                  icon.startswith(icon_font.common_prefix)):
                # Remove prefix from icon name
                icon = icon[len(icon_font.common_prefix):]

            # Check if given icon names exist
            if icon in icon_font.css_icons:
                selected_icons.append(icon)
            else:
                parser.error("Unknown icon name '{icon}'".format(icon=icon))

    # Parse filename and remove the extension if necessary
    given_filename = args.filename or ''
    if given_filename.lower().endswith('.png'):
        given_filename = given_filename[:-4]

    # Some fonts have empty values
    # (prefix only - which we remove - for common styles)
    selected_icons = list(filter(None, selected_icons))

    # Commence exporting
    for icon in selected_icons:
        if len(selected_icons) > 1:
            # Multiple icons - treat the filename option as name prefix
            filename = '{prefix}{icon}.png'.format(
                prefix=given_filename, icon=icon,
            )
        else:
            if given_filename:
                # Use the specified filename
                filename = given_filename + '.png'
            else:
                # Use icon name as filename
                filename = str(icon) + '.png'

        print("Exporting icon '{icon}' as '{filename}'"
              "({size}x{size} pixels)".format(icon=icon,
                                              filename=filename,
                                              size=args.size))

        icon_font.export_icon(icon=icon, filename=filename, size=args.size,
                              color=args.color, scale=args.scale)

    print()
    print("All done")
1265967
def badges_processor():
    """"""
    def badge_svg(title, value, color='#007ec6'):
        """Context processor function to generate SVG badges."""
        return generate_badge_svg(title, value, color)

    def badge_png(title, value, color='#007ec6'):
        """Context processor function to generate SVG badges."""
        png = generate_badge_png(title, value, color)
        png_base64 = b64encode(png)
        return 'data:image/png;base64,{0}'.format(png_base64)

    return dict(
        badge_svg=badge_svg,
        badge_png=badge_png
    )
106986
private void paintBackgroundTogetherDecrease(Graphics2D g, int width, int height) {
        Shape s = shapeGenerator.createScrollButtonTogetherDecrease(0, 0, width, height);

        dropShadow.fill(g, s);
        fillScrollBarButtonInteriorColors(g, s, isIncrease, buttonsTogether);
    }