Jump to content

Reptillian

Members
  • Posts

    1,237
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Reptillian

  1. @lynxster4 Okay, I looked, but I can't find why. Maybe it's the version of Paint.NET you're using? I'm running Paint.NET 4.3.2. @otuncelli Could you confirm @lynxster4report? Anyone else too? Preferably with Paint.NET 4.3.2. Also, calling @null54 as he's the author of the library for a G'MIC-PDN project. EDIT: Hmm, I might have to add deps.json. See if dropping the attached file to the Paint.NET effect folder would make it work though I doubt it. Other than that, I'm out of ideas. TiledFormGmicPdn.deps.zip
  2. New Update! - Slightly more optimized. - Use NET 5.0
  3. @AndrewDavid It worked though I have no idea why you need to comment for me to be able to edit.
  4. I have already done that 3 times at separate hours. One this morning or just now. I still cannot. I do want to update that plugin as it now receive .NET 5 support and more functional interface though not fully resolved (see plugin development).
  5. So, I tried everything. Changing browser. Closing and opening, then editing thread. But, edit thread does absolutely nothing even if I edit nothing.
  6. I get that part, but I don't know how to write it: propRules.Add(new ReadOnlyBoundToNameValuesRule(PropertyNames.Points,false, ((PropertyNames.Use_clipboard_as_tile)||(PropertyNames.Pretile_mode, Pretile_modeOptions.Pretile_modeOption22)) )); This test code doesn't seem to work.
  7. This isn't a issue. Two ways to remedy this problem: Copy and paste to different places Symbolic Linking I would use symbolic link.
  8. I do have a earlier code that works, however, it involves separate propRules. It works, however at the start, some controls are enabled until I change options and that is when behavior is correct. Changing the defaults is the easiest solution. I wanted the control if (the checkbox is not checked) AND (any one of the three list selections is made). As I'm new to indirectui as I barely use it except in rare cases, I would like a example of what you mean.
  9. Let's say I have a plugin option. The plugin option should only activates if a boolean option is checked off, and any of three dropdown option. Here's what I have: propRules.Add(new ReadOnlyBoundToNameValuesRule(PropertyNames.Points,true, (PropertyNames.Use_clipboard_as_tile, false), (PropertyNames.Pretile_mode, Pretile_modeOptions.Pretile_modeOption18), (PropertyNames.Pretile_mode, Pretile_modeOptions.Pretile_modeOption21), (PropertyNames.Pretile_mode, Pretile_modeOptions.Pretile_modeOption22) )); I want PropertyNames.Point to be only activated if clipboard option is set to false, and when the dropdown option is set to any of these option. Otherwise, it is grayed out. I don't know how to explain this better, but hopefully, this gets the idea. Also, from the other thread, this always is true: propRules.Add(new ReadOnlyBoundToNameValuesRule(PropertyNames.Thickness, true, new TupleStruct<object, object>[] { new TupleStruct<object, object>(PropertyNames.Use_clipboard_as_tile, false), new TupleStruct<object, object>(PropertyNames.Pretile_mode,Pretile_modeOptions.Pretile_modeOption22) }));
  10. I think I have a better idea. Do what @otuncelli did, but with resize applied and lower tolerance. Then, use the alpha channel to cover up all the way to the line and process it from there. I don't know how to use ImageMagick, and I tried to do this in G'MIC. I will refer you to @otuncelli and discuss.pixls.us (if you go the g'mic route) forum for help on this
  11. If it doesn't appear, then that means the current version of G'MIC is no longer supported. G'MIC 3 is on the horizon, but these are supported by Krita and GIMP. You'll have to wait.
  12. Requesting a quick clarification as I'm not sure what's the requirement is in my case. I have GMICSharpNative folder inside the effects folder or document/app files folder. So, every dlls that utilize GMICSharp library must be inside the folder? That's what you mean? As for the deps thing, going into .NET 5 with this setup is beyond me, so I can't do anything about that unfortunately though I will have assistance from @null54as he worked on this.
  13. Looks like I will have to make some changes to my g'mic-pdn project though I find it to be difficult to make changes to suit the new rule.
  14. I have a much better idea. We should try assembly language to make shape.
  15. Randomly divides the canvas into smaller rectangles, where the initial rectangle is the canvas itself. Preview: On the parameters that needs note: Number of colors - defines the number of color on canvas. If it is 0, then with infinite memory, then infinity number of colors is possible. Otherwise, the number of colors is equal to 2 or higher, and if it is less than 2, then 2 colors. Loop Limit - Define the maximum loop possible. Sometimes, the generation of rectangle will complete before the loop, so that's why sometimes you don't see changes. Border(%) - This define the thickness of border. Sometimes border won't show up because of issues regarding to discrete space of raster graphic. I don't know how to explain this. Installation: Plugin Files -> Random Rectangle Division.zip 1. Insert the .dll into effect folder of paint.net installation 2. Find it under Texture. Bugs: 1. Border Color will be active if there is no border. I cannot fix this bug as it requires me to figure out how to make it visible using mathematical operation within variables. Source code: CodeLab G'MIC
  16. I would appreciate that if you could. Also to anyone else that volunteer to this.
  17. I think I'm just gonna leave it with this uncomplete code. Turns out it's not achievable: Here's what I get (hence why I don't think it can be achieved): The expected output: With more work, it can look like this: https://cdn.discordapp.com/attachments/880256029705773099/893671307558916157/unknown.png // Name: // Submenu: // Author: // Title: // Version: // Desc: // Keywords: // URL: // Help: #region UICode IntSliderControl max_divide = 10; // [1,20] Division IntSliderControl init_add_thick = 1; // [0,100] Additional Thickness IntSliderControl max_iter = 5; // [2,40] Maximum Division Iteration IntSliderControl probability = 95; // [0,100] Probability of Division(%) IntSliderControl max_loop = 2000; // [2000,2097152] Loop Limit DoubleSliderControl border = 10; // [0,100] Border(%) ReseedButtonControl seed = 0; // Reseed #endregion #if DEBUG #endif ColorBgra[,] Rectangles_Surface; ColorBgra Empty_Color=ColorBgra.Black; Random Seed = new Random(); int new_seed; List<(int,int,int,int,int)> Modifiable_Rect = new List<(int,int,int,int,int)>{ (0,0,0,0,0) }; List<(int,int,int,int,int)> Unmodifiable_Rect = new List<(int,int,int,int,int)>{ (0,0,0,0,0) }; bool diff_check(int a) { int mri = max_divide; double ds = (double)(a/mri); if (mri>1&&(ds<1)){ while(mri>1&&(ds<1)){ mri--; ds = (double)(a/mri); } } return ds>1; } bool pass=false; Random myRandom; void split_column(int point,int test_boundary,int border_size){ bool skip = false; int mx=0; int np; int ri = myRandom.Next(1,max_divide)+1; int mri = ri - 1; int min_x=Modifiable_Rect[point].Item1; int max_x=Modifiable_Rect[point].Item2; int min_y=Modifiable_Rect[point].Item3; int max_y=Modifiable_Rect[point].Item4; int itern=Modifiable_Rect[point].Item5+1; Modifiable_Rect.RemoveAt(point); int sx = min_x+test_boundary; int ex = max_x-test_boundary; bool bound_check = (ex-sx)>test_boundary; bool rb; int min_v,max_v; if (bound_check) { int diff=ex-sx; double ds=(double)(diff/mri); if(mri>1&&(ds<=test_boundary)) { while(mri>1&&(ds<=test_boundary)) { ri--; mri--; ds=(double)(diff/mri); } } if(((test_boundary>0)||(diff>0))?(ds>(double)(test_boundary)):true) { int p=min_x; for(int ri_ind=0; ri_ind<ri ; ri_ind++) { rb=myRandom.Next(0,99)>(probability-1); if (ri_ind==mri) { if (p>max_x) { p=max_x; if((max_y-min_y)==0){rb=true;} } if (rb || (itern==max_iter)) { Unmodifiable_Rect.Add((p,max_x,min_y,max_y,itern)); } else { Modifiable_Rect.Add((p,max_x,min_y,max_y,itern)); } } else { if(ri_ind==0) { mx=(int)(Math.Round((double)(sx+ds))); min_v=Math.Min(p,mx); max_v=Math.Max(p,mx); np=Math.Min(Math.Max(sx,myRandom.Next(min_v,max_v)),ex); if (rb || (itern==max_iter)) { Unmodifiable_Rect.Add((p,np,min_y,max_y,itern)); } else { Modifiable_Rect.Add((p,np,min_y,max_y,itern)); } p=np+1; if(p>=ex){skip=true;} } else { if(skip){continue;} mx=(int)(Math.Round((double)(mx+ds))); min_v=Math.Min(p,mx+1); max_v=Math.Max(p,mx+1); np=Math.Min(Math.Max(p+border_size,myRandom.Next(min_v,max_v)),ex); if (rb || (itern==max_iter)) { Unmodifiable_Rect.Add((Math.Min(p,ex),np,min_y,max_y,itern)); } else { Modifiable_Rect.Add((Math.Min(p,ex),np,min_y,max_y,itern)); } p=np+1; } } } } else { Unmodifiable_Rect.Add((min_x,max_x,min_y,max_y,itern)); } } else { Unmodifiable_Rect.Add((min_x,max_x,min_y,max_y,itern)); } } void split_row(int point,int test_boundary,int border_size){ bool skip = false; int my=0; int np; int ri = myRandom.Next(1,max_divide)+1; int mri = ri - 1; int min_x=Modifiable_Rect[point].Item1; int max_x=Modifiable_Rect[point].Item2; int min_y=Modifiable_Rect[point].Item3; int max_y=Modifiable_Rect[point].Item4; int itern=Modifiable_Rect[point].Item5+1; Modifiable_Rect.RemoveAt(point); int sy = min_y+test_boundary; int ey = max_y-test_boundary; bool bound_check = (ey-sy)>test_boundary; bool rb; int min_v,max_v; if (bound_check) { int diff=ey-sy; double ds=(double)(diff/mri); if(mri>1&&(ds<=test_boundary)) { while(mri>1&&(ds<=test_boundary)) { ri--; mri--; ds=(double)(diff/mri); } } if(((test_boundary>0)||(diff>0))?(ds>(double)(test_boundary)):true) { int p=min_x; for(int ri_ind=0; ri_ind<ri ; ri_ind++) { rb=myRandom.Next(0,99)>(probability-1); if (ri_ind==mri) { if (p>max_y) { p=max_y; if((max_x-min_x)==0){rb=true;} } if (rb || (itern==max_iter)) { Unmodifiable_Rect.Add((min_x,max_x,p,max_y,itern)); } else { Modifiable_Rect.Add((min_x,max_x,p,max_y,itern)); } } else { if(ri_ind==0) { my=(int)(Math.Round((double)(sy+ds))); min_v=Math.Min(p,my); max_v=Math.Max(p,my); np=Math.Min(Math.Max(sy,myRandom.Next(min_v,max_v)),ey); if (rb || (itern==max_iter)) { Unmodifiable_Rect.Add((min_x,max_x,p,np,itern)); } else { Modifiable_Rect.Add((min_x,max_x,p,np,itern)); } p=np+1; if(p>=ey){skip=true;} } else { if(skip){continue;} my=(int)(Math.Round((double)(my+ds))); min_v=Math.Min(p,my+1); max_v=Math.Max(p,my+1); np=Math.Min(Math.Max(p+border_size,myRandom.Next(min_v,max_v)),ey); if (rb || (itern==max_iter)) { Unmodifiable_Rect.Add((min_x,max_x,Math.Min(p,ey),np,itern)); } else { Modifiable_Rect.Add((min_x,max_x,Math.Min(p,ey),np,itern)); } p=np+1; } } } } else { Unmodifiable_Rect.Add((min_x,max_x,min_y,max_y,itern)); } } else { Unmodifiable_Rect.Add((min_x,max_x,min_y,max_y,itern)); } } void PreRender(Surface dst, Surface src) { if (Rectangles_Surface==null) { Modifiable_Rect.RemoveRange(0,1); Unmodifiable_Rect.RemoveRange(0,1); Rectangles_Surface=new ColorBgra [src.Width,src.Height]; } else { Modifiable_Rect.RemoveRange(0,Modifiable_Rect.Count); Unmodifiable_Rect.RemoveRange(0,Unmodifiable_Rect.Count); Array.Clear(Rectangles_Surface,0,src.Width*src.Height); } if (new_seed != seed) { Modifiable_Rect.RemoveRange(0,Modifiable_Rect.Count); Unmodifiable_Rect.RemoveRange(0,Unmodifiable_Rect.Count); myRandom = Seed; } else { myRandom = new Random(int.MaxValue); } new_seed = seed; int width = src.Width - 1; int height = src.Height - 1; int border_size; int test_boundary; if (init_add_thick>0) { border_size=init_add_thick+1; test_boundary=border_size+1; } else{ border_size=0; test_boundary=0; } bool width_check=diff_check(width-border_size*2); bool height_check=diff_check(height-border_size*2); if (width_check||height_check){ pass = true; Modifiable_Rect.Add((0,width,0,height,0)); //split_row(0,test_boundary,border_size); if (width_check&&height_check) { if (myRandom.Next(0,2)==0) { split_column(0,test_boundary,border_size); } else { split_row(0,test_boundary,border_size); } } else { if (height_check) { split_column(0,test_boundary,border_size); } else { split_row(0,test_boundary,border_size); } } int arr_point=0; int p_ind; while(Modifiable_Rect.Count>0){ p_ind=myRandom.Next(Modifiable_Rect.Count); if(myRandom.Next(0,2)==0) { split_column(p_ind,test_boundary,border_size); } else { split_row(p_ind,test_boundary,border_size); } arr_point++; if(arr_point>=max_loop){break;} } int new_min_x; int new_max_x; int new_min_y; int new_max_y; int nv=0; int ex,ey; ColorBgra Temp_Color; int tr,tg,tb; if (Modifiable_Rect.Count>0) { for (int i = 0 ; i < Modifiable_Rect.Count ; i++){ new_min_x=Modifiable_Rect[i].Item1; new_max_x=Modifiable_Rect[i].Item2; new_min_y=Modifiable_Rect[i].Item3; new_max_y=Modifiable_Rect[i].Item4; ex = new_max_x+1; ey = new_max_y+1; tr=myRandom.Next(256); tg=myRandom.Next(256); tb=myRandom.Next(256); for (int x = new_min_x ; x<ex ; x++) { for (int y = new_min_y ; y<ey ; y++) { Rectangles_Surface[x,y]=ColorBgra.FromBgr((byte)(tb),(byte)(tg),(byte)(tr)); } } nv++; } } if (Unmodifiable_Rect.Count>0) { for (int j = 0 ; j < Unmodifiable_Rect.Count ; j++) { new_min_x=Unmodifiable_Rect[j].Item1; new_max_x=Unmodifiable_Rect[j].Item2; new_min_y=Unmodifiable_Rect[j].Item3; new_max_y=Unmodifiable_Rect[j].Item4; ex=new_max_x+1; ey=new_max_y+1; tr=myRandom.Next(256); tg=myRandom.Next(256); tb=myRandom.Next(256); for (int x = new_min_x ; x<ex ; x++) { for (int y = new_min_y ; y<ey ; y++) { Rectangles_Surface[x,y]=ColorBgra.FromBgr((byte)(tb),(byte)(tg),(byte)(tr)); } } nv++; } } } } void Render(Surface dst, Surface src, Rectangle rect) { // Delete any of these lines you don't need if (pass) { for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { dst[x,y] = Rectangles_Surface[x,y]; } } } } Based off this working G'MIC code: #@cli rep_rrd: eq. to 'rep_random_rectangular_division' : (+) rep_rrd: rep_random_rectangular_division $* #@cli rep_random_rectangular_division: split>1,_additional_thickness>=0,_max_iter>=2,_probability[%]>0,_loop_limit>1,_seed #@cli : Generate random division of rectangle as in random number of division and varying thickness within rectangle. #@cli : _additional_thickness refers to the excess pixel thickness. #@cli : _max_iter limits the number of iterations per rectangle. #@cli : _probability determines the probability that a rectangle will be permitted to be utilized for further iteration. #@cli : _loop_limit limits the number of time the process of subdivision is done. #@cli : _seed generates the output based on defined parameter. #@cli : Default values: '_gen_thick=0','_max_iter=5','_probability[%]=95%','_loop_limit=5000','_seed=n/a' rep_random_rectangular_division: skip ${2=0},${3=5},${4=95%},${5=5000},${6=} check "$4>0" repeat $! l[$>] _rep_random_rectangular_division $* endl done _rep_random_rectangular_division: skip ${2=0},${3=5},${4=95%},${5=5000},${6=} r 100%,100%,1,1 #You can ignore this. 1,1,1,5 #Modifiable Rectangle Array 1,1,1,5 #Unmodifiable Rectangle Array eval ${-math_lib}" if(narg($6),srand($6);); const ww=w#-3-1; #Width of Image const hh=h#-3-1; #Height of Image const max_split=max(1,int(abs($1))); #Number of Split per Rectangle const internal_space=int(abs($2)); #Additional paces between Split const test_boundary=internal_space?(internal_space+1); #Test if rectangle is acceptable to split const max_iter=max(2,round(abs($3))); #Maximum Iteration const odd=cut($4,0,1); #Probability of splitting rectangle const arr_limit=round(abs($5)); #The limit of looping to split rectangle diff_check(a)=( #diff_check(a) is a function mri=max_split; ds=a/mri; if(mri>1&&ds<1, while(mri>1&&ds<1, mri--; ds=a/mri; ); ); ds>1; ); width_check=diff_check(ww-internal_space*2); # Determine if the width of image is reasonable with parameters assigne height_check=diff_check(hh-internal_space*2); # Determine if the height of image is reasonable with parameters assigne !(width_check||height_check)?run('error inv_dim'); #If neither are reasonable, then throws a error dar_insert(#-2,[0,ww,0,hh,0]); #Insert the dimensions of image and the first iteration number which is 0 into the modifiable array sub_column(v,point)=( #Function to Split Rectangle ri=int(u(1,max_split))+1; #Number of Division mri=ri-1; #Maximum Division Iteration sx=v[0]+test_boundary; #Start Point for Next Split ex=v[1]-test_boundary; #End Gap between the End Index and the start of the final Split diff=ex-sx; #Difference between the Two bound_check=diff>test_boundary; #Check the boundary between two, if fails, send it to the un-modifiable rectangle array skip=0; #Boolean Value of skip dar_remove(#-2,point); #Remove Rectangle Information at point if(bound_check, #If Bound Check ds=diff/mri; #The length of diff divided by the maximum-iteration number. if(mri>1&&ds<=test_boundary, #Check if the distance is smaller than test_boundary. If fail, then send to unmodifiable rectangle array while(mri>1&&ds<=test_boundary, #Used to find the minimum mri to reach size greater than test_bounary ri--; mri--; ds=diff/mri; ); ); if(test_boundary||diff?(ds>test_boundary):1, #If condition meets, then it will modify the rectangle. Otherwise, send it to unmodifiable py=[v[2],v[3]]; #Two Variable inserted as one. Used for simplifying Code iter=v[4]+1; #The current iteration number of rectangle plus 1. Used for stopping splitting at iteration-n p=v[0]; #Start at min-x of rectangle repeat(ri,ri_ind, #Repeat ri time, and ri_ind is the number of used as iterator rb=odd<1?u(0,1)>odd:0; #The probability of a rectangle will be modifiable or not ri_ind==mri?( #Meets the last iteration of ri loop if(p>v[1], p=v[1]; if(!(v[3]-v[2]),rb=1;); #If the pixel dimension is equal to 1, it no longer becomes modifiable ); (rb||(iter==max_iter))?( dar_insert(#-1,[p,v[1],py,iter]); #Send to unmodifiable ):( dar_insert(#-2,[p,v[1],py,iter]); #Send to modifiable ); ): !ri_ind?( mx=sx+ds; np=min(max(sx,round(u(p,mx))),ex); vp=[p,np]; (rb||(iter==max_iter))?( dar_insert(#-1,[vp,py,iter]); ):( dar_insert(#-2,[vp,py,iter]); ); p=np+1; if(p>=ex,skip=1;); ):( if(skip,continue();); mx+=ds; np=min(max(p+internal_space,round(u(p,mx))),ex); vp=[min(p,ex),np]; (rb||(iter==max_iter))?( dar_insert(#-1,[vp,py,iter]); ):( dar_insert(#-2,[vp,py,iter]); ); p=np+1; ); ); ,dar_insert(#-1,v); ); ,dar_insert(#-1,v); ); ); sub_row(v,point)=( ri=int(u(1,max_split))+1; mri=ri-1; sy=v[2]+test_boundary; ey=v[3]-test_boundary; diff=ey-sy; bound_check=diff>test_boundary; skip=0; dar_remove(#-2,point); if(bound_check, ds=diff/mri; if(mri>1&&ds<=test_boundary, while(mri>1&&ds<=test_boundary, ri--; mri--; ds=diff/mri; ); ); if(test_boundary||diff?(ds>test_boundary):1, px=[v[0],v[1]]; iter=v[4]+1; p=v[2]; repeat(ri,ri_ind, rb=odd<1?u(0,1)>odd:0; ri_ind==mri?( if(p>v[3], p=v[3]; if(!(v[1]-v[0]),rb=1;); ); (rb||(iter==max_iter))?( dar_insert(#-1,[px,p,v[3],iter]); ):( dar_insert(#-2,[px,p,v[3],iter]); ); ): !ri_ind?( my=sy+ds; np=min(max(sy,round(u(p,my))),ey); vp=[p,np]; (rb||(iter==max_iter))?( dar_insert(#-1,[px,vp,iter]); ):( dar_insert(#-2,[px,vp,iter]); ); p=np+1; if(p>=ey,skip=1;); ):( if(skip,continue();); my+=ds; np=min(max(p+internal_space,round(u(p,my))),ey); vp=[min(p,ey),np]; (rb||(iter==max_iter))?( dar_insert(#-1,[px,vp,iter]); ):( dar_insert(#-2,[px,vp,iter]); ); p=np+1; ); ); ,dar_insert(#-1,v); ); ,dar_insert(#-1,v); ); ); v=I[#-2,0]; width_check&&height_check?( u(0,1)<=.5?( sub_row(v,0); ):( sub_column(v,0); ); ): width_check?( sub_column(v,0); ): height_check?( sub_row(v,0); ); arr_point=0; while(dar_size(#-2), p_ind=int(u(dar_size(#-2))); cv=I[#-2,p_ind]; u(0,1)<.5?( sub_row(cv,p_ind); ):( sub_column(cv,p_ind); ); arr_point++; if(arr_point>=arr_limit,break()); ); resize(#-2,1,dar_size(#-2),1,4,0); resize(#-1,1,dar_size(#-1),1,4,0);" a[-2,-1] y eval. :"begin( convert2coords(c)=( tl=[c[0],c[2]]; tr=[c[1],c[2]]; bl=[c[0],c[3]]; br=[c[1],c[3]]; [tl,tr,br,bl]; ); ); polygon(#-2,4,convert2coords(I),1,y);" rm.
  18. I haven't tested this, but if I have to wager a guess, it's because you're using multiple rules and IndirectUI doesn't address that too well. I have that bugs in few of my plugins, I can't fix that.
  19. After changing the writeline place, it gives non-zero value. Put it after RemoveAt(0). In spite of this, the code doesn't seem to work.
  20. Right now, I have a near complete code. The only problem is that DEBUG shows ModifiableRect[0] outputs (0,0,0,0,0). If that wasn't the case, then the code should work in theory. The idea is to create array containing rectangles, and the voids modify existing rectangle and insert new array of rectangles. iter means number of iteration of splitting. Some questions: 1. Is the binary Random condition coded in here is correct? myRandom(2)==0? 2. Any reason why it outputs a blank image?
×
×
  • Create New...