1 /* Copyright (C) 2000 Damir Zucic */
2 
3 /*=============================================================================
4 
5 				no_fading.c
6 
7 Purpose:
8 	Prepare the left, middle and right color for each atom in a complex.
9 	No fading in  this function - near atom  colors  are used.  White is
10 	used as a replacement color if color allocation fails.
11 
12 Input:
13 	(1) Pointer to MolComplexS structure.
14 	(2) Pointer to GUIS structure.
15 
16 Output:
17 	(1) left_colorID, middle_colorID and right_colorID members of  AtomS
18 	    structure initialized for each atom in macromolecular complex.
19 	(2) Return value.
20 
21 Return value:
22 	Zero always (trivial).
23 
24 Notes:
25 	(1) Do not skip hidden atoms,  the color of these atoms  may be used
26 	    for backbone drawing!
27 
28 =============================================================================*/
29 
30 #include <stdio.h>
31 
32 #include <X11/Xlib.h>
33 #include <X11/Xutil.h>
34 #include <X11/Xos.h>
35 #include <X11/Xatom.h>
36 
37 #include "defines.h"
38 #include "typedefs.h"
39 
40 /*======function prototypes:=================================================*/
41 
42 unsigned long	PixelFromRGBS_ (RGBS *, GUIS *);
43 
44 /*======fading not used:=====================================================*/
45 
NoFading_(MolComplexS * curr_mol_complexSP,GUIS * guiSP)46 size_t NoFading_ (MolComplexS *curr_mol_complexSP, GUIS *guiSP)
47 {
48 size_t			atoms_between_surfacesN = 0;
49 size_t			atomsN, atomI;
50 XColor			colorS;
51 AtomS			*curr_atomSP;
52 
53 /* Prepare and check the number of atoms in a complex: */
54 atomsN = curr_mol_complexSP->atomsN;
55 if (atomsN == 0) return 0;
56 
57 /* Set DoRed, DoGreen and DoBlue flags in colorS: */
58 colorS.flags = DoRed | DoGreen | DoBlue;
59 
60 /* Assign the same set of three color ID's to each atom: */
61 for (atomI = 0; atomI < atomsN; atomI++)
62         {
63 	/** Prepare the current atom pointer: **/
64 	curr_atomSP = curr_mol_complexSP->atomSP + atomI;
65 
66 	/** Is atom out of slab? **/
67 	if (!curr_atomSP->inside_slabF) continue;
68 
69 	/** Prepare color ID's (use near atom colors): **/
70 	curr_atomSP->left_colorID   =
71 		PixelFromRGBS_ (curr_atomSP->left_rgbSA, guiSP);
72 	curr_atomSP->middle_colorID =
73 		PixelFromRGBS_ (curr_atomSP->middle_rgbSA, guiSP);
74 	curr_atomSP->right_colorID  =
75 		PixelFromRGBS_ (curr_atomSP->right_rgbSA, guiSP);
76 	}
77 
78 /* Return the total number of allocated colors: */
79 return atoms_between_surfacesN;
80 }
81 
82 /*===========================================================================*/
83 
84 
85