Results 1 to 2 of 2

Thread: ShowPalette() - Debugs array of colors.

  1. #1
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default ShowPalette() - Debugs array of colors.

    Found in the depths of old code archives.

    Simba Code:
    function ShowPalette (colors :TintegerArray ; w,h,MaxInRow :integer ;Frame :Boolean ;FrameColor :integer ) : integer;
    var
    col,a,hig: integer;
    box :Tbox;
    begin
      hig := Length(colors);
      if ( hig > MaxInRow ) then
      begin
        col := MaxInRow;
        Result := CreateBitmap(col*w+1,h+((hig-1) div col)*h+1);
      end else begin
        col := hig;
        Result := CreateBitmap(col*w+1,h+1);
      end;
      for a:=0 to hig-1 do
      begin
        box := IntToBox ( w*(a mod col) , (a div col)*h , w+w*(a mod col) , h+(a div col)*h);
        RectangleBitmap(Result,box,colors[a]);
         if(Frame) then DrawTPABitmap(Result,EdgeFromBox(box),Framecolor);
      end;
      GetBitmapSize(Result,w,h);
      DisplayDebugImgWindow(w,h);
      DrawBitmapDebugImg(Result);
    end;

    Example:

    Simba Code:
    procedure TIntegerArray.Add(int:integer);
    begin
      setLength(self,Length(self)+1);
      self[high(self)] := int;
    end;
        var bmp,i:integer;
        var tia :tintegerarray;
    begin
       for i := 0 to 255 do
          tia.Add(RGBtoColor(127+(i div 2),i,255-i));
       ShowPalette(tia,30,30,20,true,$0000FF);
    end.






    Simba Code:
    procedure TIntegerArray.Add(int:integer);
    begin
      setLength(self,Length(self)+1);
      self[high(self)] := int;
    end;
        var bmp,i:integer;
        var tia :tintegerarray;
    begin
       for i := 0 to 255 do
          tia.Add(RGBtoColor(33,i,33));
       ShowPalette(tia,40,40,20,false,0);
    end.






    Simba Code:
    procedure TIntegerArray.Add(int:integer);
    begin
      setLength(self,Length(self)+1);
      self[high(self)] := int;
    end;
        var bmp,i,j:integer;
        var tia :tintegerarray;
    begin
       for i := 1 to 360 do
         for j := 0 to 1000 do
         begin
           tia.Add(HSLToColor(i,cos(radians(i))*100,j/10));
         end;

       ShowPalette(tia,1,1,1000,false,0);
    end.
    Last edited by bg5; 09-07-2015 at 01:28 AM.

  2. #2
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •