public void NotifyHSVUpdated() { tempColour = HSV.ToRGBA(H, S, V); tempColour.a = A; CreatePreviewBG(ref _tempPreviewBG, tempColour); _hexOut = _hexIn = RGBtoHex(tempColour); }
private void CreateHuePickerBG() { Texture2D tex = new Texture2D(1, _pickerSize); var h = _pickerSize; var hu = 1f / h; // HSV colours, S = V = 1 for (int y = 0; y < h; y++) { tex.SetPixel(0, y, HSV.ToRGBA(hu * y, 1f, 1f)); } tex.Apply(); SwapTexture(ref _huePickerBG, tex); }
private void CreateColourPickerBG() { float S, V; int w = _pickerSize; int h = _pickerSize; float wu = UnitsPerPixel; float hu = UnitsPerPixel; Texture2D tex = new Texture2D(w, h); // HSV colours, H in slider, S horizontal, V vertical. for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { S = x * wu; V = y * hu; tex.SetPixel(x, y, HSV.ToRGBA(H, S, V, A)); } } tex.Apply(); SwapTexture(ref _colourPickerBG, tex); }