used in extension image
431985
public static Object callWithNamedValues(PageContext pc, Object coll, Collection.Key methodName, Struct args, short type, String strType) throws PageException {
	Map<Key, FunctionLibFunction> members = getMembers(pc, type);
	FunctionLibFunction member = members.get(methodName);

	if (member != null) {
	    List<FunctionLibFunctionArg> _args = member.getArg();
	    FunctionLibFunctionArg arg;
	    if (args.size() < _args.size()) {
		Object val;
		ArrayList<Ref> refs = new ArrayList<Ref>();
		arg = _args.get(0);
		refs.add(new Casting(arg.getTypeAsString(), arg.getType(), new LFunctionValue(new LString(arg.getName()), coll)));
		for (int y = 1; y < _args.size(); y++) {
		    arg = _args.get(y);

		    // match by name
		    val = args.get(arg.getName(), null);

		    // match by alias
		    if (val == null) {
			String alias = arg.getAlias();
			if (!StringUtil.isEmpty(alias, true)) {
			    String[] aliases = lucee.runtime.type.util.ListUtil.trimItems(lucee.runtime.type.util.ListUtil.listToStringArray(alias, ','));
			    for (int x = 0; x < aliases.length; x++) {
				val = args.get(aliases[x], null);
				if (val != null) break;
			    }
			}
		    }

		    if (val == null) {
			if (arg.getRequired()) {
			    String[] names = member.getMemberNames();
			    String n = ArrayUtil.isEmpty(names) ? "" : names[0];
			    throw new ExpressionException("missing required argument [" + arg.getName() + "] for member function call [" + n + "]");
			}
		    }
		    else {
			refs.add(new Casting(arg.getTypeAsString(), arg.getType(), new LFunctionValue(new LString(arg.getName()), val)));
			// refs.add(new LFunctionValue(new LString(arg.getName()),new
			// Casting(pc,arg.getTypeAsString(),arg.getType(),val)));
		    }

		}
		return new BIFCall(coll, member, refs.toArray(new Ref[refs.size()])).getValue(pc);
	    }

	}
	throw new ExpressionException("No matching function member [" + methodName + "] for call with named arguments found, available function members are ["
		+ lucee.runtime.type.util.ListUtil.sort(CollectionUtil.getKeyList(members.keySet().iterator(), ","), "textnocase", "asc", ",") + "]");
    }
873845
public static Image makeActionImage (Image image, String tip, ClickHandler onClick)
    {
        if (tip != null) {
            image.setTitle(tip);
        }
        return makeActionable(image, onClick, null);
    }
