Within my code, I wanted to overlay the warning_img over the alert_box I have created, however using the mask function produces an error as the alert_box is not an image and needs to stay as a text box as it will be edited later to produce changing output.
void create_alert_box(){
alert = menu.addGroup("alert")
.setPosition(100,120)
.setSize(1400,120)
.setBackgroundColor(color(230,50,51))
.hideBar();
alert_label = menu.addTextlabel("alert_label")
.setText("ALERT!")
.setFont(createFont("Arial",40))
.setPosition(650, 40)
.setSize(200,100)
.moveTo(alert);
warning_img.resize(0,100);
alert.mask(warning_img);
}
This is where I define everything:
import controlP5.*; //imports GUI library
import processing.serial.*;
//Serial port;
ControlP5 menu; //creates Controlp5 object for the menu
ControlGroup altitude;
Textlabel altitude_label;
ControlGroup date_and_time;
Textlabel date_and_time_label;
ControlGroup CO2emissions;
ControlGroup plane;
Textlabel CO2emissions_label;
ControlGroup alert;
Textlabel alert_label;
PImage plane_img;
PImage warning_img;
PFont font;
void setup(){ // has to be the same as transmitter's setup module in order to respond to physical changes
size(1600,960);
//port = new Serial(this, "COM3", 9600); // com3 port is used for the computer's port
background(255,255,255);
menu = new ControlP5(this);
create_altitude_box();
PFont font = createFont("Arial", 100, true);
plane_img = loadImage("plane.jpg");
warning_img = loadImage("warning.png");
create_CO2emissions_box();
create_date_and_time_box();
create_alert_box();
}
Image is behind the box despite trying the mask method, and there are no methods online to mask images on top of textboxes in cp5.