/* Created By: Virgil Dupras * Created On: 2010-01-30 * Copyright 2014 Hardcoded Software (http://www.hardcoded.net) * * This software is licensed under the "BSD" License as described in the "LICENSE" file, * which should be included with this package. The terms are also available at * http://www.hardcoded.net/licenses/bsd_license */ #include "common.h" static PyObject* cache_bytes_to_colors(PyObject *self, PyObject *args) { char *y; Py_ssize_t char_count, i, color_count; PyObject *result; unsigned long r, g, b; Py_ssize_t ci; PyObject *color_tuple; if (!PyArg_ParseTuple(args, "y#", &y, &char_count)) { return NULL; } color_count = char_count / 3; result = PyList_New(color_count); if (result == NULL) { return NULL; } for (i=0; i