259023
function updateSplashScreenImageExtensions (cordovaProject, locations) {

    // Saving all extensions used for targets to verify them later
    var extensionsUsed = {};

    function checkThatExtensionsAreNotMixed () {
        for (var target in extensionsUsed) {
            if (extensionsUsed.hasOwnProperty(target)) {
                var extensionsUsedForTarget = extensionsUsed[target];

                // Check that extensions are not mixed:
                if (extensionsUsedForTarget.length > 1 && extensionsUsedForTarget.some(function (item) {
                    return item !== extensionsUsedForTarget[0];
                })) {
                    events.emit('warn', '"' + target + '" splash screens have mixed file extensions which is not supported. Some of the images will not be used.');
                }
            }
        }
    }

    function checkTargetMatchAndUpdateUsedExtensions (img, target) {
        var matchesTarget = getTargetForImage(img) === target;

        if (matchesTarget === true) {
            extensionsUsed[target] = extensionsUsed[target] || [];
            extensionsUsed[target].push(path.extname(img.src.toLowerCase()));
        }

        return matchesTarget;
    }

    function updateSplashExtensionInManifest (manifestFileName, splashScreen) {
        var manifest = AppxManifest.get(path.join(locations.root, manifestFileName));
        var newExtension = path.extname(splashScreen.src);

        if (manifest.getVisualElements().getSplashScreenExtension() !== newExtension) {
            events.emit('verbose', 'Set ' + manifestFileName + ' SplashScreen image extension to "' + newExtension + '"');
            manifest.getVisualElements().setSplashScreenExtension(newExtension);
            manifest.write();
        }
    }

    var splashScreens = cordovaProject.projectConfig.getSplashScreens('windows');

    var desktopSplashScreen = splashScreens.filter(function (img) {
        return checkTargetMatchAndUpdateUsedExtensions(img, SPLASH_SCREEN_DESKTOP_TARGET_NAME);
    })[0];

    var phoneSplashScreen = splashScreens.filter(function (img) {
        return checkTargetMatchAndUpdateUsedExtensions(img, SPLASH_SCREEN_PHONE_TARGET_NAME);
    })[0];

    checkThatExtensionsAreNotMixed();

    var manifestSplashScreenMap = {};
    manifestSplashScreenMap[MANIFEST_WINDOWS] = desktopSplashScreen;
    manifestSplashScreenMap[MANIFEST_WINDOWS10] = desktopSplashScreen;
    manifestSplashScreenMap[MANIFEST_PHONE] = phoneSplashScreen;

    for (var manifest in manifestSplashScreenMap) {
        if (manifestSplashScreenMap.hasOwnProperty(manifest)) {
            var splashScreen = manifestSplashScreenMap[manifest];
            if (!splashScreen) {
                return;
            }

            updateSplashExtensionInManifest(manifest, splashScreen);
        }
    }
}
1150029
function writeGraphicCtrlExt() {
    out.writeByte(0x21); // extension introducer
    out.writeByte(0xf9); // GCE label
    out.writeByte(4); // data block size
    var transp;
    var disp;
    if (transparent === null) {
      transp = 0;
      disp = 0; // dispose = no action
    } else {
      transp = 1;
      disp = 2; // force clear if using transparent color
    }
    if (dispose >= 0) {
      disp = dispose & 7; // user override
    }
    disp <<= 2;
    // packed fields
    out.writeByte(0 | // 1:3 reserved
      disp | // 4:6 disposal
      0 | // 7 user input - 0 = none
      transp); // 8 transparency flag

    WriteShort(delay); // delay x 1/100 sec
    out.writeByte(transIndex); // transparent color index
    out.writeByte(0); // block terminator
  }
816671
function(imageUrl, callback) {
        var url = imageUrl.clone(),
            extension = url.getExtension(),
            imageId = url.getImageIdentifier(),
            host = this.getHostForImageIdentifier(imageId);

        var data = {
            imageIdentifier: imageId,
            user: url.getUser(),
            publicKey: url.getPublicKey(),
            query: url.getQueryString()
        };

        if (extension) {
            data.extension = extension;
        }

        // Reset to remove transformations/query string
        url.reset().setPath('/shorturls');

        request({
            method: 'POST',
            uri: this.getSignedResourceUrl('POST', url.toString()),
            json: data,
            onComplete: function(err, res, body) {
                if (err) {
                    return callback(err);
                } else if (!body || !body.id) {
                    return callback('No ShortUrl was returned from server');
                }

                callback(err, new ShortUrl({ baseUrl: host, id: body.id }));
            }
        });

        return this;
    }
1222574
public static function img($path, $extensionId = null) {
        if (is_null($extensionId)) {
            $extensionId = \Context::getInstance()->getExtensionName();
        }

        return self::getAssetService()->getAsset('img/'.$path, $extensionId);
    }
853744
function getImageData(img, width) {
		var can, ctx, imgd, buf8, buf32, height;

		switch (typeOf(img)) {
			case "HTMLImageElement":
				can = document.createElement("canvas");
				can.width = img.naturalWidth;
				can.height = img.naturalHeight;
				ctx = can.getContext("2d");
				ctx.drawImage(img,0,0);
			case "Canvas":
			case "HTMLCanvasElement":
				can = can || img;
				ctx = ctx || can.getContext("2d");
			case "CanvasRenderingContext2D":
				ctx = ctx || img;
				can = can || ctx.canvas;
				imgd = ctx.getImageData(0, 0, can.width, can.height);
			case "ImageData":
				imgd = imgd || img;
				width = imgd.width;
				if (typeOf(imgd.data) == "CanvasPixelArray")
					buf8 = new Uint8Array(imgd.data);
				else
					buf8 = imgd.data;
			case "Array":
			case "CanvasPixelArray":
				buf8 = buf8 || new Uint8Array(img);
			case "Uint8Array":
			case "Uint8ClampedArray":
				buf8 = buf8 || img;
				buf32 = new Uint32Array(buf8.buffer);
			case "Uint32Array":
				buf32 = buf32 || img;
				buf8 = buf8 || new Uint8Array(buf32.buffer);
				width = width || buf32.length;
				height = buf32.length / width;
		}

		return {
			can: can,
			ctx: ctx,
			imgd: imgd,
			buf8: buf8,
			buf32: buf32,
			width: width,
			height: height,
		};
	}
