PIPRIME.FR BLOG

Live fully to honor life

Tag Opacity -- Asymptote Gallery

đź”—generalities-fig062

Figure generalities 062 Generated with Asymptote

Show generalities/fig0620.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Opacity | #Fill/Unfill | #Circle | #Transform/scale/shift/rotate

size(10cm, 0);

path cle=unitcircle;

draw((-1.5, 0)--(2.5, 0), linewidth(10mm));
filldraw(cle, red+opacity(.5));
filldraw(shift((1, 0))*cle, blue+opacity(.5));

shipout(format="pdf");

đź”—opacity-fig001

Figure opacity 001 Generated with Asymptote

Show opacity/fig0010.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

string blend="Compatible"; //This is the default value

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig002

Figure opacity 002 Generated with Asymptote

Show opacity/fig0020.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Normal: Selects the source color, ignoring the backdrop.
string blend="Normal";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig003

Figure opacity 003 Generated with Asymptote

Show opacity/fig0030.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Multiply: Multiplies the backdrop and source color values:
// The result color is always at least as dark as either of the two constituent
// colors. Multiplying any color with black produces black;
// multiplying with white leaves the original color unchanged. Painting
// successive overlapping objects with a color other than black or
// white produces progressively darker colors.
string blend="Multiply";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig004

Figure opacity 004 Generated with Asymptote

Show opacity/fig0040.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

// The result does not support image conversion.
// You can view it in the file /home/pi/code/pi/asymptote/asymptote-exemples-builder/build/asy/opacity/fig0040.pdf.

import edvenn_pi;

// Screen: Multiplies the complements of the backdrop and source color
// values, then complements the result:
// The result color is always at least as light as either of the two constituent
// colors. Screening any color with white produces white; screening
// with black leaves the original color unchanged. The effect is
// similar to projecting multiple photographic slides simultaneously
// onto a single screen.
string blend="Screen";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig005

Figure opacity 005 Generated with Asymptote

Show opacity/fig0050.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Overlay: Multiplies or screens the colors, depending on the backdrop color.
// Source colors overlay the backdrop while preserving its highlights
// and shadows. The backdrop color is not replaced but is mixed with
// the source color to reflect the lightness or darkness of the backdrop.
string blend="Overlay";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig006

Figure opacity 006 Generated with Asymptote

Show opacity/fig0060.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Darken: Selects the darker of the backdrop and source colors:
// The backdrop is replaced with the source where the source is darker;
// otherwise, it is left unchanged.
string blend="Darken";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig007

Figure opacity 007 Generated with Asymptote

Show opacity/fig0070.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Lighten: Selects the lighter of the backdrop and source colors:
// The backdrop is replaced with the source where the source is lighter;
// otherwise, it is left unchanged.
string blend="Lighten";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig008

Figure opacity 008 Generated with Asymptote

Show opacity/fig0080.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// ColorDodge: Brightens the backdrop color to reflect the source color. Painting
// with black produces no change.
string blend="ColorDodge";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig009

Figure opacity 009 Generated with Asymptote

Show opacity/fig0090.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// ColorBurn Darkens the backdrop color to reflect the source color. Painting
// with white produces no change.
string blend="ColorBurn";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig010

Figure opacity 010 Generated with Asymptote

Show opacity/fig0100.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// HardLight: Multiplies or screens the colors, depending on the source color
// value. If the source color is lighter than 0.5, the backdrop is lightened
// as if it were screened; this is useful for adding highlights to a
// scene. If the source color is darker than 0.5, the backdrop is darkened
// as if it were multiplied; this is useful for adding shadows to a
// scene. The degree of lightening or darkening is proportional to the
// difference between the source color and 0.5; if it is equal to 0.5, the
// backdrop is unchanged. Painting with pure black or white produces
// pure black or white. The effect is similar to shining a harsh spotlight
// on the backdrop.
string blend="HardLight";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig011

Figure opacity 011 Generated with Asymptote

