~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/pygimp/pygimp-colors.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2008-08-22 11:50:05 UTC
  • mfrom: (0.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20080822115005-yxj5svf3v9x1mkr7
Tags: upstream-2.4.7
ImportĀ upstreamĀ versionĀ 2.4.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#define NO_IMPORT_PYGOBJECT
22
22
 
 
23
#include "pygimp.h"
23
24
#include "pygimpcolor.h"
24
25
 
25
26
#include <libgimpmath/gimpmath.h>
459
460
    { NULL, (getter)0, (setter)0 },
460
461
};
461
462
 
462
 
static int
 
463
static Py_ssize_t 
463
464
rgb_length(PyObject *self)
464
465
{
465
466
    return 4;
466
467
}
467
468
 
468
469
static PyObject *
469
 
rgb_getitem(PyObject *self, int pos)
 
470
rgb_getitem(PyObject *self, Py_ssize_t pos)
470
471
{
471
472
    GimpRGB *rgb;
472
473
    double val;
495
496
}
496
497
 
497
498
static int
498
 
rgb_setitem(PyObject *self, int pos, PyObject *value)
 
499
rgb_setitem(PyObject *self, Py_ssize_t pos, PyObject *value)
499
500
{
500
501
    if (pos < 0)
501
502
        pos += 4;
517
518
}
518
519
 
519
520
static PyObject *
520
 
rgb_slice(PyObject *self, int start, int end)
 
521
rgb_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end)
521
522
{
522
523
    PyTupleObject *ret;
523
 
    int i;
 
524
    Py_ssize_t i;
524
525
 
525
526
    if (start < 0)
526
527
        start = 0;
540
541
}
541
542
 
542
543
static PySequenceMethods rgb_as_sequence = {
543
 
    (inquiry)rgb_length,
 
544
    rgb_length,
544
545
    (binaryfunc)0,
545
 
    (intargfunc)0,
546
 
    (intargfunc)rgb_getitem,
547
 
    (intintargfunc)rgb_slice,
548
 
    (intobjargproc)rgb_setitem,
549
 
    (intintobjargproc)0,
 
546
    0,
 
547
    rgb_getitem,
 
548
    rgb_slice,
 
549
    rgb_setitem,
 
550
    0,
550
551
    (objobjproc)0,
551
552
};
552
553
 
562
563
            return NULL;
563
564
        return rgb_getitem(self, i);
564
565
    } else if (PySlice_Check(item)) {
565
 
        int start, stop, step, slicelength, cur, i;
 
566
        Py_ssize_t start, stop, step, slicelength, cur, i;
566
567
        PyObject *ret;
567
568
 
568
569
        if (PySlice_GetIndicesEx((PySliceObject*)item, 4,
608
609
}
609
610
 
610
611
static PyMappingMethods rgb_as_mapping = {
611
 
    (inquiry)rgb_length,
 
612
    rgb_length,
612
613
    (binaryfunc)rgb_subscript,
613
614
    (objobjargproc)0
614
615
};
982
983
    { NULL, (getter)0, (setter)0 },
983
984
};
984
985
 
985
 
static int
 
986
static Py_ssize_t 
986
987
hsv_length(PyObject *self)
987
988
{
988
989
    return 4;
989
990
}
990
991
 
991
992
static PyObject *
992
 
hsv_getitem(PyObject *self, int pos)
 
993
hsv_getitem(PyObject *self, Py_ssize_t pos)
993
994
{
994
995
    GimpHSV *hsv;
995
996
    double val, scale_factor;
1040
1041
}
1041
1042
 
1042
1043
static PyObject *
1043
 
hsv_slice(PyObject *self, int start, int end)
 
1044
hsv_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end)
1044
1045
{
1045
1046
    PyTupleObject *ret;
1046
 
    int i;
 
1047
    Py_ssize_t i;
1047
1048
 
1048
1049
    if (start < 0)
1049
1050
        start = 0;
1063
1064
}
1064
1065
 
1065
1066
static PySequenceMethods hsv_as_sequence = {
1066
 
    (inquiry)hsv_length,
 
1067
    hsv_length,
1067
1068
    (binaryfunc)0,
1068
 
    (intargfunc)0,
1069
 
    (intargfunc)hsv_getitem,
1070
 
    (intintargfunc)hsv_slice,
1071
 
    (intobjargproc)hsv_setitem,
1072
 
    (intintobjargproc)0,
 
1069
    0,
 
1070
    hsv_getitem,
 
1071
    hsv_slice,
 
1072
    hsv_setitem,
 
1073
    0,
1073
1074
    (objobjproc)0,
1074
1075
};
1075
1076
 
1085
1086
            return NULL;
1086
1087
        return hsv_getitem(self, i);