632746
function AddShadowToImage(i, w, h, scale, sc, sb, so) {
  var sw = abs(so[0]), sh = abs(so[1]),
    cw = w + (sw > sb ? sw + sb : sb * 2) * scale,
    ch = h + (sh > sb ? sh + sb : sb * 2) * scale,
    xo = scale * ((sb || 0) + (so[0] < 0 ? sw : 0)),
    yo = scale * ((sb || 0) + (so[1] < 0 ? sh : 0)), cv, c;
  cv = NewCanvas(cw, ch);
  if(!cv)
    return null;
  c = cv.getContext('2d');
  sc && (c.shadowColor = sc);
  sb && (c.shadowBlur = sb * scale);
  so && (c.shadowOffsetX = so[0] * scale, c.shadowOffsetY = so[1] * scale);
  c.drawImage(i, xo, yo, w, h);
  return {image: cv, width: cw / scale, height: ch / scale};
}
1247481
function deeplyExtendPkg(a, b) {
	if(!a.resolutions) {
		a.resolutions = {};
	}
	utils.extend(a.resolutions, b.resolutions || {});

	if(!a.steal) {
		a.steal = {};
	}
	if(!b.steal) {
		b.steal = {};
	}

	utils.extend(a.steal, b.steal, true);
}
131660
def image(self, name, x=None, y=None, w=0,h=0,type='',link=''):
        ""
        if not name in self.images:
            #First use of image, get info
            if(type==''):
                pos=name.rfind('.')
                if(not pos):
                    self.error('image file has no extension and no type was specified: '+name)
                type=substr(name,pos+1)
            type=type.lower()
            if(type=='jpg' or type=='jpeg'):
                info=self._parsejpg(name)
            elif(type=='png'):
                info=self._parsepng(name)
            else:
                #Allow for additional formats
                #maybe the image is not showing the correct extension,
                #but the header is OK,
                succeed_parsing = False
                #try all the parsing functions
                parsing_functions = [self._parsejpg,self._parsepng,self._parsegif]
                for pf in parsing_functions:
                    try:
                        info = pf(name)
                        succeed_parsing = True
                        break;
                    except:
                        pass
                #last resource
                if not succeed_parsing:
                    mtd='_parse'+type
                    if not hasattr(self,mtd):
                        self.error('Unsupported image type: '+type)
                    info=getattr(self, mtd)(name)
                mtd='_parse'+type
                if not hasattr(self,mtd):
                    self.error('Unsupported image type: '+type)
                info=getattr(self, mtd)(name)
            info['i']=len(self.images)+1
            self.images[name]=info
        else:
            info=self.images[name]
        #Automatic width and height calculation if needed
        if(w==0 and h==0):
            #Put image at 72 dpi
            w=info['w']/self.k
            h=info['h']/self.k
        elif(w==0):
            w=h*info['w']/info['h']
        elif(h==0):
            h=w*info['h']/info['w']
        # Flowing mode
        if y is None:
            if (self.y + h > self.page_break_trigger and not self.in_footer and self.accept_page_break()):
                #Automatic page break
                x = self.x
                self.add_page(self.cur_orientation)
                self.x = x
            y = self.y
            self.y += h
        if x is None:
            x = self.x
        self._out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',w*self.k,h*self.k,x*self.k,(self.h-(y+h))*self.k,info['i']))
        if(link):
            self.link(x,y,w,h,link)
52090
def show_extension(self, ext_alias, **_params):
        """"""
        return self.get(self.extension_path % ext_alias, params=_params)
1033341
function Images(el, options) {
        this.el = el;
        this.$el = $(el);
        this.$currentImage = null;
        this.templates = window.MediumInsert.Templates;
        this.core = this.$el.data('plugin_' + pluginName);

        this.options = $.extend(true, {}, defaults, options);

        this._defaults = defaults;
        this._name = pluginName;

        // Allow image preview only in browsers, that support's that
        if (this.options.preview && !window.FileReader) {
            this.options.preview = false;
        }

        // Extend editor's functions
        if (this.core.getEditor()) {
            this.core.getEditor()._serializePreImages = this.core.getEditor().serialize;
            this.core.getEditor().serialize = this.editorSerialize;
        }

        this.init();
    }
