int seq_flg = 0; float centX = 0; float centY = 0; float tempR = 0; float areaR = 0; float alpha = 14.04/180*PI; float theata = 52.02/180*PI; float phai = 0; float YE = 0; float Rx = 0; float pointX = 0; float pointY = 0; int XX = 0; int YY = 0; float WX = 0; float WY = 0; float X1 = 0; float Y1 = 0; float X2 = 0; float Y2 = 0; float Yb = 0; float Y0 = 0; float Xwidth = 0; float Ywidth = 0; PImage photo; color c; void setup() { photo = loadImage("sample_img.JPG");//input file name size(1800,600); //600 -> Set Image file Hight 2020.04.02 update PFont font; font = loadFont("sample_font.vlw"); textFont(font); textSize(12); fill(255,255,0); } void draw() { if (seq_flg == 0) { noFill(); stroke(255,0,0); image(photo,0,0); textSize(24); text("Copylight TECHNICAL Co.,Ltd.", photo.width-350, photo.height-10); line(mouseX,0,mouseX,photo.height); line(0,mouseY,photo.width,mouseY); centX = mouseX; centY = mouseY; } if (seq_flg == 1) { image(photo,0,0); textSize(24); text("Copylight TECHNICAL Co.,Ltd.", photo.width-350, photo.height-10); line(centX,0,centX,photo.height); line(0,centY,photo.width,centY); tempR=sqrt(sq(mouseX-centX)+sq(mouseY-centY))*2; arc(centX, centY, tempR, tempR, 0,2* PI); areaR = tempR / 2; } if (seq_flg == 2) { image(photo,0,0); WX = (areaR * tan(theata)-areaR * tan(alpha))/(tan(theata)+tan(alpha)); Y0 = WX * tan(theata) - areaR * tan(theata); YE = -areaR * tan(theata); Ywidth = Y0 -YE; Xwidth = 2 * PI * areaR; for (Rx = areaR ; Rx >= 0 ; Rx--) { X1 = -Rx; Y1 = -(areaR-Rx)*tan(theata); Yb = Y1 - Rx * tan(alpha); X2 = (Yb + areaR * tan(theata))/(tan(theata) + tan(alpha)); Y2 = X2 * tan(theata) - areaR * tan(theata); for (phai = -PI ; phai <= PI ; phai = phai + PI/2880) { pointX = 900 - areaR * phai; pointY = -Y2 + Y0 ; XX = int(centX + Rx * cos(phai)); YY = int(centY - Rx * sin(phai)); noStroke(); c = get(XX , YY); fill(c); rect(pointX,pointY,2,2); } } if (seq_flg < 3) { seq_flg++; } if (seq_flg == 3) { fill(#EB0FF0); text("Copylight TECHNICAL Co.,Ltd.", photo.width-350, photo.height-10); } } } void mousePressed() { seq_flg++; }