Attr-Attributes copy

From Vectorlab
Jump to: navigation, search


Transfers attributes from one object to another. This doesn't deal with texture, run A_TextureCopy separately if you need it. By Orso B. Schmid


{ Orso ***************************** }
{ Copy all attributes from one obj to another }
PROCEDURE A_AttrCopy(source, target: HANDLE);
	VAR
		r, g, b : LONGINT;
		
		temp_b : BOOLEAN;
		temp_i : INTEGER;
		
	BEGIN
		IF (target <> NIL) & (source <> NIL) THEN BEGIN
			SetClass(target, GetClass(source));
				
			IF IsLSByClass(source) THEN
				SetLSByClass(target)
			ELSE
				SetLS(target, GetLS(source));;
				
			IF IsLWByClass(source) THEN
				SetLWByClass(target)
			ELSE
				SetLW(target, GetLW(source));
				
			IF IsPenColorByClass(source) THEN
				SetPenColorByClass(target)
			ELSE BEGIN
				GetPenFore(source, r, g, b);
				SetPenFore(target, r, g, b);
				
				GetPenBack(source, r, g, b);
				SetPenBack(target, r, g, b);
			END;
				
			IF IsFPatByClass(source) THEN
				SetFPatByClass(target)
			ELSE
				SetFPat(target, GetFPat(source));
			
			IF IsFillColorByClass(source) THEN
				SetFillColorByClass(target)
			ELSE BEGIN
				GetFillFore(source, r, g, b);
				SetFillFore(target, r, g, b);
					
				GetFillBack(source, r, g, b);
				SetFillBack(target, r, g, b);
			END;
				
			GetOpacityByClass(source, temp_b);
			IF temp_b = TRUE THEN
				SetOpacityByClass(target)
			ELSE BEGIN
				GetOpacity(source, temp_i);
				SetOpacity(target, temp_i);
			END;
			
			A_MarkerCopy(source, target, 3);
		END;
	END;