Add object to hold shading properties

\param object id.
\param action
\param options

\return action 'new' - dictionary name
'out' - pdf output
165573
function o_shading( $id, $action, $options = '' )
    {
        if ( $action != 'new' )
        {
            $o =& $this->objects[$id];
        }

        switch ( $action )
        {
            case 'new':
            {
                $this->objects[$id] = array( 't' => 'shading',
                                             'info' => array( 'type' => '2',
                                                              'ColorSpace' => '/DeviceCMYK' ) );

            if ( !isset( $options['orientation'] ) )
            {
                $options['orientation'] = 'vertical';
            }

            if ( $options['orientation'] == 'horizontal' )
            {
                $angle = 0;
            }
            else if ( $options['orientation'] == 'vertical' )
            {
                $angle = deg2rad( 90 );
            }
            else // orientation is an angle
            {
                $angle = $options['orientation'];
            }

            $this->objects[$id]['info']['Coords'] = '[ '.  // compute angle of gradient chading
                 sprintf( '%.3F', $options['size']['x1'] ) . ' ' .
                 sprintf( '%.3F', $options['size']['y1'] + $options['size']['height'] ) . ' ' .
                 sprintf( '%.3F', $options['size']['x1'] + $options['size']['width'] * cos( $angle ) ) . ' ' .
                 sprintf( '%.3F', $options['size']['y1'] + $options['size']['height'] * ( 1 - sin( $angle ) ) ) . ']';

            //$this->objects[$id]['info']['Coords'] = '[0.0 0.0 50.0 50.0]';

            if ( is_array( $options['color0'] ) ) //Set chading colors
            {
                if ( count( $options['color0'] ) == 3 )
                {
                    $options['color0'] = eZMath::rgbToCMYK( $options['color0'] );
                }
                $color0 = array ( 'c' => sprintf( '%.3F', $options['color0']['c'] ),
                                  'm' => sprintf( '%.3F', $options['color0']['m'] ),
                                  'y' => sprintf( '%.3F', $options['color0']['y'] ),
                                  'k' => sprintf( '%.3F', $options['color0']['k'] ) );
            }
            else
            {
                $color0 = eZMath::rgbToCMYK2( 0, 0, 0 );
            }
            if ( is_array( $options['color1'] ) )
            {
                if ( count( $options['color1'] ) == 3 )
                {
                    $options['color1'] = eZMath::rgbToCMYK( $options['color1'] );
                }
                $color1 = array ( 'c' => sprintf( '%.3F', $options['color1']['c'] ),
                                  'm' => sprintf( '%.3F', $options['color1']['m'] ),
                                  'y' => sprintf( '%.3F', $options['color1']['y'] ),
                                  'k' => sprintf( '%.3F', $options['color1']['k'] ) );
            }
            else
            {
                $color1 = eZMath::rgbToCMYK2( 1, 1, 1 );
            }

            $this->numObj++;
            $this->objects[$id]['info']['Function'] = $this->numObj;
            $this->o_function( $this->numObj, 'new', array ( 'type' => '2',
                                                             'Domain' => '[0.0 1.0]',
                                                             'C0' => '['.$color0['c'].' '.$color0['m'].' '.$color0['y'].' '.$color0['k'].']',
                                                             'C1' => '['.$color1['c'].' '.$color1['m'].' '.$color1['y'].' '.$color1['k'].']',
                                                             'N' => '1.0' ) );
            $this->objects[$id]['info']['Extend'] = '[true true]';
            // also tell the pages node about the new shading
            $this->o_pages( $this->currentNode, 'shading', array( 'label' => 'Sh' . $id,
                                                                  'objNum'=> $id ) );
            return 'Sh' . $id;
            } break;

            case 'out':
            {
                $res = "\n" . $id . " 0 obj\n<< ";
                $res.= "/ShadingType " . $o['info']['type'] . "\n";
                $res.= "/ColorSpace " . $o['info']['ColorSpace'] . "\n";
                $res.= "/Coords " . $o['info']['Coords'] . "\n";
                $res.= "/Function " . $o['info']['Function'] . " 0 R\n";
                $res.= "/Extend " . $o['info']['Extend'] . "\n";
                $res.= ">>\nendobject";
                return $res;
            } break;
        }
    }
