def generate_rgbas_array(self, color, opacity): """ First arg can be either a color, or a tuple/list of colors. Likewise, opacity can either be a float, or a tuple of floats. If self.sheen_factor is not zero, and only one color was passed in, a second slightly light color will automatically be added for the gradient """ colors = list(tuplify(color)) opacities = list(tuplify(opacity)) rgbas = np.array([ color_to_rgba(c, o) for c, o in zip(*make_even(colors, opacities)) ]) sheen_factor = self.get_sheen_factor() if sheen_factor != 0 and len(rgbas) == 1: light_rgbas = np.array(rgbas) light_rgbas[:, :3] += sheen_factor clip_in_place(light_rgbas, 0, 1) rgbas = np.append(rgbas, light_rgbas, axis=0) return rgbas
def generate_rgbas_array(self, color, opacity): """ First arg can be either a color, or a tuple/list of colors. Likewise, opacity can either be a float, or a tuple of floats. If self.sheen_factor is not zero, and only one color was passed in, a second slightly light color will automatically be added for the gradient """ colors = list(tuplify(color)) opacities = list(tuplify(opacity)) rgbas = np.array([ color_to_rgba(c, o) for c, o in zip(*make_even(colors, opacities)) ]) sheen_factor = self.get_sheen_factor() if sheen_factor != 0 and len(rgbas) == 1: light_rgbas = np.array(rgbas) light_rgbas[:, :3] += sheen_factor clip_in_place(light_rgbas, 0, 1) rgbas = np.append(rgbas, light_rgbas, axis=0) return rgbas
def get_u_values_and_v_values(self): res = tuplify(self.resolution) if len(res) == 1: u_res = v_res = res[0] else: u_res, v_res = res u_min = self.u_min u_max = self.u_max v_min = self.v_min v_max = self.v_max u_values = np.linspace(u_min, u_max, u_res + 1) v_values = np.linspace(v_min, v_max, v_res + 1) return u_values, v_values
def get_u_values_and_v_values(self): res = tuplify(self.resolution) if len(res) == 1: u_res = v_res = res[0] else: u_res, v_res = res u_min = self.u_min u_max = self.u_max v_min = self.v_min v_max = self.v_max u_values = np.linspace(u_min, u_max, u_res + 1) v_values = np.linspace(v_min, v_max, v_res + 1) return u_values, v_values
def complete_p_list(self, p_list): new_p_list = list(tuplify(p_list)) remainder = 1.0 - sum(new_p_list) if abs(remainder) > EPSILON: new_p_list.append(remainder) return new_p_list
def complete_p_list(self, p_list): new_p_list = list(tuplify(p_list)) remainder = 1.0 - sum(new_p_list) if abs(remainder) > EPSILON: new_p_list.append(remainder) return new_p_list