230577
public function expandBackgroundShorthand() {
		$aRules = $this->getRulesAssoc();
		if (!isset($aRules['background']))
			return;
		$oRule = $aRules['background'];
		$aBgProperties = array(
			'background-color' => array('transparent'), 'background-image' => array('none'),
			'background-repeat' => array('repeat'), 'background-attachment' => array('scroll'),
			'background-position' => array(new Size(0, '%', null, false, $this->iLineNo), new Size(0, '%', null, false, $this->iLineNo))
		);
		$mRuleValue = $oRule->getValue();
		$aValues = array();
		if (!$mRuleValue instanceof RuleValueList) {
			$aValues[] = $mRuleValue;
		} else {
			$aValues = $mRuleValue->getListComponents();
		}
		if (count($aValues) == 1 && $aValues[0] == 'inherit') {
			foreach ($aBgProperties as $sProperty => $mValue) {
				$oNewRule = new Rule($sProperty, $this->iLineNo);
				$oNewRule->addValue('inherit');
				$oNewRule->setIsImportant($oRule->getIsImportant());
				$this->addRule($oNewRule);
			}
			$this->removeRule('background');
			return;
		}
		$iNumBgPos = 0;
		foreach ($aValues as $mValue) {
			if (!$mValue instanceof Value) {
				$mValue = mb_strtolower($mValue);
			}
			if ($mValue instanceof URL) {
				$aBgProperties['background-image'] = $mValue;
			} else if ($mValue instanceof Color) {
				$aBgProperties['background-color'] = $mValue;
			} else if (in_array($mValue, array('scroll', 'fixed'))) {
				$aBgProperties['background-attachment'] = $mValue;
			} else if (in_array($mValue, array('repeat', 'no-repeat', 'repeat-x', 'repeat-y'))) {
				$aBgProperties['background-repeat'] = $mValue;
			} else if (in_array($mValue, array('left', 'center', 'right', 'top', 'bottom'))
					|| $mValue instanceof Size
			) {
				if ($iNumBgPos == 0) {
					$aBgProperties['background-position'][0] = $mValue;
					$aBgProperties['background-position'][1] = 'center';
				} else {
					$aBgProperties['background-position'][$iNumBgPos] = $mValue;
				}
				$iNumBgPos++;
			}
		}
		foreach ($aBgProperties as $sProperty => $mValue) {
			$oNewRule = new Rule($sProperty, $this->iLineNo);
			$oNewRule->setIsImportant($oRule->getIsImportant());
			$oNewRule->addValue($mValue);
			$this->addRule($oNewRule);
		}
		$this->removeRule('background');
	}
841791
def image(self, s=0, c=0, z=0, t=0):
        
        return self.proxy_image(s=s, c=c, z=z, t=t).image
917328
function getBackgroundPosition(image) {
	var logicValue = image.isSVG ? 1 : -1;
	var x = logicValue * (image.ratio > 1 ? image.coordinates.x / image.ratio : image.coordinates.x);
	var y = logicValue * (image.ratio > 1 ? image.coordinates.y / image.ratio : image.coordinates.y);
	var template = _.template('<%= (x ? x + "px" : x) %> <%= (y ? y + "px" : y) %>');
	return template({x: x, y: y});
}
765555
function (size, background, foreground, format, text) {
    // Random.image( size, background, foreground, text )
    if (arguments.length === 4) {
      text = format
      format = undefined
    }
    // Random.image( size, background, text )
    if (arguments.length === 3) {
      text = foreground
      foreground = undefined
    }
    // Random.image()
    if (!size) size = this.pick(this._adSize)

    if (background && ~background.indexOf('#')) background = background.slice(1)
    if (foreground && ~foreground.indexOf('#')) foreground = foreground.slice(1)

    // http://dummyimage.com/600x400/cc00cc/470047.png&text=hello
    return 'http://dummyimage.com/' + size +
            (background ? '/' + background : '') +
            (foreground ? '/' + foreground : '') +
            (format ? '.' + format : '') +
            (text ? '&text=' + text : '')
  }
643653
public static String getExtension(String fileName) {
        if (fileName.contains(".")) {
            return fileName.substring(fileName.lastIndexOf(".") + 1);
        }
        return "png";
    }