def setColor(self, color): """ Set the color of the map :param QColor color: color of the map """ self.__data.color = color self.__data.rgb = color.rgb() & qRgba(255, 255, 255, 0) self.__data.rgbMax = self.__data.rgb | (255 << 24)
def rgb(self, mode, pos): if pos <= 0.0: return self.__stops[0].rgb if pos >= 1.0: return self.__stops[-1].rgb index = self.findUpper(pos) if mode == QwtLinearColorMap.FixedColors: return self.__stops[index - 1].rgb else: s1 = self.__stops[index - 1] ratio = (pos - s1.pos) / s1.posStep r = int(s1.r0 + ratio * s1.rStep) g = int(s1.g0 + ratio * s1.gStep) b = int(s1.b0 + ratio * s1.bStep) if self.__doAlpha: if s1.aStep: a = int(s1.a0 + ratio * s1.aStep) return qRgba(r, g, b, a) else: return qRgba(r, g, b, s1.a) else: return qRgb(r, g, b)