Create a new canvas element

@return Resource
166135
protected function createCanvas($width, $height)
    {
        // Create the canvas element
        $canvas = imagecreatetruecolor( $width, $height );

        // Check if we should preserve the transparency
        if ( $this->imageType == IMAGETYPE_GIF || $this->imageType == IMAGETYPE_PNG ) {
            imagealphablending( $canvas, false );
            imagesavealpha( $canvas, true );
        }

        // Return the canvas
        return $canvas;
    }
1239009
public function create()
    {
        $File = new File($this->path());

        if (!$File->readable()) {
            $minifier = $this->type === 'css' ? new Minify\CSS() : new Minify\JS();
            array_map([$minifier, 'add'], $this->paths);

            //Writes the file
            $success = $File->write($minifier->minify());
            is_true_or_fail($success, __d('assets', 'Failed to create file {0}', rtr($this->path())));
        }

        return $this->filename();
    }
276806
function makeResource()
    {
        $resource = $this->resource;
        if ($this->id) $resource .= '/' . $this->id;
        return $resource;
    }
1223703
public function createAction()
    {
        $console = $this->getServiceLocator()->get('console');

        if (!$console instanceof ConsoleAdapterInterface) {
            throw new \RuntimeException('Invalid controller invocation');
        }

        $io = new ConsoleIO($console);
        $skeleton = new ProjectSkeleton($io);
        $skeleton->addComponent(new DirectoryLayoutComponent())
            ->addComponent(new BootstrapGeneratorComponent());

        $console->writeLine('Application Skeleton Generator' . PHP_EOL, ColorInterface::LIGHT_CYAN);
        $console->writeLine('Creating application skeleton:' . PHP_EOL, ColorInterface::GREEN);

        $skeleton->create($this->params()->fromRoute());

        $console->writeLine(PHP_EOL . 'Done!' . PHP_EOL, ColorInterface::LIGHT_GREEN);
    }
618913
public function create() {
        switch($this->info[2]) {
            case IMAGETYPE_JPEG:
                $this->resource = imagecreatefromjpeg($this->file);
                break;
            case IMAGETYPE_GIF:
                $this->resource = imagecreatefromgif($this->file);
                break;
            case IMAGETYPE_PNG:
                $this->resource = imagecreatefrompng($this->file);
                break;
            default:
                throw new Exception('Image type is not supported');
                break;
        }
    }
946153
public function createActivity():Renderer
    {
        $name = $this->clean($this->get("request")->get("name"));
        $status = $this->get("request")->get("status");
        $namespace = $this->get("request")->get("namespace");

        if ($name == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500,
                "msg" => "Service name is empty : $namespace")));
        }

        if ($status == "" || !in_array($status, array("enabled", "disabled"))) {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined status : $status")));
        }

        if ($namespace == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined namespace : $namespace")));
        }


        $fcore = json_decode(file_get_contents(FEnv::get("framework.config.core.services.file")));
        foreach ($fcore as $one) {
            if ($one == $name) {
                return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Service already exist")));
            }
        }

        $fcore->$name = new \stdClass();
        $fcore->$name->namespace = $namespace;
        $fcore->$name->status = $status;
        $fcore = json_encode($fcore, JSON_PRETTY_PRINT);
        file_put_contents(FEnv::get("framework.config.core.services.file"), $fcore);

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
281693
public function make($name="default", $width=100, $height=100, $bgcolor=0xFFFFFF)
    {
        $bstall = new Bstall;
        $this->width = $width;
        $this->height = $height;
        $this->bgcolor = $bgcolor;
        $this->load($name);
       
        return View::make('bstall::canvas', [
            'name'   => $name,
            'width'  => $this->width,
            'height' => $this->height,
            'canvas' => json_encode($this->canvas, true)
        ]);
    }
442666
public function createContext()
    {
        $resolvedOptions = $this->optionsResolver->resolve($this->options);

        // wrap content
        if ($resolvedOptions['content'] instanceof ContentInterface) {
            $resolvedOptions['content'] = $this->contentResolver->resolve(
                $resolvedOptions['content']
            );
        }

        // create variation
        $variation = $this->variationResolver->resolve((new VariationContext())
            ->denormalize($resolvedOptions)
        );

        return new RenderingContext(
            $resolvedOptions['component'],
            $resolvedOptions['content'],
            $variation,
            $this->contextNormalizer->normalize(
                $resolvedOptions['content'],
                $resolvedOptions['theme'],
                $resolvedOptions['template'],
                $resolvedOptions['zone'],
                $resolvedOptions['component']
            )
        );
    }
