*/}}
Browse Source

Stripe toggle

Yiming Wu 2 years ago
parent
commit
b93e89c839
6 changed files with 32 additions and 19 deletions
  1. 1 0
      la_interface.h
  2. 3 5
      la_kernel.c
  3. 7 5
      la_tns_kernel.c
  4. 7 0
      resources/la_properties.c
  5. 2 0
      resources/la_templates.c
  6. 12 9
      resources/la_widgets.c

+ 1 - 0
la_interface.h

@@ -505,6 +505,7 @@ STRUCTURE(laWindow){
     int Shown;
     int IsDocking;
     int OutputColorSpace;
+    int OutputShowStripes;
 
     laPropPack PP;
     laPropStep FakePS;

+ 3 - 5
la_kernel.c

@@ -414,11 +414,6 @@ int laGetReady(){
     MAIN.InputMapping=memAcquire(sizeof(laRackPageCollection));
     MAIN.Drivers=memAcquire(sizeof(laRackPageCollection));
 
-    //XDestroyWindow(MAIN.dpy, win);
-
-    //MAIN.ColorAccessCorrectGamma = 1;
-    MAIN.Gamma = //2.2; //...?
-
     //interactions:
     MAIN.TopFramerate = 60;
     MAIN.ValuatorThreshold = 8;
@@ -1152,6 +1147,7 @@ void la_PanelDrawToWindow(laPanel *p, laWindow *w){
     real L, W, U, H;
 
     tnsUseImmShader(); tnsEnableShaderv(T->immShader); tnsUniformOutputColorSpace(T->immShader,w->OutputColorSpace);
+    tnsUniformShowColorOverflowStripes(T->immShader,w->OutputShowStripes);
 
     switch (p->AnimationMode){
     case 0:
@@ -1239,6 +1235,7 @@ void la_PanelDrawToWindow(laPanel *p, laWindow *w){
     tnsFlush();
 
     tnsUniformOutputColorSpace(T->immShader,0);
+    tnsUniformShowColorOverflowStripes(T->immShader,0);
 }
 void la_PanelDrawToOffsceen(laPanel *p, laUiList *uil){
     laEnsurePanelInBound(p,p->MenuRefer?p->MenuRefer:&p->UI);
@@ -1778,6 +1775,7 @@ laWindow *laDesignWindow(int X, int Y, int W, int H){
 
     strSafeSet(&n->Title, "Empty Window");
     n->X = X; n->Y = Y; n->W = W; n->H = H;
+    n->OutputShowStripes=1;
 
     la_CreateSystemWindow(n, MAIN.Windows.pFirst!=0);
 

+ 7 - 5
la_tns_kernel.c

@@ -145,13 +145,15 @@ vec3 ConvertColorSpace(vec3 color){\n\
         if(OutputColorSpace==0){ color=to_log_srgb(XYZ2sRGB(xyz)); }\n\
         if(OutputColorSpace==1){ color=to_log_clay(XYZ2Clay(xyz)); }\n\
     }else{\n\
-        if(ColorMode==1){ return okhsl_to_srgb(color); }\n\
-        if(ColorMode==0){ return color; }\n\
-        if(OutputColorSpace==0){ color=to_log_srgb(color); }\n\
-        if(OutputColorSpace==1){ color=to_log_clay(color); }\n\
+        if(ColorMode==1){ color=okhsl_to_srgb(color); }\n\
+        else if(ColorMode==0){ color=color; }\n\
+        else{\n\
+            if(OutputColorSpace==0){ color=to_log_srgb(color); }\n\
+            if(OutputColorSpace==1){ color=to_log_clay(color); }\n\
+        }\n\
     }\n\
     if(ShowStripes!=0){\n\
-        if(color.r>1.00001||color.g>1.00001||color.b>1.00001||color.r<0||color.g<0||color.b<0){ color=mix(color,vec3(0.5,0.5,0.5),(sin((gl_FragCoord.x+gl_FragCoord.y)/2)>0)?1:0); }\n\
+        if(color.r>1.00001||color.g>1.00001||color.b>1.00001||color.r<0||color.g<0||color.b<0){ color=mix(color,vec3(0.5,0.5,0.5),(sin((gl_FragCoord.x+gl_FragCoord.y)/2)>0)?1:0.5); }\n\
     }\n\
     return color;\n\
 }\n\

+ 7 - 0
resources/la_properties.c

@@ -490,6 +490,9 @@ void* laget_CurrentRackPage(laRackPageCollection* c){
 void laset_WindowColorSpace(laWindow* w, int space){
     w->OutputColorSpace=space; laRedrawCurrentWindow();
 }
+void laset_WindowShowStripes(laWindow* w, int stripes){
+    w->OutputShowStripes=stripes; laRedrawCurrentWindow();
+}
 
 void *tnsget_TnsMain(void *unused,void *unused2){
     return T;
@@ -1091,6 +1094,10 @@ 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);{
+                laAddEnumItemAs(ep, "NONE", "None", "Don't show overflow", 0, 0);
+                laAddEnumItemAs(ep, "STRIPES", "Stripes", "Show overflow colors as stripes", 1, 0);
+            }
         }
 
         // UI LAYOUT ========================================================================================

+ 2 - 0
resources/la_templates.c

@@ -537,7 +537,9 @@ void laui_DefaultMenuBarActual(laUiList *uil, laPropPack *pp, laPropPack *actins
             }laEndCondition(uil, ui);
         }laEndCondition(uil,mui);
 
+        laShowSeparator(uil,c);
         laShowItem(uil,c,0,"la.windows.output_color_space");
+        laShowItemFull(uil,c,0,"la.windows.output_show_overflow",0,"text=🟩;",0,0);
 
         if(MAIN.MenuExtras){ laShowSeparator(uil,c); MAIN.MenuExtras(uil,0,0,0,0); }
 

+ 12 - 9
resources/la_widgets.c

@@ -765,15 +765,14 @@ void la_EnumSelectorDraw(laUiItem *ui, int h){
                 tnsPackAs(GL_LINE_LOOP);
             }
 
-            if(!Highlight){ 
-                if (ui->ExtraInstructions){
-                    if (ui->Type->OperatorType->ParseArgs){
-                        int ico; buf[0]=0; ui->Type->OperatorType->ParseArgs(ui->Instructions, &ico, buf);
-                    }
+
+            if (ui->ExtraInstructions){
+                if (ui->Type->OperatorType->ParseArgs){
+                    int ico; buf[0]=0; ui->Type->OperatorType->ParseArgs(ui->Instructions, &ico, buf);
                 }
-                if(!buf[0]) strcpy(buf, transLate(use_ei->Name)); 
             }
-            else{ if(ArrLen==1) strcpy(buf, transLate(ui->PP.LastPs->p->Name)); else{ if(i<8)strcat(buf, &prefix[i]); } }
+            if(Highlight){ if(!buf[0] && ArrLen==1) strcpy(buf, transLate(ui->PP.LastPs->p->Name)); else{ if(i<8)strcat(buf, &prefix[i]); } }
+            if(!buf[0]) strcpy(buf, transLate(use_ei->Name));
             int iconR; if(IconOnly)iconR=TNS_MAX2(_L+LA_RH,_R);else{ iconR=TNS_MIN2(_L+LA_RH,_R); }
             if (use_ei->IconID) tnsDrawIcon(use_ei->IconID, laThemeColor(bt, LA_BT_TEXT|ExtraState), _L,iconR, _U, LA_TEXT_ALIGN_CENTER);
             if(!IconOnly){
@@ -1076,9 +1075,13 @@ void la_ColorCircleDrawHCY(laUiItem *ui, int h){
 
     tnsFlush();
 
-    tnsUniformShowColorOverflowStripes(T->immShader,1);
+    int isClay=ui->Flags&LA_UI_FLAGS_COLOR_SPACE_CLAY;
+
+    if(MAIN.CurrentWindow->OutputColorSpace!=TNS_COLOR_SPACE_SRGB && (!isClay)){
+        tnsUniformShowColorOverflowStripes(T->immShader,1);
+    }
 
-    if(ui->Flags&LA_UI_FLAGS_COLOR_SPACE_CLAY){
+    if(isClay){
         tnsUniformInputColorSpace(T->immShader,TNS_COLOR_SPACE_CLAY);
     }else{
         tnsUniformInputColorSpace(T->immShader,TNS_COLOR_SPACE_SRGB);