*/}}
Yiming Wu před 1 rokem
rodič
revize
12ced07e94
3 změnil soubory, kde provedl 32 přidání a 2 odebrání
  1. 6 0
      la_tns.h
  2. 24 0
      la_tns_kernel.c
  3. 2 2
      resources/la_properties.c

+ 6 - 0
la_tns.h

@@ -1333,6 +1333,12 @@ void tnsMakeBridgedIndex(unsigned int *result, int num, int revert, int begin);
 void DrawWireRect2dp(real x, real y, real x2, real y2);
 void tnsViewportWithScissor(int x, int y, int w, int h);
 
+
+void tnssRGB2XYZ(tnsVector3d rgb,tnsVector3d xyz);
+void tnsClay2XYZ(tnsVector3d rgb,tnsVector3d xyz);
+void tnsXYZ2sRGB(tnsVector3d xyz,tnsVector3d rgb);
+void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb);
+
 void tns2LogsRGBSingle(real* a);
 void tns2LinearsRGBSingle(real* a);
 void tns2LogsRGB(real* srgb);

+ 24 - 0
la_tns_kernel.c

@@ -3839,6 +3839,30 @@ tnsMaterial *tnsFindMaterial(char *name){
 
 extern LA MAIN;
 
+void tnssRGB2XYZ(tnsVector3d rgb,tnsVector3d xyz){
+	tnsMatrix44d mat={{0.4124564,0.3575761,0.1804375,0},
+				      {0.2126729,0.7151522,0.0721750,0},
+				      {0.0193339,0.1191920,0.9503041,0},{0,0,0,0}};
+    tnsApplyRotation33d(xyz,mat,rgb);
+}
+void tnsClay2XYZ(tnsVector3d rgb,tnsVector3d xyz){
+	tnsMatrix44d mat={{0.5767309,0.1855540,0.1881852,0},
+				      {0.2973769,0.6273491,0.0752741,0},
+				      {0.0270343,0.0706872,0.9911085,0},{0,0,0,0}};
+    tnsApplyRotation33d(xyz,mat,rgb);
+}
+void tnsXYZ2sRGB(tnsVector3d xyz,tnsVector3d rgb){
+	tnsMatrix44d mat={{3.2404542,-1.5371385,-0.4985314,0},
+				      {-0.9692660,1.8760108,0.0415560,0},
+				      {0.0556434,-0.2040259,1.0572252,0},{0,0,0,0}};
+    tnsApplyRotation33d(rgb,mat,xyz);
+}
+void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb){
+	tnsMatrix44d mat={{2.0413690,-0.5649464,-0.3446944},
+                      {-0.9692660,1.8760108,0.0415560},
+                      {0.0134474,-0.1183897,1.0154096},{0,0,0,0}};
+    tnsApplyRotation33d(rgb,mat,xyz);
+}
 
 static real _srgb_transfer_function(real a){
 	return .0031308f >= a ? 12.92f * a : 1.055f * powf(a, .4166666666666667f) - .055f;

+ 2 - 2
resources/la_properties.c

@@ -1094,9 +1094,9 @@ void la_RegisterInternalProps(){
                 laAddEnumItemAs(ep, "SRGB", "sRGB", "Standard sRGB diplay", TNS_COLOR_SPACE_SRGB, 0);
                 laAddEnumItemAs(ep, "CLAY", "Clay", "Clay color space (AdobeRGB 1998 compatible)", TNS_COLOR_SPACE_CLAY, 0);
             }
-            ep = laAddEnumProperty(p, "output_show_overflow", "Show Overflow", "Show stripes on overflow colors", LA_WIDGET_ENUM_HIGHLIGHT, 0, 0, 0, 0, offsetof(laWindow, OutputShowStripes), 0, laset_WindowShowStripes, 0, 0, 0, 0, 0, 0, 0, 0);{
+            ep = laAddEnumProperty(p, "output_show_overflow", "Show Overflow", "Show stripes on overflowing colors", LA_WIDGET_ENUM_HIGHLIGHT, 0, 0, 0, 0, offsetof(laWindow, OutputShowStripes), 0, laset_WindowShowStripes, 0, 0, 0, 0, 0, 0, 0, 0);{
                 laAddEnumItemAs(ep, "NONE", "None", "Don't show overflow", 0, 0);
-                laAddEnumItemAs(ep, "STRIPES", "Stripes", "Show overflow colors as stripes", 1, 0);
+                laAddEnumItemAs(ep, "STRIPES", "Stripes", "Show overflowing colors as stripes", 1, 0);
             }
         }