Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions kiva/agg/src/affine_matrix.i
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@


%{
#ifdef NUMPY
#include "numpy/arrayobject.h"
#else
#include "Numeric/arrayobject.h"
#endif
#include "agg_trans_affine.h"

// These factories mimic the functionality of like-named classes in agg.
Expand Down
2 changes: 0 additions & 2 deletions kiva/agg/src/graphics_context.i
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
agg24::rgba _clear_color = agg24::rgba(1,1,1,1);
%}

%include "numeric_ext.i"

%typemap(out) PyObject*
{
$result = $1;
Expand Down
10 changes: 0 additions & 10 deletions kiva/agg/src/gtk1/agg_bmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,7 @@
#include "agg_pixfmt_rgba.h"
#include "agg_color_rgba.h"

#ifdef NUMPY
#include "numpy/arrayobject.h"
# ifndef PyArray_SBYTE
# include "numpy/noprefix.h"
# include "numpy/oldnumeric.h"
# include "numpy/old_defines.h"
# endif
#else
#include "Numeric/arrayobject.h"
#define PyArray_UBYTELTR 'b'
#endif

#if 0
#define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n");
Expand Down
18 changes: 2 additions & 16 deletions kiva/agg/src/numeric.i
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,7 @@ Here are the typemap helper functions for numeric arrays:
*/

%{
#ifdef NUMPY
#include "numpy/arrayobject.h"
# ifndef PyArray_SBYTE
# include "numpy/oldnumeric.h"
# include "numpy/old_defines.h"
# endif
#else
#include "Numeric/arrayobject.h"
#define PyArray_UBYTELTR 'b'
#endif

#include <string>

#define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a))
Expand Down Expand Up @@ -85,8 +75,8 @@ int type_match(int actual_type, int desired_type)
// Make sure input has correct numeric type. Allow character and byte to
// match also allow int and long to match.
if ( actual_type != desired_type &&
!(desired_type == PyArray_CHAR && actual_type == PyArray_SBYTE) &&
!(desired_type == PyArray_SBYTE && actual_type == PyArray_CHAR) &&
!(desired_type == PyArray_CHAR && actual_type == PyArray_BYTE) &&
!(desired_type == PyArray_BYTE && actual_type == PyArray_CHAR) &&
!(desired_type == PyArray_INT && actual_type == PyArray_LONG) &&
!(desired_type == PyArray_LONG && actual_type == PyArray_INT))
{
Expand Down Expand Up @@ -369,9 +359,5 @@ def numpy_check(obj, typecode,
%init %{
Py_Initialize();
import_array();
#ifdef NUMPY
PyImport_ImportModule("numpy");
#else
PyImport_ImportModule("Numeric");
#endif
%}
120 changes: 0 additions & 120 deletions kiva/agg/src/numeric_ext.i

This file was deleted.

3 changes: 1 addition & 2 deletions kiva/agg/src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ compiled_path.i wrapper for kiva_compiled_path.h
constants.i common enumerations and constants used by Agg and Kiva
font_type.i wrapper for kiva_font_type.h
graphic_context.i the main wrapper defining the Agg graphics context
numeric.i typemaps and wrappers for Numeric array used in kiva
numeric_ext.i same as numeric.i
numeric.i typemaps and wrappers for Numpy array used in kiva
rect.i wrapper for kiva_rect.h
rgba.i RGBA color class and utility functions
rgba_array.i maps Numeric 3- and 4-tuples into RGBA color instances
Expand Down
11 changes: 0 additions & 11 deletions kiva/agg/src/x11/agg_bmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,7 @@
#include "agg_color_rgba.h"

#include "bytesobject.h"

#ifdef NUMPY
#include "numpy/arrayobject.h"
# ifndef PyArray_SBYTE
# include "numpy/noprefix.h"
# include "numpy/oldnumeric.h"
# include "numpy/old_defines.h"
# endif
#else
#include "Numeric/arrayobject.h"
#define PyArray_UBYTELTR 'b'
#endif

#if 0
#define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n");
Expand Down
36 changes: 18 additions & 18 deletions kiva/quartz/ABCGI.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include "CoreFoundation.pxi"
include "CoreGraphics.pxi"
include "CoreText.pxi"

cimport c_numpy
cimport numpy

import os
import warnings
Expand Down Expand Up @@ -138,7 +138,7 @@ class URLPathStyle:
hfs = kCFURLHFSPathStyle
windows = kCFURLWindowsPathStyle

c_numpy.import_array()
numpy.import_array()
import numpy

from kiva import constants
Expand Down Expand Up @@ -486,7 +486,7 @@ cdef class CGContext:

cdef int n
cdef int i
cdef c_numpy.ndarray apoints
cdef numpy.ndarray apoints
cdef float x, y

n = len(points)
Expand All @@ -495,18 +495,18 @@ cdef class CGContext:
if n < 2:
return

apoints = <c_numpy.ndarray>(numpy.asarray(points, dtype=numpy.float32))
apoints = <numpy.ndarray>(numpy.asarray(points, dtype=numpy.float32))

if apoints.nd != 2 or apoints.dimensions[1] != 2:
msg = "must pass array of 2-D points"
raise ValueError(msg)

x = (<float*>c_numpy.PyArray_GETPTR2(apoints, 0, 0))[0]
y = (<float*>c_numpy.PyArray_GETPTR2(apoints, 0, 1))[0]
x = (<float*>numpy.PyArray_GETPTR2(apoints, 0, 0))[0]
y = (<float*>numpy.PyArray_GETPTR2(apoints, 0, 1))[0]
CGContextMoveToPoint(self.context, x, y)
for i from 1 <= i < n:
x = (<float*>c_numpy.PyArray_GETPTR2(apoints, i, 0))[0]
y = (<float*>c_numpy.PyArray_GETPTR2(apoints, i, 1))[0]
x = (<float*>numpy.PyArray_GETPTR2(apoints, i, 0))[0]
y = (<float*>numpy.PyArray_GETPTR2(apoints, i, 1))[0]
CGContextAddLineToPoint(self.context, x, y)

def line_set(self, object starts, object ends):
Expand Down Expand Up @@ -1057,10 +1057,10 @@ cdef class CGContext:

cdef int i
cdef int n
cdef c_numpy.ndarray apoints
cdef numpy.ndarray apoints
cdef float x, y

apoints = <c_numpy.ndarray>(numpy.asarray(points, dtype=numpy.float32))
apoints = <numpy.ndarray>(numpy.asarray(points, dtype=numpy.float32))

if apoints.nd != 2 or apoints.dimensions[1] != 2:
msg = "must pass array of 2-D points"
Expand All @@ -1070,8 +1070,8 @@ cdef class CGContext:

n = len(points)
for i from 0 <= i < n:
x = (<float*>c_numpy.PyArray_GETPTR2(apoints, i, 0))[0]
y = (<float*>c_numpy.PyArray_GETPTR2(apoints, i, 1))[0]
x = (<float*>numpy.PyArray_GETPTR2(apoints, i, 0))[0]
y = (<float*>numpy.PyArray_GETPTR2(apoints, i, 1))[0]
CGContextSaveGState(self.context)
CGContextTranslateCTM(self.context, x, y)
CGContextAddPath(self.context, marker.path)
Expand Down Expand Up @@ -1653,7 +1653,7 @@ cdef class CGBitmapContext(CGContext):
cdef class CGImage:
cdef CGImageRef image
cdef void* data
cdef readonly c_numpy.ndarray bmp_array
cdef readonly numpy.ndarray bmp_array

def __cinit__(self, *args, **kwds):
self.image = NULL
Expand Down Expand Up @@ -1734,9 +1734,9 @@ cdef class CGImage:
alpha_info = kCGImageAlphaPremultipliedLast
arr = numpy.zeros((height, width, lastdim), dtype=numpy.uint8)

self.bmp_array = <c_numpy.ndarray>arr
self.bmp_array = <numpy.ndarray>arr
Py_INCREF(self.bmp_array)
self.data = <void*>c_numpy.PyArray_DATA(self.bmp_array)
self.data = <void*>numpy.PyArray_DATA(self.bmp_array)

if grey_scale:
alpha_info = kCGImageAlphaNone
Expand Down Expand Up @@ -1769,7 +1769,7 @@ cdef class CGImage:

cdef CGDataProviderRef provider
provider = CGDataProviderCreateWithData(
NULL, self.data, c_numpy.PyArray_SIZE(self.bmp_array), NULL)
NULL, self.data, numpy.PyArray_SIZE(self.bmp_array), NULL)
if provider == NULL:
raise RuntimeError("could not make provider")

Expand Down Expand Up @@ -1835,7 +1835,7 @@ cdef class CGImageFile(CGImage):
dims[1] = width
dims[2] = bits_per_pixel/bits_per_component

self.bmp_array = c_numpy.PyArray_SimpleNew(3, &(dims[0]), c_numpy.NPY_UBYTE)
self.bmp_array = numpy.PyArray_SimpleNew(3, &(dims[0]), numpy.NPY_UBYTE)

data = self.bmp_array.data
bs = img.tobytes()
Expand Down Expand Up @@ -2598,7 +2598,7 @@ cdef class PiecewiseLinearColorFunction(ShadingFunction):
cdef CGFloat* alpha

def __init__(self, object stop_colors):
cdef c_numpy.ndarray stop_array
cdef numpy.ndarray stop_array
cdef int i

stop_colors = numpy.array(stop_colors).astype(numpy.float32)
Expand Down
Loading