487884
def addOption(classobj, name, default, dtype=str, doc=None):
        
        # make a config object
        if not hasattr(classobj, '_config'):
            classobj._config = Kittens.config.SectionParser(ConfigFile, "render-" + classobj.renderer_id)
        # make a class-specific copy of the current option set
        if classobj._options_owner is not classobj:
            classobj.options = dict(DefaultRenderer.options)
            classobj._options_owner = classobj
        # overrid default value from config file
        if dtype is bool:
            value = classobj._config.getbool(name, default)
        else:
            value = dtype(classobj._config.get(name, default))
        # insert into dict
        classobj.options[name] = (value, default, dtype, doc)
1240098
function add(id, text, title, fn) {
			if (!buttons[id]) {
				var button = renderer.text(
					text,
					0,
					0
				)
				.css(options.toolbar.itemStyle)
				.align({
					align: 'right',
					x: -marginRight - 20,
					y: plotTop + 30
				})
				.on('click', fn)
				/*.on('touchstart', function(e) {
					e.stopPropagation(); // don't fire the container event
					fn();
				})*/
				.attr({
					align: 'right',
					zIndex: 20
				})
				.add();
				buttons[id] = button;
			}
		}
43003
public Server onpublish(Action<Map<String, Object>> action) {
    publishActions.add(action);
    return this;
  }
1223003
function Output(options) {
  if (!(this instanceof Output))
    return new Output(options);

  this.value = 0;
  this.script = new Script();

  if (options)
    this.fromOptions(options);
}
264874
function makeOptionsHot(id, options) {
  if (options.functional) {
    const render = options.render
    options.render = (h, ctx) => {
      const instances = map[id].instances
      if (ctx && instances.indexOf(ctx.parent) < 0) {
        instances.push(ctx.parent)
      }
      return render(h, ctx)
    }
  } else {
    injectHook(options, initHookName, function() {
      const record = map[id]
      if (!record.Ctor) {
        record.Ctor = this.constructor
      }
      record.instances.push(this)
    })
    injectHook(options, 'beforeDestroy', function() {
      const instances = map[id].instances
      instances.splice(instances.indexOf(this), 1)
    })
  }
}
298542
function(options) {
        options = options || this.options;

        // Create template
        var template = $(options.templateFrom);

        if (!template.length) {
            template = this.render(options.template);
        }

        if (!template.length) {
            throw new Error('Failed to render template');
        }

        // Add a class name
        if (options.className) {
            template.addClass(options.className);
        }

        // Add animation class
        if (options.animation) {
            template.addClass(options.animation);
        }

        return template
            .attr('id', this.id())
            .conceal(true) // Add hide class
            .hide() // Set display to none
            .appendTo('body');
    }
1134094
def update(cls, **kwargs):
        '''
        
        '''
        q = cls._get_instance(**{'id': kwargs['id']})
        if q:
            for k, v in kwargs.items():
                setattr(q, k, v)
            _action_and_commit(q, session.add)
        else:
            cls.get_or_create(**kwargs)
290052
function (el, params, options) {
		var isSVGElement = el.attr,
			effect,
			complete = options && options.complete;

		if (isSVGElement && !el.setStyle) {
			// add setStyle and getStyle methods for internal use in Moo
			el.getStyle = el.attr;
			el.setStyle = function () { // property value is given as array in Moo - break it down
				var args = arguments;
				this.attr.call(this, args[0], args[1][0]);
			};
			// dirty hack to trick Moo into handling el as an element wrapper
			el.$family = function () { return true; };
		}

		// stop running animations
		win.HighchartsAdapter.stop(el);

		// define and run the effect
		effect = new Fx.Morph(
			isSVGElement ? el : $(el),
			$extend({
				transition: Fx.Transitions.Quad.easeInOut
			}, options)
		);

		// Make sure that the element reference is set when animating svg elements
		if (isSVGElement) {
			effect.element = el;
		}

		// special treatment for paths
		if (params.d) {
			effect.toD = params.d;
		}

		// jQuery-like events
		if (complete) {
			effect.addEvent('complete', complete);
		}

		// run
		effect.start(params);

		// record for use in stop method
		el.fx = effect;
	}
1231901
function(id, src) {
                    return "can.Mustache(function(" + ARG_NAMES + ") { " + new Mustache({
                            text: src,
                            name: id
                        })
                        .template.out + " })";
                }
879903
function(options) {
        var params = [],
            opts = options || {},
            transform = 'contrast';

        if (opts.sharpen) {
            params.push('sharpen=' + opts.sharpen);
        }

        if (params.length) {
            transform += ':' + params.join(',');
        }

        return this.append(transform);
    }
1005579
function o_pattern( $id, $action, $options = '' )
    {
        if ( $action != 'new' )
        {
            $o =& $this->objects[$id];
        }

        switch ( $action )
        {
            case 'new':
            {
                $this->objects[$id] = array( 't' => 'shading',
                                             'info' => array() );

                if ( isset( $options['type'] ) ) //Set pattern type
                {
                    $this->objects[$id]['info']['PatternType'] = $options['type'];
                }
                else
                {
                    $this->objects[$id]['info']['PatternType'] = '2';
                }

                if ( isset( $options['matrix'] ) )
                {
                    $this->objects[$id]['info']['Matrix'] = '[ ';
                    foreach ( $options['matrix'] as $coord )
                    {
                        $this->objects[$id]['info']['Matrix'] .= sprintf( ' %.3F ', $coord );
                    }
                    $this->objects[$id]['info']['Matrix'] .= ' ]';
                }

                if ( $this->objects[$id]['info']['PatternType'] == 1 ) // Pattern type 1, tiling pattern
                {
                    $this->objects[$id]['info']['PaintType'] = $options['paintType'];
                    $this->objects[$id]['info']['TilingType'] = $options['tilingType'];

                    $this->objects[$id]['info']['BBox'] = '[ ';
                    foreach ( $options['bbox'] as $coord )
                    {
                        $this->objects[$id]['info']['BBox'] .= sprintf( ' %.3F ', $coord );
                    }
                    $this->objects[$id]['info']['BBox'] .= ']';

                    $this->objects[$id]['info']['XStep'] = $options['xstep'];
                    $this->objects[$id]['info']['YStep'] = $options['ystep'];
                }
                else // Non tiling, smooth pattern.
                {
                    if ( isset( $options['shading'] ) )
                    {
                        $this->objects[$id]['info']['Shading'] = $options['shading'] . ' R';
                    }
                }
            } break;

            case 'out':
            {
                $res = "\n" . $id . " 0 obj\n<< ";
                foreach ( $this->objects[$id]['info'] as $key => $info )
                {
                    $res .= '/' . $key . ' ' . $info[$key] . "\n";
                }
                $res .= ">>\nendobject";
                return $res;
            } break;
        }
    }
