compact format for copy/paste
This commit is contained in:
		@ -9,6 +9,7 @@
 | 
				
			|||||||
+ Added form to modify the image after rendering.
 | 
					+ Added form to modify the image after rendering.
 | 
				
			||||||
+ B1199407 'Use current' gradient option bug
 | 
					+ B1199407 'Use current' gradient option bug
 | 
				
			||||||
+ Add zoom out functionality on main form
 | 
					+ Add zoom out functionality on main form
 | 
				
			||||||
 | 
					+ compact format for copy/paste
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2.02g
 | 
					2.02g
 | 
				
			||||||
+ Delphi2005 Project
 | 
					+ Delphi2005 Project
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ object MainForm: TMainForm
 | 
				
			|||||||
  Left = 411
 | 
					  Left = 411
 | 
				
			||||||
  Top = 128
 | 
					  Top = 128
 | 
				
			||||||
  Width = 574
 | 
					  Width = 574
 | 
				
			||||||
  Height = 575
 | 
					  Height = 595
 | 
				
			||||||
  Caption = 'Apophysis'
 | 
					  Caption = 'Apophysis'
 | 
				
			||||||
  Color = clBtnFace
 | 
					  Color = clBtnFace
 | 
				
			||||||
  Font.Charset = ANSI_CHARSET
 | 
					  Font.Charset = ANSI_CHARSET
 | 
				
			||||||
@ -27,7 +27,7 @@ object MainForm: TMainForm
 | 
				
			|||||||
    Left = 160
 | 
					    Left = 160
 | 
				
			||||||
    Top = 28
 | 
					    Top = 28
 | 
				
			||||||
    Width = 4
 | 
					    Width = 4
 | 
				
			||||||
    Height = 474
 | 
					    Height = 514
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  object ToolBar: TToolBar
 | 
					  object ToolBar: TToolBar
 | 
				
			||||||
    Left = 0
 | 
					    Left = 0
 | 
				
			||||||
@ -261,7 +261,7 @@ object MainForm: TMainForm
 | 
				
			|||||||
    Left = 0
 | 
					    Left = 0
 | 
				
			||||||
    Top = 28
 | 
					    Top = 28
 | 
				
			||||||
    Width = 160
 | 
					    Width = 160
 | 
				
			||||||
    Height = 474
 | 
					    Height = 514
 | 
				
			||||||
    Align = alLeft
 | 
					    Align = alLeft
 | 
				
			||||||
    Columns = <
 | 
					    Columns = <
 | 
				
			||||||
      item
 | 
					      item
 | 
				
			||||||
@ -280,7 +280,7 @@ object MainForm: TMainForm
 | 
				
			|||||||
    Left = 164
 | 
					    Left = 164
 | 
				
			||||||
    Top = 28
 | 
					    Top = 28
 | 
				
			||||||
    Width = 402
 | 
					    Width = 402
 | 
				
			||||||
    Height = 474
 | 
					    Height = 514
 | 
				
			||||||
    Align = alClient
 | 
					    Align = alClient
 | 
				
			||||||
    BevelInner = bvLowered
 | 
					    BevelInner = bvLowered
 | 
				
			||||||
    BevelOuter = bvNone
 | 
					    BevelOuter = bvNone
 | 
				
			||||||
@ -291,7 +291,7 @@ object MainForm: TMainForm
 | 
				
			|||||||
      Left = 1
 | 
					      Left = 1
 | 
				
			||||||
      Top = 1
 | 
					      Top = 1
 | 
				
			||||||
      Width = 400
 | 
					      Width = 400
 | 
				
			||||||
      Height = 472
 | 
					      Height = 492
 | 
				
			||||||
      Align = alClient
 | 
					      Align = alClient
 | 
				
			||||||
      AutoSize = True
 | 
					      AutoSize = True
 | 
				
			||||||
      PopupMenu = DisplayPopup
 | 
					      PopupMenu = DisplayPopup
 | 
				
			||||||
@ -303,7 +303,7 @@ object MainForm: TMainForm
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
  object StatusBar: TStatusBar
 | 
					  object StatusBar: TStatusBar
 | 
				
			||||||
    Left = 0
 | 
					    Left = 0
 | 
				
			||||||
    Top = 502
 | 
					    Top = 542
 | 
				
			||||||
    Width = 566
 | 
					    Width = 566
 | 
				
			||||||
    Height = 19
 | 
					    Height = 19
 | 
				
			||||||
    Panels = <
 | 
					    Panels = <
 | 
				
			||||||
