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