1087
1088
    } else if (PySlice_Check(item)) {
1088
 
        int start, stop, step, slicelength, cur, i;
 
1089
        Py_ssize_t start, stop, step, slicelength, cur, i;
1089
1090
        PyObject *ret;
1090
1091
 
1091
1092
        if (PySlice_GetIndicesEx((PySliceObject*)item, 4,
1131
1132
}
1132
1133
 
1133
1134
static PyMappingMethods hsv_as_mapping = {
1134
 
    (inquiry)hsv_length,
 
1135
    hsv_length,
1135
1136
    (binaryfunc)hsv_subscript,
1136
1137
    (objobjargproc)0
1137
1138
};
1495
1496
    { NULL, (getter)0, (setter)0 },
1496
1497
};
1497
1498
 
1498
 
static int
 
1499
static Py_ssize_t
1499
1500
hsl_length(PyObject *self)
1500
1501
{
1501
1502
    return 4;
1502
1503
}
1503
1504
 
1504
1505
static PyObject *
1505
 
hsl_getitem(PyObject *self, int pos)
 
1506
hsl_getitem(PyObject *self, Py_ssize_t pos)
1506
1507
{
1507
1508
    GimpHSL *hsl;
1508
1509
    double val, scale_factor;
1553
1554
}
1554
1555
 
1555
1556
static PyObject *
1556
 
hsl_slice(PyObject *self, int start, int end)
 
1557
hsl_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end)
1557
1558
{
1558
1559
    PyTupleObject *ret;
1559
 
    int i;
 
1560
    Py_ssize_t i;
1560
1561
 
1561
1562
    if (start < 0)
1562
1563
        start = 0;
1576
1577
}
1577
1578
 
1578
1579
static PySequenceMethods hsl_as_sequence = {
1579
 
    (inquiry)hsl_length,
 
1580
    hsl_length,
1580
1581
    (binaryfunc)0,
1581
 
    (intargfunc)0,
1582
 
    (intargfunc)hsl_getitem,
1583
 
    (intintargfunc)hsl_slice,
1584
 
    (intobjargproc)hsl_setitem,
1585
 
    (intintobjargproc)0,
 
1582
    0,
 
1583
    hsl_getitem,
 
1584
    hsl_slice,
 
1585
    hsl_setitem,
 
1586
    0,
1586
1587
    (objobjproc)0,
1587
1588
};
1588
1589
 
1598
1599
            return NULL;
1599
1600
        return hsl_getitem(self, i);
1600
1601
    } else if (PySlice_Check(item)) {
1601
 
        int start, stop, step, slicelength, cur, i;
 
1602
        Py_ssize_t start, stop, step, slicelength, cur, i;
1602
1603
        PyObject *ret;
1603
1604
 
1604
1605
        if (PySlice_GetIndicesEx((PySliceObject*)item, 4,
1644
1645
}
1645
1646
 
1646
1647
static PyMappingMethods hsl_as_mapping = {
1647
 
    (inquiry)hsl_length,
 
1648
    hsl_length,
1648
1649
    (binaryfunc)hsl_subscript,
1649
1650
    (objobjargproc)0
1650
1651
};
1999
2000
    { NULL, (getter)0, (setter)0 },
2000
2001
};
2001
2002
 
2002
 
static int
 
2003
static Py_ssize_t
2003
2004
cmyk_length(PyObject *self)
2004
2005
{
2005
2006
    return 5;
2006
2007
}
2007
2008
 
2008
2009
static PyObject *
2009
 
cmyk_getitem(PyObject *self, int pos)
 
2010
cmyk_getitem(PyObject *self, Py_ssize_t pos)
2010
2011
{
2011
2012
    GimpCMYK *cmyk;
2012
2013
    double val;
2059
2060
}
2060
2061
 
2061
2062
static PyObject *
2062
 
cmyk_slice(PyObject *self, int start, int end)
 
2063
cmyk_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end)
2063
2064
{
2064
2065
    PyTupleObject *ret;
2065
 
    int i;
 
2066
    Py_ssize_t i;
2066
2067
 
2067
2068
    if (start < 0)
2068
2069
        start = 0;
2082
2083
}
2083
2084
 
2084
2085
static PySequenceMethods cmyk_as_sequence = {
2085
 
    (inquiry)cmyk_length,
 
2086
    cmyk_length,
2086
2087
    (binaryfunc)0,
2087
 
    (intargfunc)0,
2088
 
    (intargfunc)cmyk_getitem,
2089
 
    (intintargfunc)cmyk_slice,
2090
 
    (intobjargproc)cmyk_setitem,
2091
 
    (intintobjargproc)0,
 
2088
    0,
 
2089
    cmyk_getitem,
 
2090
    cmyk_slice,
 
2091
    cmyk_setitem,
 
2092
    0,
2092
2093
    (objobjproc)0,
2093
2094
};
2094
2095
 
2104
2105
            return NULL;
2105
2106
        return cmyk_getitem(self, i);
2106
2107
    } else if (PySlice_Check(item)) {
2107
 
        int start, stop, step, slicelength, cur, i;
 
2108
        Py_ssize_t start, stop, step, slicelength, cur, i;
2108
2109
        PyObject *ret;
2109
2110
 
2110
2111
        if (PySlice_GetIndicesEx((PySliceObject*)item, 5,
2153
2154
}
2154
2155
 
2155
2156
static PyMappingMethods cmyk_as_mapping = {
2156
 
    (inquiry)cmyk_length,
 
2157
    cmyk_length,
2157
2158
    (binaryfunc)cmyk_subscript,
2158
2159
    (objobjargproc)0
2159
2160
};