File: cairoCFerBind_replaceBrushColor.c

package info (click to toggle)
pyferret 7.6.5-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 138,136 kB
  • sloc: fortran: 240,609; ansic: 25,235; python: 24,026; sh: 1,618; makefile: 1,123; pascal: 569; csh: 307; awk: 18
file content (45 lines) | stat: -rw-r--r-- 1,410 bytes parent folder | download | duplicates (6)
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
/* Python.h should always be first */
#include <Python.h>
#include <string.h>
#include "grdel.h"
#include "cferbind.h"
#include "cairoCFerBind.h"

/*
 * Replace the color in the given brush object with that in
 * the given color object.
 *
 * Returns one if successful.   If an error occurs, grdelerrmsg
 * is assigned an appropriate error message and zero is returned.
 */
grdelBool cairoCFerBind_replaceBrushColor(CFerBind *self,
                                          grdelType brush, grdelType color)
{
    CCFBBrush *brushobj;
    CCFBColor *colorobj;

    /* Sanity checks */
    if ( (self->enginename != CairoCFerBindName) &&
         (self->enginename != PyQtCairoCFerBindName) ) {
        strcpy(grdelerrmsg, "cairoCFerBind_replaceBrushColor: unexpected error, "
                            "self is not a valid CFerBind struct");
        return 0;
    }
    brushobj = (CCFBBrush *) brush;
    if ( brushobj->id != CCFBBrushId ) {
        strcpy(grdelerrmsg, "cairoCFerBind_replaceBrushColor: unexpected error, "
                            "brush is not CCFBBrush struct");
        return 0;
    }
    colorobj = (CCFBColor *) color;
    if ( colorobj->id != CCFBColorId ) {
        strcpy(grdelerrmsg, "cairoCFerBind_replaceBrushColor: unexpected error, "
                            "color is not CCFBColor struct");
        return 0;
    }

    brushobj->color = *colorobj;

    return 1;
}