@ -321,7 +321,7 @@ object MainForm: TMainForm
 | 
				
			|||||||
    Left = 8
 | 
					    Left = 8
 | 
				
			||||||
    Top = 56
 | 
					    Top = 56
 | 
				
			||||||
    Bitmap = {
 | 
					    Bitmap = {
 | 
				
			||||||
      494C010133003600040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
 | 
					      494C010133003600040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
 | 
				
			||||||
      000000000000360000002800000040000000E0000000010020000000000000E0
 | 
					      000000000000360000002800000040000000E0000000010020000000000000E0
 | 
				
			||||||
      0000000000000000000000000000000000000000000000000000000000000000
 | 
					      0000000000000000000000000000000000000000000000000000000000000000
 | 
				
			||||||
      0000000000000000000000000000000000000000000000000000000000000000
 | 
					      0000000000000000000000000000000000000000000000000000000000000000
 | 
				
			||||||
@ -2173,7 +2173,8 @@ object MainForm: TMainForm
 | 
				
			|||||||
      C003000F80018000C003000780018000C003000380018000C003000180018000
 | 
					      C003000F80018000C003000780018000C003000380018000C003000180018000
 | 
				
			||||||
      C003000180018000C003001F80018000C003001F80018001C003001F80018001
 | 
					      C003000180018000C003001F80018000C003001F80018001C003001F80018001
 | 
				
			||||||
      C0038FF180018001C007FFF980018001C00FFF7580018001C01FFF8F80018001
 | 
					      C0038FF180018001C007FFF980018001C00FFF7580018001C01FFF8F80018001
 | 
				
			||||||
      C03FFFFF80018001FFFFFFFFFFFFFFFF}
 | 
					      C03FFFFF80018001FFFFFFFFFFFFFFFF00000000000000000000000000000000
 | 
				
			||||||
 | 
					      000000000000}
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  object SmallImages: TImageList
 | 
					  object SmallImages: TImageList
 | 
				
			||||||
    Left = 40
 | 
					    Left = 40
 | 
				
			||||||
 | 
				
			|||||||
@ -1288,8 +1288,37 @@ begin
 | 
				
			|||||||
  end;
 | 
					  end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function ColorToXmlCompact(cp1: TControlPoint): string;
 | 
				
			||||||
 | 
					var
 | 
				
			||||||
 | 
					  i: integer;
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  Result := '   <colors count="256" data="';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function FlameToXML(const cp1: TControlPoint; sheep: boolean): string;
 | 
					  for i := 0 to 255 do  begin
 | 
				
			||||||
 | 
					    Result := Result + IntToHex(0,2)
 | 
				
			||||||
 | 
					                     + IntToHex(cp1.cmap[i, 0],2)
 | 
				
			||||||
 | 
					                     + IntToHex(cp1.cmap[i, 1],2)
 | 
				
			||||||
 | 
					                     + IntToHex(cp1.cmap[i, 2],2);
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					  Result := Result + '"/>';
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function ColorToXml(cp1: TControlPoint): string;
 | 
				
			||||||
 | 
					var
 | 
				
			||||||
 | 
					  i: integer;
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  Result := '';
 | 
				
			||||||
 | 
					  for i := 0 to 255 do  begin
 | 
				
			||||||
 | 
					    Result := Result + '   <color index="' + IntToStr(i) +
 | 
				
			||||||
 | 
					      '" rgb="' + IntToStr(cp1.cmap[i, 0]) + ' ' +
 | 
				
			||||||
 | 
					                  IntToStr(cp1.cmap[i, 1]) + ' ' +
 | 
				
			||||||
 | 
					                  IntToStr(cp1.cmap[i, 2]) + '"/>' + #13#10;
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function FlameToXML(const cp1: TControlPoint; sheep: boolean; compact: boolean = false): string;
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  t, i, j: integer;
 | 
					  t, i, j: integer;
 | 
				
			||||||
  FileList: TStringList;
 | 
					  FileList: TStringList;
 | 
				
			||||||