220361
function o_image($id,$action,$options=''){
    if ($action!='new'){
        $o =& $this->objects[$id];
    }
    switch($action){
        case 'new':
        // make the new object
        $this->objects[$id]=array('t'=>'image','data'=>$options['data'],'info'=>array());
        $this->objects[$id]['info']['Type']='/XObject';
        $this->objects[$id]['info']['Subtype']='/Image';
        $this->objects[$id]['info']['Width']=$options['iw'];
        $this->objects[$id]['info']['Height']=$options['ih'];
        if (!isset($options['type']) || $options['type']=='jpg'){
        if (!isset($options['channels'])){
            $options['channels']=3;
        }
        switch($options['channels']){
            case 1:
            $this->objects[$id]['info']['ColorSpace']='/DeviceGray';
            break;
            default:
            $this->objects[$id]['info']['ColorSpace']='/DeviceRGB';
            break;
        }
        $this->objects[$id]['info']['Filter']='/DCTDecode';
        $this->objects[$id]['info']['BitsPerComponent']=8;
        } else if ($options['type']=='png'){
        $this->objects[$id]['info']['Filter']='/FlateDecode';
        $this->objects[$id]['info']['DecodeParms']='<< /Predictor 15 /Colors '.$options['ncolor'].' /Columns '.$options['iw'].' /BitsPerComponent '.$options['bitsPerComponent'].'>>';
        if (strlen($options['pdata'])){
            $tmp = ' [ /Indexed /DeviceCMYK '.(strlen($options['pdata'])/3-1).' ';
            $this->numObj++;
            $this->o_contents($this->numObj,'new');
            $this->objects[$this->numObj]['c']=$options['pdata'];
            $tmp.=$this->numObj.' 0 R';
            $tmp .=' ]';
            $this->objects[$id]['info']['ColorSpace'] = $tmp;
            if (isset($options['transparency'])){
            switch($options['transparency']['type']){
                case 'indexed':
                $tmp=' [ '.$options['transparency']['data'].' '.$options['transparency']['data'].'] ';
                $this->objects[$id]['info']['Mask'] = $tmp;
                break;
            }
            }
        } else {
            $this->objects[$id]['info']['ColorSpace']='/'.$options['color'];
        }
        $this->objects[$id]['info']['BitsPerComponent']=$options['bitsPerComponent'];
        }
        // assign it a place in the named resource dictionary as an external object, according to
        // the label passed in with it.
        $this->o_pages($this->currentNode,'xObject',array('label'=>$options['label'],'objNum'=>$id));
        // also make sure that we have the right procset object for it.
        $this->o_procset($this->procsetObjectId,'add','ImageC');
        break;
        case 'out':
        $tmp=$o['data'];
        $res= "\n".$id." 0 obj\n<<";
        foreach($o['info'] as $k=>$v){
        $res.="\n/".$k.' '.$v;
        }
        if ($this->encrypted){
        $this->encryptInit($id);
        $tmp = $this->ARC4($tmp);
        }
        $res.="\n/Length ".strlen($tmp)." >>\nstream\n".$tmp."\nendstream\nendobj\n";
        return $res;
        break;
    }
    }
132629
function appendView(id, viewID, viewObj) {
  return updateItem(id, item => {
    const pos = item.views.findIndex(e => e.viewID === viewID);
    item.views.splice(pos + 1, 0, viewObj);
  });
}
443387
private void updateFormAction(String id) {

        setAction(
            CmsXmlContentUgcApi.SERVICE_URL
                + "?"
                + CmsUgcConstants.PARAM_FORM_DATA_ID
                + "="
                + id
                + "&"
                + CmsUgcConstants.PARAM_SESSION_ID
                + "="
                + m_formSession.getSessionId());
    }
679880
public void draw(Object obj, String outfile, String options) throws IOException {
		String cmd = getGraphvizBinary() + " -o " + outfile + " " + options;
		draw(obj, cmd);
	}
96621
function o_outlines( $id, $action, $options = '' )
    {
        if ( $action != 'new' )
        {
            $o =& $this->objects[$id];
        }
        switch ( $action )
        {
        case 'new':
            $this->objects[$id] = array( 't' => 'outlines', 'info' => array( 'outlines' => array() ) );
            $this->o_catalog( $this->catalogId, 'outlines', $id );
            break;
        case 'outline':
            $o['info']['outlines'][] = $options;
            break;
        case 'out':
            if ( count( $o['info']['outlines'] ) )
            {
                $res = "\n" . $id . " 0 obj\n<< /Type /Outlines /Kids [";
                foreach ( $o['info']['outlines'] as $k => $v )
                {
                    $res .= $v . " 0 R ";
                }
                $res .= "] /Count " . count( $o['info']['outlines'] ) . " >>\nendobj";
            }
            else
            {
                $res = "\n" . $id . " 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj";
            }
            return $res;
            break;
        }
    }