64738
function() {

      // create a canvas element
      var canvas = document.createElement('canvas');

      // define a context var that will be used for browsers with canvas support
      var ctx;

      // try/catch for older browsers that don't support the canvas element
      try {

        // attempt to give ctx a 2d canvas context value
        ctx = canvas.getContext('2d');

      } catch (e) {

        // return empty string if canvas element not supported
        return "";
      }

      // https://www.browserleaks.com/canvas#how-does-it-work
      // Text with lowercase/uppercase/punctuation symbols
      var txt = 'ClientJS,org <canvas> 1.0';
      ctx.textBaseline = "top";
      // The most common type
      ctx.font = "14px 'Arial'";
      ctx.textBaseline = "alphabetic";
      ctx.fillStyle = "#f60";
      ctx.fillRect(125, 1, 62, 20);
      // Some tricks for color mixing to increase the difference in rendering
      ctx.fillStyle = "#069";
      ctx.fillText(txt, 2, 15);
      ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
      ctx.fillText(txt, 4, 17);
      return canvas.toDataURL();
    }
116706
public function newAction() {
        $entity = new Gallery();
        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
294486
public function createPreviewTextElement() {
        $options['label']    = $this->translate->_('Preview Text');
        $options['nohidden'] = true;

        return $this->_form->createElement('Html', 'preview_text', $options);
    }
835993
public function canvas($width, $height = NULL, $rgb = 'transparent', $real = false) : GD
    {   
        if( $this->mime->type($width, 0) === 'image' )
        {
            $this->createImageCanvas($width);
        }
        else
        {
            $this->createEmptyCanvas($width, $height, $rgb, $real, $p1);
        }
        
        $this->defaultRevolvingVariables();

        return $this;
    }
342582
public function actionCreate()
    {
        if (!\Yii::$app->user->can('create'))
            return $this->alert(Module::t('core', 'Access denied.'));

        $model = new Rubric();
        $request = \Yii::$app->getRequest();
        $loaded = $model->load($request->post());
        
        // prependTo() call validate() and save()
        if ($loaded && $model->prependTo($this->findModel($model->parent_node))) {
            return $this->redirect(['index']);
        } else {
            return $this->renderAjax('create', [
                'model' => $model,
            ]);
        }
    }
63824
public function create()
	{
		$class = ($this->classClr) ? 'w50 clr' : 'w50';
		$class .= ($this->multiSelect) ? ' autoheight' : '';

		// Generate options
		$strGroup = 'default';
		foreach (StringUtil::deserialize($this->options) as $arrOption)
		{
			if ($arrOption['group'])
			{
				$strGroup = $arrOption['label'];
				continue;
			}	
			
			if ($arrOption['default'])
			{
				$default = 'v'.$arrOption['value']; // Add a alphabetic character to allow numeric values
			}	
			
			$arrOptions[$strGroup]['v'.$arrOption['value']] = $arrOption['label'];
		}
		
		// No groups 
		if (count($arrOptions) < 2)
		{
			$arrOptions = array_values($arrOptions)[0];
		}

		// Generate a select field
		$this->generateDCA(($this->multiSelect) ? 'multiSelectField' : 'singleSelectField', array
		(
			'inputType' 	=>	'select',
			'label'			=>	array($this->label, $this->description),
			'default'		=>	$default,
			'options'		=>	$arrOptions,
			'eval'			=>	array
			(
				'mandatory'				=> ($this->mandatory) ? true : false, 
				'includeBlankOption'	=> ($this->blankOption) ? true : false,
				'multiple'				=> ($this->multiSelect) ? true : false,
				'chosen'				=> true,
				'tl_class'				=> $class,
			),
		));
	}
1099310
function createAction() {
    if( !isset( $this->action['value'] ))
      return;
    $attributes = $this->_createParams( $this->action['params'] );
    return $this->_createElement( 'ACTION', $attributes, $this->action['value'] );
  }
1284667
public function actionCreate()
    {
        $this->layout = static::FORM_LAYOUT;
        $model = new $this->MainModel;

        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            if(empty($model->Menu_id)) {
                Yii::info('Making the new node as root');
                $model->makeRoot();
            } else {
                $parent_node = Menu::findOne($model->Menu_id);
                $model->appendTo($parent_node);

                Yii::info('Making the new node as a child of ' . $parent_node->id);
            }
            $this->saveHistory($model, $this->historyField);
            return $this->redirect(['index']);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
436991
public function create()
    {
        $params = array(
            'slug' => $this->ensureParameter('slug'),
            'name' => $this->ensureParameter('name'),
            'i18n_type' => $this->ensureParameter('i18nType'),
            'content' => $this->ensureParameter('content'),
        );

        $this->post(
            sprintf('project/%s/resources/', $this->ensureParameter('project')),
            $params
        );

        return $this;
    }