@ -1348,14 +1377,12 @@ begin
 | 
				
			|||||||
      end;
 | 
					      end;
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
   { Write palette data }
 | 
					   { Write palette data }
 | 
				
			||||||
    if not sheep then
 | 
					    if not sheep then begin
 | 
				
			||||||
      for i := 0 to 255 do
 | 
					      if not compact then
 | 
				
			||||||
      begin
 | 
					        FileList.Add(ColorToXml(cp1));
 | 
				
			||||||
        FileList.Add('   <color index="' + IntToStr(i) +
 | 
					      FileList.Add(ColorToXmlcompact(cp1));
 | 
				
			||||||
          '" rgb="' + IntToStr(cp1.cmap[i, 0]) + ' ' +
 | 
					 | 
				
			||||||
          IntToStr(cp1.cmap[i, 1]) + ' ' +
 | 
					 | 
				
			||||||
          IntToStr(cp1.cmap[i, 2]) + '"/>');
 | 
					 | 
				
			||||||
   end;
 | 
					   end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FileList.Add('</flame>');
 | 
					    FileList.Add('</flame>');
 | 
				
			||||||
    result := FileList.text;
 | 
					    result := FileList.text;
 | 
				
			||||||
  finally
 | 
					  finally
 | 
				
			||||||
@ -3610,7 +3637,7 @@ procedure TMainForm.mnuCopyClick(Sender: TObject);
 | 
				
			|||||||
var
 | 
					var
 | 
				
			||||||
  txt: string;
 | 
					  txt: string;
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
  txt := Trim(FlameToXML(Maincp, false));
 | 
					  txt := Trim(FlameToXML(Maincp, false, true));
 | 
				
			||||||
  Clipboard.SetTextBuf(PChar(txt));
 | 
					  Clipboard.SetTextBuf(PChar(txt));
 | 
				
			||||||
  mnuPaste.enabled := true;
 | 
					  mnuPaste.enabled := true;
 | 
				
			||||||
  btnPaste.enabled := true;
 | 
					  btnPaste.enabled := true;
 | 
				
			||||||
@ -3912,6 +3939,29 @@ begin
 | 
				
			|||||||
  end;
 | 
					  end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					procedure ParseCompactcolors(cp: TControlPoint; count: integer; data: string);
 | 
				
			||||||
 | 
					  function HexChar(c: Char): Byte;
 | 
				
			||||||
 | 
					  begin
 | 
				
			||||||
 | 
					    case c of
 | 
				
			||||||
 | 
					      '0'..'9':  Result := Byte(c) - Byte('0');
 | 
				
			||||||
 | 
					      'a'..'f':  Result := (Byte(c) - Byte('a')) + 10;
 | 
				
			||||||
 | 
					      'A'..'F':  Result := (Byte(c) - Byte('A')) + 10;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      Result := 0;
 | 
				
			||||||
 | 
					    end;
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					var
 | 
				
			||||||
 | 
					  i: integer;
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  Assert(Count = 256,'only 256 color Colormaps are supported at the moment');
 | 
				
			||||||
 | 
					  Assert((Count * 8) = Length(data),'Data size MisMatch');
 | 
				
			||||||
 | 
					  for i := 0 to Count -1 do begin
 | 
				
			||||||
 | 
					    Parsecp.cmap[i][0] := 16 * HexChar(Data[i*8 + 3]) + HexChar(Data[i*8 + 4]);
 | 
				
			||||||
 | 
					    Parsecp.cmap[i][1] := 16 * HexChar(Data[i*8 + 5]) + HexChar(Data[i*8 + 6]);
 | 
				
			||||||
 | 
					    Parsecp.cmap[i][2] := 16 * HexChar(Data[i*8 + 7]) + HexChar(Data[i*8 + 8]);
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
procedure TMainForm.XMLScannerEmptyTag(Sender: TObject; TagName: string;
 | 
					procedure TMainForm.XMLScannerEmptyTag(Sender: TObject; TagName: string;
 | 
				
			||||||
  Attributes: TAttrList);
 | 
					  Attributes: TAttrList);
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
@ -3978,6 +4028,10 @@ begin
 | 
				
			|||||||
      Parsecp.cmap[i][1] := StrToInt(Tokens[1]);
 | 
					      Parsecp.cmap[i][1] := StrToInt(Tokens[1]);
 | 
				
			||||||
      Parsecp.cmap[i][2] := StrToInt(Tokens[2]);
 | 
					      Parsecp.cmap[i][2] := StrToInt(Tokens[2]);
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
 | 
					    if TagName = 'colors' then
 | 
				
			||||||
 | 
					    begin
 | 
				
			||||||
 | 
					      ParseCompactcolors(Parsecp, StrToInt(Attributes.value('count')), Attributes.value('data'));
 | 
				
			||||||
 | 
					    end;
 | 
				
			||||||
    if TagName = 'symmetry' then
 | 
					    if TagName = 'symmetry' then
 | 
				
			||||||
    begin
 | 
					    begin
 | 
				
			||||||
      i := StrToInt(Attributes.value('kind'));
 | 
					      i := StrToInt(Attributes.value('kind'));
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user