Show opacity/fig0110.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// SoftLight: Darkens or lightens the colors, depending on the source color value.
// If the source color is lighter than 0.5, the backdrop is lightened as if
// it were dodged; this is useful for adding highlights to a scene. If the
// source color is darker than 0.5, the backdrop is darkened as if it
// were burned in. The degree of lightening or darkening is proportional
// to the difference between the source color and 0.5; if it is
// equal to 0.5, the backdrop is unchanged. Painting with pure black or
// white produces a distinctly darker or lighter area but does not result
// in pure black or white. The effect is similar to shining a diffused
// spotlight on the backdrop.
string blend="SoftLight";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig012

Figure opacity 012 Generated with Asymptote

Show opacity/fig0120.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Difference: Subtracts the darker of the two constituent colors from the lighter
// color:
// Painting with white inverts the backdrop color; painting with black
// produces no change.
string blend="Difference";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig013

Figure opacity 013 Generated with Asymptote

Show opacity/fig0130.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Exclusion: Produces an effect similar to that of the Difference mode but lower
// in contrast. Painting with white inverts the backdrop color; painting
// with black produces no change.
string blend="Exclusion";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig014

Figure opacity 014 Generated with Asymptote

Show opacity/fig0140.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Hue: Creates a color with the hue of the source color and the saturation
// and luminance of the backdrop color.
string blend="Hue";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig015

Figure opacity 015 Generated with Asymptote

Show opacity/fig0150.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Saturation: Creates a color with the saturation of the source color and the hue
// and luminance of the backdrop color. Painting with this mode in an
// area of the backdrop that is a pure gray (no saturation) produces no
// change.
string blend="Saturation";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig016

Figure opacity 016 Generated with Asymptote

Show opacity/fig0160.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Color: Creates a color with the hue and saturation of the source color and
// the luminance of the backdrop color. This preserves the gray levels
// of the backdrop and is useful for coloring monochrome images or
// tinting color images.
string blend="Color";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig017

Figure opacity 017 Generated with Asymptote

Show opacity/fig0170.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity

import edvenn_pi;

// Luminosity: Creates a color with the luminance of the source color and the hue
// and saturation of the backdrop color. This produces an inverse
// effect to that of the Color mode.
string blend="Luminosity";

size(10cm,0);

path [] edvenn= EdVenn(4);
pen [] fillp= new pen[]{black, red, green, blue};
pen p=linewidth(1mm);

for (int i=0; i<4; ++i) {
  fillp[i]=fillp[i]+opacity(.5,blend=blend);
  filldraw(edvenn[i], fillpen=fillp[i], drawpen=linewidth((i+1)*mm/2));
 }

shipout(bbox(2mm,invisible),"pdf");

đź”—opacity-fig018

Figure opacity 018 Generated with Asymptote

Show opacity/fig0180.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity | #Layer | #Label | #Fill/Unfill | #Shipout | #Bbox | #Shading

size(4cm,0);
dotfactor*=5;

dot(scale(2)*"A",(0.5,1),5N);

layer();

dot(scale(2)*"B",(1.5,1),5N);
filldraw(scale(2)*unitsquare, lightgray+opacity(.5));

shipout(bbox(5mm,black,RadialShade(lightblue,darkblue)), "pdf");

đź”—opacity-fig019

Figure opacity 019 Generated with Asymptote

Show opacity/fig0190.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity | #Fill/Unfill | #Shading

size(10cm,0);
transform T=rotate(10)*xscale(1.1);
path c1=T*unitcircle, c2=T*scale(5)*unitcircle;
real l1=length(c1), l2=length(c2);

fill(scale(8)*shift(-0.5,-0.5)*unitsquare,blue);
int n=500;
real step=1/n;
for (int i=0; i < n; ++i) {
  real t=i*step;
  path g1=subpath(c1,t*l1,(t+step)*l1);
  path g2=subpath(c2,t*l2,(t+step)*l2);
  pair A=(relpoint(c1,t)+relpoint(c2,t))/2;
  pair B=(relpoint(c1,t+step)+relpoint(c2,t+step))/2;
  path sector=g1--reverse(g2)--cycle;
  pen trans=opacity(((2-(2*i/n)^1.5))/2);
  axialshade(sector,trans+i/n*white,A,trans+(i+1)/n*white,B);
}
shipout(bbox(lightblue+white,Fill),format="pdf");

0%