Graphics: Improve matplot 58/11458/3
Calixte DENIZET [Mon, 6 May 2013 16:19:56 +0000 (18:19 +0200)]
Change-Id: Iad2d6f2bcbe7b8eb15271d1b70df2a3cab5a3739

57 files changed:
scilab/modules/graphic_objects/Makefile.am
scilab/modules/graphic_objects/Makefile.in
scilab/modules/graphic_objects/includes/ColorComputer.hxx
scilab/modules/graphic_objects/includes/DataLoader.hxx
scilab/modules/graphic_objects/includes/DataProperties.hxx
scilab/modules/graphic_objects/includes/DecompositionUtils.hxx
scilab/modules/graphic_objects/includes/MatPlotDecomposer.hxx
scilab/modules/graphic_objects/includes/Matplot.h [new file with mode: 0644]
scilab/modules/graphic_objects/includes/NgonGridDataDecomposer.hxx
scilab/modules/graphic_objects/includes/NgonGridMatplotData.hxx
scilab/modules/graphic_objects/includes/NgonGridMatplotDataDecomposer.hxx
scilab/modules/graphic_objects/includes/Texture.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
scilab/modules/graphic_objects/src/cpp/ColorComputer.cpp
scilab/modules/graphic_objects/src/cpp/DataLoader.cpp
scilab/modules/graphic_objects/src/cpp/MatPlotDecomposer.cpp
scilab/modules/graphic_objects/src/cpp/NgonGridDataDecomposer.cpp
scilab/modules/graphic_objects/src/cpp/NgonGridMatplotData.cpp
scilab/modules/graphic_objects/src/cpp/NgonGridMatplotDataDecomposer.cpp
scilab/modules/graphic_objects/src/cpp/Texture.cpp [new file with mode: 0644]
scilab/modules/graphic_objects/src/cpp/getGraphicObjectProperty.cpp
scilab/modules/graphic_objects/src/cpp/setGraphicObjectProperty.cpp
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/DataLoader.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/DataLoaderJNI.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/MainDataLoader.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.java
scilab/modules/graphic_objects/src/jni/DataLoader.i
scilab/modules/graphic_objects/src/jni/DataLoader_wrap.c
scilab/modules/graphic_objects/src/scripts/genPropertiesName.sh
scilab/modules/graphic_objects/src/scripts/propertiesMap.properties
scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/includes/BuildObjects.h
scilab/modules/graphics/includes/GrayPlot.h
scilab/modules/graphics/includes/sciCall.h
scilab/modules/graphics/macros/%h_p.sci
scilab/modules/graphics/sci_gateway/c/sci_matplot.c
scilab/modules/graphics/sci_gateway/c/sci_matplot1.c
scilab/modules/graphics/sci_gateway/c/sci_set.c
scilab/modules/graphics/src/c/BuildObjects.c
scilab/modules/graphics/src/c/Gray.c
scilab/modules/graphics/src/c/getHandleProperty/GetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/SetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/getHandleProperty.h
scilab/modules/graphics/src/c/getHandleProperty/get_data_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_data_property.h
scilab/modules/graphics/src/c/getHandleProperty/get_image_type_property.c [new file with mode: 0644]
scilab/modules/graphics/src/c/getHandleProperty/setHandleProperty.h
scilab/modules/graphics/src/c/getHandleProperty/set_data_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_image_type_property.c [new file with mode: 0644]
scilab/modules/graphics/src/c/sciCall.c
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingView.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/canvas/SwingScilabCanvasImpl.java
scilab/modules/overloading/macros/%hm_i_h.sci [new file with mode: 0644]
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/FecDrawer.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/ScilabTextureManager.java

index dd9e370..3e556e3 100644 (file)
@@ -69,7 +69,8 @@ GRAPHIC_OBJECTS_CXX_SOURCES =         src/cpp/createGraphicObject.cpp \
                                                                src/cpp/FigureModel.cpp \
                                                                src/cpp/CurrentFigure.cpp \
                                                                src/cpp/CurrentObject.cpp \
-                                                               src/cpp/CurrentSubwin.cpp
+                                                               src/cpp/CurrentSubwin.cpp \
+                                                               src/cpp/Texture.cpp
 
 GIWS_WRAPPERS = src/jni/graphic_objects.giws.xml
 
index aa55408..8c5e1aa 100644 (file)
@@ -187,7 +187,8 @@ am__objects_4 = libscigraphic_objects_la-createGraphicObject.lo \
        libscigraphic_objects_la-FigureModel.lo \
        libscigraphic_objects_la-CurrentFigure.lo \
        libscigraphic_objects_la-CurrentObject.lo \
-       libscigraphic_objects_la-CurrentSubwin.lo
+       libscigraphic_objects_la-CurrentSubwin.lo \
+       libscigraphic_objects_la-Texture.lo
 am_libscigraphic_objects_la_OBJECTS = $(am__objects_2) \
        $(am__objects_3) $(am__objects_4)
 libscigraphic_objects_la_OBJECTS =  \
@@ -622,7 +623,8 @@ GRAPHIC_OBJECTS_CXX_SOURCES = src/cpp/createGraphicObject.cpp \
                                                                src/cpp/FigureModel.cpp \
                                                                src/cpp/CurrentFigure.cpp \
                                                                src/cpp/CurrentObject.cpp \
-                                                               src/cpp/CurrentSubwin.cpp
+                                                               src/cpp/CurrentSubwin.cpp \
+                                                               src/cpp/Texture.cpp
 
 GIWS_WRAPPERS = src/jni/graphic_objects.giws.xml
 libscigraphic_objects_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
@@ -774,6 +776,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-PolylineDecomposer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-ScilabNativeView_wrap.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-ScilabView.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-Texture.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-TriangleMeshData.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-TriangleMeshFecData.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-TriangleMeshFecDataDecomposer.Plo@am__quote@
@@ -1107,6 +1110,13 @@ libscigraphic_objects_la-CurrentSubwin.lo: src/cpp/CurrentSubwin.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_objects_la-CurrentSubwin.lo `test -f 'src/cpp/CurrentSubwin.cpp' || echo '$(srcdir)/'`src/cpp/CurrentSubwin.cpp
 
+libscigraphic_objects_la-Texture.lo: src/cpp/Texture.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_objects_la-Texture.lo -MD -MP -MF $(DEPDIR)/libscigraphic_objects_la-Texture.Tpo -c -o libscigraphic_objects_la-Texture.lo `test -f 'src/cpp/Texture.cpp' || echo '$(srcdir)/'`src/cpp/Texture.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_objects_la-Texture.Tpo $(DEPDIR)/libscigraphic_objects_la-Texture.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/Texture.cpp' object='libscigraphic_objects_la-Texture.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_objects_la-Texture.lo `test -f 'src/cpp/Texture.cpp' || echo '$(srcdir)/'`src/cpp/Texture.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index bdb1ef6..c8a9928 100644 (file)
 #ifndef COLORCOMPUTER_HXX
 #define COLORCOMPUTER_HXX
 
+#include  "DecompositionUtils.hxx"
+
+/**
+ * Offset passed to the getColor function for colors mapped to z values.
+ */
+#define Z_COLOR_OFFSET    0.5
+
+/**
+ * Offset passed to the getColor function for linearly mapped colors.
+ */
+#define COLOR_OFFSET      0.1
+
+/**
+ * Special color index values.
+ */
+enum SpecialColorIndexValues
+{
+    WHITE_LOWER_INDEX = -4,
+    BLACK_LOWER_INDEX = -3,
+    BLACK_UPPER_INDEX = 0
+};
+
+/**
+ * The minimum value of a single R, G or B component.
+ */
+#define MIN_COMPONENT_VALUE    0.0
+
+/**
+ * The maximum value of a single R, G or B component.
+ */
+#define MAX_COMPONENT_VALUE    1.0
+
+/**
+ * The index value corresponding to white.
+ */
+#define WHITE_INDEX    -2.0
+
+/**
+ * The index value corresponding to black.
+ */
+#define BLACK_INDEX    -1.0
+
+/**
+ * An offset used to center the color index when computing
+ * colormap texture coordinates.
+ */
+#define COLOR_TEXTURE_OFFSET    0.5
+
 /**
  * ColorComputer class
  * Various utility functions used to compute colors.
@@ -69,7 +117,47 @@ public :
      * @param[out] a pointer to the array into which the resulting color is output (its R, G, B components are written consecutively).
      * @param[in] a boolean to indicate if the color is clamped (by default true).
      */
-    static void getDirectColor(double s, double* colormap, int colormapSize, float* returnedColor, bool clamped = true);
+    template <typename T>
+    inline static void getDirectColor(T s, double* colormap, int colormapSize, float* returnedColor, bool clamped = true)
+    {
+        int index = 0;
+
+        if (s <= (T) BLACK_LOWER_INDEX)
+        {
+            /* Clamp to white */
+            returnedColor[0] = MAX_COMPONENT_VALUE;
+            returnedColor[1] = MAX_COMPONENT_VALUE;
+            returnedColor[2] = MAX_COMPONENT_VALUE;
+        }
+        else if ((((T) BLACK_LOWER_INDEX < s) && (s < (T) BLACK_UPPER_INDEX)) || !DecompositionUtils::isANumber(s))
+        {
+            /* Black is also output for Nan values */
+            returnedColor[0] = MIN_COMPONENT_VALUE;
+            returnedColor[1] = MIN_COMPONENT_VALUE;
+            returnedColor[2] = MIN_COMPONENT_VALUE;
+        }
+        else
+        {
+            if (s > (T)(colormapSize - 1))
+            {
+                if (clamped)
+                {
+                    s = (T) (colormapSize - 1);
+                }
+                else
+                {
+                    returnedColor[0] = -1;
+                    return;
+                }
+            }
+
+            index = (int) s;
+
+            returnedColor[0] = (float)colormap[index];
+            returnedColor[1] = (float)colormap[colormapSize + index];
+            returnedColor[2] = (float)colormap[2 * colormapSize + index];
+        }
+    }
 
     /**
      * Outputs an RGB color directly mapped to a scalar value s.
@@ -83,7 +171,22 @@ public :
      * @param[out] a pointer to the array into which the resulting color is output (its R, G, B components are written consecutively).
      * @param[in] a boolean to indicate if the color is clamped (by default true).
      */
-    static void getDirectByteColor(double s, double* colormap, int colormapSize, unsigned char* returnedColor, bool clamped = true);
+    template <typename T>
+    inline static void getDirectByteColor(T s, double* colormap, int colormapSize, unsigned char* returnedColor, bool clamped = true)
+    {
+        float color[3];
+        unsigned int * rc = (unsigned int *)returnedColor;
+        getDirectColor(s, colormap, colormapSize, color, clamped);
+
+        if (!clamped && color[0] == -1)
+        {
+            *rc = 0;
+        }
+        else
+        {
+            *rc = ((unsigned char)(color[0] * 255) << 24) | ((unsigned char)(color[1] * 255) << 16) | ((unsigned char)(color[2] * 255) << 8) | 0xFF;
+        }
+    }
 
     /**
      * Returns a colormap index from a scalar value s.
@@ -134,51 +237,5 @@ public :
     static double getIndex(double s, double smin, double srange, double indexOffset, int minIndex, int maxIndex);
 };
 
-/**
- * Offset passed to the getColor function for colors mapped to z values.
- */
-#define Z_COLOR_OFFSET    0.5
-
-/**
- * Offset passed to the getColor function for linearly mapped colors.
- */
-#define COLOR_OFFSET      0.1
-
-/**
- * Special color index values.
- */
-enum SpecialColorIndexValues
-{
-    WHITE_LOWER_INDEX = -4,
-    BLACK_LOWER_INDEX = -3,
-    BLACK_UPPER_INDEX = 0
-};
-
-/**
- * The minimum value of a single R, G or B component.
- */
-#define MIN_COMPONENT_VALUE    0.0
-
-/**
- * The maximum value of a single R, G or B component.
- */
-#define MAX_COMPONENT_VALUE    1.0
-
-/**
- * The index value corresponding to white.
- */
-#define WHITE_INDEX    -2.0
-
-/**
- * The index value corresponding to black.
- */
-#define BLACK_INDEX    -1.0
-
-/**
- * An offset used to center the color index when computing
- * colormap texture coordinates.
- */
-#define COLOR_TEXTURE_OFFSET    0.5
-
 #endif
 
index db006d1..eac662b 100644 (file)
@@ -18,128 +18,182 @@ extern "C"
 {
 #endif
 
-  /**
-   * Return the texture width for the given object.
-   * @param[in] the given object id.
-   * @return the texture width for the given object.
-   */
-  int getTextureWidth(char* id);
-
-  /**
-   * Return the texture height for the given object.
-   * @param[in] the given object id.
-   * @return the texture height for the given object.
-   */
-  int getTextureHeight(char* id);
-
-  /**
-   * Fill the given buffer with texture data.
-   * @param[in] the id of the object texture.
-   * @param[out] the buffer to fill.
-   * @param[in] the buffer length in number of elements.
-   * @return the length of writed data.
-   */
-  int fillTextureData(char *id, unsigned char* buffer, int bufferLength);
-
-  /**
-   * Fill the given buffer with sub-texture data.
-   * @param[in] the id of the object texture.
-   * @param[out] the buffer to fill.
-   * @param[in] the buffer length in number of elements.
-   * @param[in] the x-coordinate of the first pixel.
-   * @param[in] the y-coordinate of the first pixel.
-   * @param[in] the width of the sub-texture.
-   * @param[in] the length of the sub-texture.
-   * @return the length of writed data.
-   */
-  int fillSubTextureData(char* id, unsigned char* buffer, int bufferLength, int x, int y, int width, int height);
-
-  /**
-   * Return the number of data elements for the given object.
-   * @param[in] the given object id.
-   * @return the number of data elements.
-   */
-  int getDataSize(char* id);
-
-  /**
-   * Fill the given buffer with vertex data from the given object.
-   * @param[in] the id of the given object.
-   * @param[out] the buffer to fill.
-   * @param[in] the buffer length in number of elements.
-   * @param[in] the number of coordinate taken by one element in the buffer.
-   * @param[in] this byte mask specifies which coordinates are filled (1 for X, 2 for Y, 4 for Z).
-   * @param[in] the conversion scale factor to apply to data.
-   * @param[in] the conversion translation factor to apply to data.
-   * @param[in] the bit mask specifying whether logarithmic coordinates are used.
-   */
-  void fillVertices(char* id, float* buffer, int bufferLength, int elementsSize, int coordinateMask, double scale[], double translation[], int logMask);
-
-  /**
-   * Fill the given buffer with color data from the given object.
-   * @param[in] the id of the given object.
-   * @param[in] the buffer to fill.
-   * @param[in] the buffer length in number of elements.
-   * @param[in] the number of coordinate taken by one element in the buffer (3 for RGB, 4 for RGBA).
-   */
-  void fillColors(char* id, float* buffer, int bufferLength, int elementsSize);
-
-  /**
-   * Fill the given buffer with texture coordinates data from the given object.
-   * @param[in] the id of the given object.
-   * @param[in] the buffer to fill.
-   * @param[in] the buffer length in number of elements.
-   */
-  void fillTextureCoordinates(char* id, float* buffer, int bufferLength);
-
-  /**
-   * Return the number of indices for the given object.
-   * @param[in] the given object id.
-   * @return the object's number of indices.
-   */
-  int getIndicesSize(char* id);
-
-  /**
-   * Fill the given buffer with indices data of the given object.
-   * @param[in] the id of the given object.
-   * @param[out] the buffer to fill.
-   * @param[in] the buffer length.
-   * @param[in] the bit mask specifying whether logarithmic coordinates are used.
-   * @return the number of indices actually written.
-   */
-  int fillIndices(char* id, int* buffer, int bufferLength, int logMask);
-
-  /**
-   * Return the number of indices for the wire of the given object.
-   * @param[in] the given object id.
-   * @return the object's number of indices.
-   */
-  int getWireIndicesSize(char* id);
-
-  /**
-   * Fill the given buffer with wire indices data of the given object.
-   * @param[in] the id of the given object.
-   * @param[out] the buffer to fill.
-   * @param[in] the buffer length.
-   * @param[in] the bit mask specifying whether logarithmic coordinates are used.
-   * @return the number of indices actually written.
-   */
-  int fillWireIndices(char* id, int* buffer, int bufferLength, int logMask);
-
-  /**
-   * Return the number of mark indices of the given object.
-   * @param[in] the given object id.
-   * @return the number of mark indices.
-   */
-  int getMarkIndicesSize(char* id);
-
-  /**
-   * Fill the given buffer with mark indices data of the given object.
-   * @param[in] the id of the given object.
-   * @param[out] the buffer to fill.
-   * @param[in] the buffer length.
-   * @return the number of indices actually written.
-   */
-  int fillMarkIndices(char* id, int* buffer, int bufferLength);
+    typedef struct
+    {
+        void * address;
+        unsigned int size;
+    } JavaDirectBuffer;
+
+    /**
+     * Return the texture width for the given object.
+     * @param[in] the given object id.
+     * @return the texture width for the given object.
+     */
+    int getTextureWidth(char* id);
+
+    /**
+     * Return the texture height for the given object.
+     * @param[in] the given object id.
+     * @return the texture height for the given object.
+     */
+    int getTextureHeight(char* id);
+
+    /**
+     * Fill the given buffer with texture data.
+     * @param[in] the id of the object texture.
+     * @param[out] the buffer to fill.
+     * @param[in] the buffer length in number of elements.
+     * @return the length of writed data.
+     */
+    int fillTextureData(char *id, unsigned char* buffer, int bufferLength);
+
+    /**
+     * Fill the given buffer with sub-texture data.
+     * @param[in] the id of the object texture.
+     * @param[out] the buffer to fill.
+     * @param[in] the buffer length in number of elements.
+     * @param[in] the x-coordinate of the first pixel.
+     * @param[in] the y-coordinate of the first pixel.
+     * @param[in] the width of the sub-texture.
+     * @param[in] the length of the sub-texture.
+     * @return the length of writed data.
+     */
+    int fillSubTextureData(char* id, unsigned char* buffer, int bufferLength, int x, int y, int width, int height);
+
+    /**
+     * Return the number of data elements for the given object.
+     * @param[in] the given object id.
+     * @return the number of data elements.
+     */
+    int getDataSize(char* id);
+
+    /**
+     * Fill the given buffer with vertex data from the given object.
+     * @param[in] the id of the given object.
+     * @param[out] the buffer to fill.
+     * @param[in] the buffer length in number of elements.
+     * @param[in] the number of coordinate taken by one element in the buffer.
+     * @param[in] this byte mask specifies which coordinates are filled (1 for X, 2 for Y, 4 for Z).
+     * @param[in] the conversion scale factor to apply to data.
+     * @param[in] the conversion translation factor to apply to data.
+     * @param[in] the bit mask specifying whether logarithmic coordinates are used.
+     */
+    void fillVertices(char* id, float* buffer, int bufferLength, int elementsSize, int coordinateMask, double scale[], double translation[], int logMask);
+
+    /**
+     * Fill the given buffer with color data from the given object.
+     * @param[in] the id of the given object.
+     * @param[in] the buffer to fill.
+     * @param[in] the buffer length in number of elements.
+     * @param[in] the number of coordinate taken by one element in the buffer (3 for RGB, 4 for RGBA).
+     */
+    void fillColors(char* id, float* buffer, int bufferLength, int elementsSize);
+
+    /**
+     * Fill the given buffer with texture coordinates data from the given object.
+     * @param[in] the id of the given object.
+     * @param[in] the buffer to fill.
+     * @param[in] the buffer length in number of elements.
+     */
+    void fillTextureCoordinates(char* id, float* buffer, int bufferLength);
+
+    /**
+     * Return the number of indices for the given object.
+     * @param[in] the given object id.
+     * @return the object's number of indices.
+     */
+    int getIndicesSize(char* id);
+
+    /**
+     * Fill the given buffer with indices data of the given object.
+     * @param[in] the id of the given object.
+     * @param[out] the buffer to fill.
+     * @param[in] the buffer length.
+     * @param[in] the bit mask specifying whether logarithmic coordinates are used.
+     * @return the number of indices actually written.
+     */
+    int fillIndices(char* id, int* buffer, int bufferLength, int logMask);
+
+    /**
+     * Return the number of indices for the wire of the given object.
+     * @param[in] the given object id.
+     * @return the object's number of indices.
+     */
+    int getWireIndicesSize(char* id);
+
+    /**
+     * Fill the given buffer with wire indices data of the given object.
+     * @param[in] the id of the given object.
+     * @param[out] the buffer to fill.
+     * @param[in] the buffer length.
+     * @param[in] the bit mask specifying whether logarithmic coordinates are used.
+     * @return the number of indices actually written.
+     */
+    int fillWireIndices(char* id, int* buffer, int bufferLength, int logMask);
+
+    /**
+     * Return the number of mark indices of the given object.
+     * @param[in] the given object id.
+     * @return the number of mark indices.
+     */
+    int getMarkIndicesSize(char* id);
+
+    /**
+     * Fill the given buffer with mark indices data of the given object.
+     * @param[in] the id of the given object.
+     * @param[out] the buffer to fill.
+     * @param[in] the buffer length.
+     * @return the number of indices actually written.
+     */
+    int fillMarkIndices(char* id, int* buffer, int bufferLength);
+
+    /**
+     * Get texture data of the given object.
+     * @param[in] the id of the given object.
+     * @return a JavaDirectBuffer struct which will be converted into a java.nio.ByteBuffer.
+     */
+    JavaDirectBuffer getTextureData(char * id);
+
+    /**
+     * Get texture image type of the given object.
+     * @param[in] id the id of the given object.
+     * @return the image type.
+     */
+    int getTextureImageType(char * id);
+
+    /**
+     * Get the Scilab data type associated with the texture of the given object.
+     * @param[in] id the id of the given object.
+     * @return the image type (0 for RGB, 1 for RGBA, 2 for GRAY).
+     */
+    int getTextureDataType(char * id);
+
+    /**
+     * Get texture OpenGL type of the given object.
+     * @param[in] id the id of the given object.
+     * @return the OpenGL type.
+     */
+    int getTextureGLType(char * id);
+
+    /**
+     * Dispose texture data of the given object.
+     * @param[in] id the id of the given object.
+     * @param[in] buffer the address of the buffer to dipose.
+     */
+    void disposeTextureData(char * id, unsigned char * buffer);
+
+    /**
+     * Dispose texture data of the given object.
+     * @param[in] id the id of the given object.
+     * @return 1 if the texture is ROW_MAJOR_ORDER
+     */
+    int isTextureRowOrder(char * id);
+
+    /**
+     * Set tha availability of the ABGR extension
+     * @param[in] isAvailable 0 if it is not available
+     */
+    void setABGRExt(int isAvailable);
 
 #ifdef __cplusplus
 } //extern "C"
index c5edd94..b934273 100644 (file)
 
 #define MATPLOT_BOUNDS          30
 #define MATPLOT_TYPE            31
+#define MATPLOT_VIDEO_MODE      32
+#define MATPLOT_GL_TYPE         33
+#define MATPLOT_DATA_INFOS      34
+#define MATPLOT_DATA_TYPE       35
+#define MATPLOT_DATA_ORDER      36
+#define MATPLOT_IMAGE_TYPE      37
+#define MATPLOT_IMAGE_DATA      38
+#define MATPLOT_IMAGE_DATASIZE  39
 
 #endif
index 1fb9d0f..13a5c69 100644 (file)
@@ -31,6 +31,36 @@ public :
      */
     static int isANumber(double x);
 
+    static int isANumber(int x)
+    {
+        return 1;
+    }
+
+    static int isANumber(unsigned int x)
+    {
+        return 1;
+    }
+
+    static int isANumber(char x)
+    {
+        return 1;
+    }
+
+    static int isANumber(unsigned char x)
+    {
+        return 1;
+    }
+
+    static int isANumber(short x)
+    {
+        return 1;
+    }
+
+    static int isANumber(unsigned short x)
+    {
+        return 1;
+    }
+
     /**
      * Tests whether a scalar value is finite.
      * @param[in] the scalar value to test.
@@ -59,7 +89,7 @@ public :
     /**
      * Returns the base-10 logarithm of the input value.
      * @param[in] the input value.
-     * @return the base-10 logarithm of the input value. 
+     * @return the base-10 logarithm of the input value.
      */
     static double getLog10Value(double value);
 
index cf9efba..7c9b209 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  *  Copyright (C) 2011-2012 - DIGITEO - Pierre Lando
+ *  Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
  *
  *  This file must be used under the terms of the CeCILL.
  *  This source file is licensed as described in the file COPYING, which
 class MatPlotDecomposer
 {
 public:
-  static int getTextureWidth(char* id);
-  static int getTextureHeight(char* id);
-  static int fillTextureData(char* id, unsigned char* buffer, int bufferLength);
-  static int fillTextureData(char* id, unsigned char* buffer, int bufferLength, int x, int y, int width, int height);
+    static int getTextureWidth(char* id);
+    static int getTextureHeight(char* id);
+    static int fillTextureData(char* id, unsigned char* buffer, int bufferLength);
+    static int fillTextureData(char* id, unsigned char* buffer, int bufferLength, int x, int y, int width, int height);
+    static int getTextureData(char* id, void ** address, unsigned int * size);
+    static void disposeTextureData(char * id, unsigned char * buffer);
+    static int getTextureImageType(char * id);
+    static int getTextureDataType(char * id);
+    static int getTextureGLType(char * id);
+    static int isTextureRowOrder(char * id);
 };
 
 #endif
diff --git a/scilab/modules/graphic_objects/includes/Matplot.h b/scilab/modules/graphic_objects/includes/Matplot.h
new file mode 100644 (file)
index 0000000..e2ee3ad
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef MATPLOT_H
+#define MATPLOT_H
+
+typedef enum
+{
+    MATPLOT_HM1_Char = 0,
+    MATPLOT_HM1_UChar = 1,
+    MATPLOT_HM1_Double = 2,
+    MATPLOT_HM3_Char = 3,
+    MATPLOT_HM3_UChar = 4,
+    MATPLOT_HM3_Double = 5,
+    MATPLOT_HM4_Char = 6,
+    MATPLOT_HM4_UChar = 7,
+    MATPLOT_HM4_Double = 8,
+    MATPLOT_Char = 9,
+    MATPLOT_UChar = 10,
+    MATPLOT_Int = 11,
+    MATPLOT_UInt = 12,
+    MATPLOT_Short = 13,
+    MATPLOT_UShort = 14,
+    MATPLOT_Double = 15
+} DataType;
+
+typedef enum
+{
+    MATPLOT_FORTRAN = 0,
+    MATPLOT_C = 1
+} DataOrder;
+
+typedef enum
+{
+    MATPLOT_NONE = -1,
+    MATPLOT_RGB = 0,
+    MATPLOT_RGBA = 1,
+    MATPLOT_GRAY = 2,
+    MATPLOT_INDEX = 3,
+    MATPLOT_RED = 4,
+    MATPLOT_GREEN = 5,
+    MATPLOT_BLUE = 6,
+    MATPLOT_RGB_332 = 7,
+    MATPLOT_RGB_444 = 8,
+    MATPLOT_RGB_555 = 9,
+    MATPLOT_RGBA_4444 = 10,
+    MATPLOT_RGBA_5551 = 11
+} ImageType;
+
+typedef enum
+{
+    MATPLOT_GL_RGB = 0,
+    MATPLOT_GL_RGB_RGBA = 1,
+    MATPLOT_GL_BGR = 2,
+    MATPLOT_GL_GRAY = 3,
+    MATPLOT_GL_GRAY_16 = 4,
+    MATPLOT_GL_RGBA = 5,
+    MATPLOT_GL_RGBA_REV = 6,
+    MATPLOT_GL_ABGR = 7,
+    MATPLOT_GL_RGB_332 = 8,
+    MATPLOT_GL_RED = 9,
+    MATPLOT_GL_GREEN = 10,
+    MATPLOT_GL_BLUE = 11,
+    MATPLOT_GL_INTENSITY = 12,
+    MATPLOT_GL_RGBA_4444 = 13,
+    MATPLOT_GL_RGBA_5551 = 14,
+    MATPLOT_GL_RGB_FLOAT = 15,
+    MATPLOT_GL_RGBA_FLOAT = 16,
+    MATPLOT_GL_GRAY_FLOAT = 17,
+    MATPLOT_GL_RED_16 = 18,
+    MATPLOT_GL_GREEN_16 = 19,
+    MATPLOT_GL_BLUE_16 = 20,
+    MATPLOT_GL_RED_FLOAT = 21,
+    MATPLOT_GL_GREEN_FLOAT = 22,
+    MATPLOT_GL_BLUE_FLOAT = 23,
+    MATPLOT_GL_RGBA_BYTE = 24
+} GLType;
+
+/**
+ * Build an integer which contains the given info
+ * @param[in] datatype the data type
+ * @param[in] dataorder the data order
+ * @param[in] imagetype the image type
+ * @return an int
+ */
+int buildMatplotType(DataType datatype, DataOrder dataorder, ImageType imagetype);
+
+#endif // MATPLOT_H
index 5e738e6..827fd5d 100644 (file)
@@ -57,7 +57,7 @@ protected :
      * @param[in] the grid's number of vertices along the y-axis.
      */
     virtual void fillGridVertices(float* buffer, int bufferLength, int elementsSize, int coordinateMask, double* scale, double* translation, int logMask,
-        double* x, double* y, double* z, int numX, int numY);
+                                  double* x, double* y, double* z, int numX, int numY);
 
     /**
      * Fills a buffer with color data from a grid.
@@ -72,7 +72,7 @@ protected :
      * @param[in] the grid's number of vertices along the y-axis.
      */
     void fillNormalizedZGridColors(float* buffer, int bufferLength, int elementsSize, double* colormap, int colormapSize,
-        double* z, int numX, int numY);
+                                   double* z, int numX, int numY);
 
     /**
      * Fills a buffer with color data from a grid.
@@ -87,7 +87,7 @@ protected :
      * @param[in] the grid's number of vertices along the y-axis.
      */
     void fillDirectGridColors(float* buffer, int bufferLength, int elementsSize, double* colormap, int colormapSize,
-        double* z, int numX, int numY);
+                              double* z, int numX, int numY);
 
     /**
      * Returns the coordinates of the (i,j) facet's four vertices, where (i,j) is the facet's
@@ -102,7 +102,7 @@ protected :
      * @param[out] the facet's vertices (4 (x,y,z) triplets).
      */
     void getFacetCoordinates(double* x, double* y, double* z, int numX, int numY, int i, int j,
-        double vertices[4][3]);
+                             double vertices[4][3]);
 
     /**
      * Returns the z-coordinate of the (i,j) grid point.
@@ -156,7 +156,7 @@ protected :
      * @return the number of indices actually written.
      */
     int fillTriangleIndices(int* buffer, int bufferLength, int logMask, double* x, double* y, double* z, double* values, int perNodeValues,
-        int numX, int numY);
+                            int numX, int numY);
 
     /**
      * Decomposes facet (i,j) into triangles and outputs the resulting vertex indices, where (i,j) is
@@ -173,7 +173,7 @@ protected :
      * @param[out] the triangles' indices (6-element array: two consecutive triplets).
      */
     virtual void getFacetTriangles(double* x, double* y, double* z, int numX, int numY, int i, int j,
-        int* facetVertexIndices, int* triangleVertexIndices);
+                                   int* facetVertexIndices, int* triangleVertexIndices);
 
     /**
      * Determines whether a facet is valid.
@@ -251,7 +251,7 @@ protected :
      * @param[in] the facet color (3 or 4-element array).
      * @param[in] the number of components taken by a color element (3 or 4).
      */
-    static void writeFacetColorToBuffer(float* buffer, int bufferOffset, float* color, int elementsSize);
+    static void writeFacetColorToBuffer(float* buffer, int bufferOffset, float* color, int elementsSize, bool hasTransparency = false);
 
     /**
      * Returns the index of a facet's first vertex (its lower-left corner).
index 1542c4a..c87cd96 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  *  Copyright (C) 2011-2012 - DIGITEO - Manuel Juliachs
+ *  Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
  *
  *  This file must be used under the terms of the CeCILL.
  *  This source file is licensed as described in the file COPYING, which
@@ -19,6 +20,7 @@
 
 extern "C" {
 #include "BOOL.h"
+#include "Matplot.h"
 }
 
 /**
@@ -31,6 +33,7 @@ extern "C" {
 
 class NgonGridMatplotData : public NgonGridData
 {
+
 private :
 
     /** The 2D bounding rectangle {xmin, xmax, ymin, ymax} */
@@ -42,6 +45,16 @@ private :
      * or computed using the 2D bounding rectangle (1)
      */
     int type;
+    ImageType imagetype;
+    DataType datatype;
+    GLType gltype;
+    DataOrder dataorder;
+    void * data;
+    void * scilabData;
+    unsigned int dataSize;
+
+    static const bool isLittleEndian;
+    static bool isABGRSupported;
 
 protected :
 
@@ -122,6 +135,90 @@ public :
     int getType(void);
 
     /**
+     * Set the info about data
+     * @param[in] data info built with buildMatplotType
+     */
+    void setDataInfos(int datainfos);
+
+    /**
+     * Get the info about data
+     * @return the info
+     */
+    int getDataInfos();
+
+    /**
+     * Get the OpenGL type
+     * @return the type
+     */
+    int getGLType();
+
+    /**
+     * Get the image type
+     * @return the type
+     */
+    int getImageType();
+
+    /**
+     * Set the image type
+     * @param[in] imagetype the image type
+     */
+    int setImageType(int imagetype);
+
+    /**
+     * Get the data order (MATPLOT_FORTRAN or MATPLOT_C corresponding to COLUMN_MAJOR_ORDER & ROW_MAJOR_ORDER)
+     * @return the order
+     */
+    int getDataOrder();
+
+    /**
+     * Set the data order (MATPLOT_FORTRAN or MATPLOT_C corresponding to COLUMN_MAJOR_ORDER & ROW_MAJOR_ORDER)
+     * @param[in] the order
+     */
+    void setDataOrder(int dataOrder);
+
+    /**
+     * Set the Scilab data type
+     * @param[in] datatype the Scilab data type
+     */
+    void setDataType(int datatype);
+
+    /**
+     * Get the Scilab data type
+     * @return the Scilab data type
+     */
+    int getDataType();
+
+    /**
+     * Set the image data
+     * @param[in] data the image data
+     * @param[in] numElements the number of elements
+     */
+    void setImageData(void const* data, const int numElements);
+
+    /**
+     * Get the image data
+     * @return the image data
+     */
+    void * getImageData();
+
+    /**
+     * Get the Scilab data
+     * @return the Scilab data
+     */
+    void * getScilabData();
+
+    /**
+     * Get the image data size
+     * @return the iamge data size
+     */
+    unsigned int getImageDataSize();
+
+    /**
+     * Dispose the texture data
+     */
+    void disposeTextureData();
+
+    /**
      * Sets the grid's z data
      * This method is almost identical to NgonGridData's own setDataZ method
      * the only difference being how the maximum number of elements is computed
@@ -130,6 +227,20 @@ public :
      * @param[in] numElements the number of elements to set
      */
     void setDataZ(double const* data, int numElements);
+
+    /**
+     * Set true if ABGR extension is supported
+     * @param[in] _isABGRSupported true if ABGR extension is supported
+     */
+    static void setABGRSupported(bool _isABGRSupported);
+
+private:
+
+    /**
+     * Init a boolean to true or false according to the endianess
+     */
+    static bool initEndian();
+
 };
 
 #endif
index b940360..d3e5087 100644 (file)
 #define NGONGRIDMATPLOTDATA_DECOMPOSER_HXX
 
 #include <string>
+#include "ColorComputer.hxx"
+
+extern "C"
+{
+#include "Matplot.h"
+}
 
 /**
  * NgonGridMatplotData decomposer class
@@ -51,7 +57,7 @@ protected :
      * @param[in] the grid's number of vertices along the y-axis.
      */
     virtual void fillGridVertices(float* buffer, int bufferLength, int elementsSize, int coordinateMask, double* scale, double* translation, int logMask,
-        double* x, double* y, double* z, int numX, int numY);
+                                  double* x, double* y, double* z, int numX, int numY);
 
     /**
      * Determines whether a facet is valid.
@@ -136,6 +142,27 @@ public :
      */
     static int fillIndices(char* id, int* buffer, int bufferLength, int logMask);
 
+    template <typename T>
+    inline static void fillColorsByIndex(T * indices, float * buffer, int elementsSize, const int nbRow, const int nbCol, double * colormap, const int colormapSize)
+    {
+        float facetColor[3];
+        T index;
+        int bufferOffset = 0;
+
+        for (unsigned int j = 0; j < nbRow; j++)
+        {
+            for (unsigned int i = 0; i < nbCol; i++)
+            {
+                index = indices[nbRow - 1 + i * nbRow - j];
+                ColorComputer::getDirectColor(index - 1, colormap, colormapSize, facetColor);
+                writeFacetColorToBuffer(buffer, bufferOffset, facetColor, elementsSize);
+                bufferOffset += 4 * elementsSize;
+            }
+        }
+    }
+
+    static void getRGBAData(ImageType imagetype, DataType datatype, GLType gltype, void * data, float * buffer, int elementsSize, const int nbRow, const int nbCol, double * colormap, const int colormapSize);
+
 };
 
 #endif
diff --git a/scilab/modules/graphic_objects/includes/Texture.hxx b/scilab/modules/graphic_objects/includes/Texture.hxx
new file mode 100644 (file)
index 0000000..04dacc5
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef TEXTURE_HXX
+#define TEXTURE_HXX
+
+extern "C" {
+#include "Matplot.h"
+}
+
+/**
+ *
+ */
+
+class Texture
+{
+
+private :
+
+    static float GrayR[256];
+    static float GrayG[256];
+    static float GrayB[256];
+    static unsigned char RGB8R[256];
+    static unsigned char RGB8G[256];
+    static unsigned char RGB8B[256];
+    static unsigned char R12[256];
+    static const bool isGrayTableInit;
+    static const bool isRGB8TableInit;
+    static const bool isR12TableInit;
+
+public :
+
+    /**
+     * Get a texture from data
+     * @param[in] data Scilab data to convert to an OpenGL texture
+     * @param[in] numElements the number of elements
+     * @param[in] datatype the type of the data
+     * @param[in] the expected image type
+     * @param[out] dest the destination pointer. If its size must be modified, then *dest is allocated.
+     * @param[out] the texture size
+     * @param[out] gltype the OpenGL data type
+     * @return true if *dest has been allocated.
+     */
+    static bool getImage(void const * data, const int numElements, const DataType datatype, const ImageType imagetype, void ** dest, unsigned int * datatSize, GLType * gltype);
+
+private:
+    static bool initGrayTables();
+    static bool initRGB8Tables();
+    static bool initR12Table();
+};
+
+#endif // TEXTURE_HXX
index 9d51860..0d603df 100644 (file)
 #ifndef  __GRAPHIC_OBJECT_PROPERTIES_H__
 #define __GRAPHIC_OBJECT_PROPERTIES_H__
 
-#define __GO_ARC__                         1
-#define __GO_AXES__                        2
-#define __GO_AXESMODEL__                   3
-#define __GO_AXIS__                        4
-#define __GO_CHAMP__                       5
-#define __GO_COMPOUND__                    6
-#define __GO_FAC3D__                       7
-#define __GO_FEC__                         8
-#define __GO_FIGURE__                      9
-#define __GO_FIGUREMODEL__                 10
-#define __GO_GRAYPLOT__                    11
-#define __GO_LABEL__                       12
-#define __GO_LEGEND__                      13
-#define __GO_MATPLOT__                     14
-#define __GO_PLOT3D__                      15
-#define __GO_POLYLINE__                    16
-#define __GO_RECTANGLE__                   17
-#define __GO_SEGS__                        18
-#define __GO_TEXT__                        19
-#define __GO_UICONTROL__                   20
-#define __GO_UIMENU__                      21
-#define __GO_UICONTEXTMENU__               22
-
-#define __GO_CHILDREN__                    23
-#define __GO_CHILDREN_COUNT__              24
-#define __GO_PARENT__                      25
-#define __GO_USER_DATA__                   26
-#define __GO_USER_DATA_SIZE__              27
-#define __GO_VISIBLE__                     28
-#define __GO_HIDDEN__                      29
-#define __GO_TYPE__                        30
-#define __GO_DATA_MODEL__                  31
-#define __GO_PARENT_FIGURE__               32
-#define __GO_PARENT_AXES__                 33
-#define __GO_HAS_LEGEND_CHILD__            34
-#define __GO_LEGEND_CHILD__                35
-#define __GO_SELECTED_CHILD__              36
-#define __GO_CALLBACK__                    37
-#define __GO_CALLBACKTYPE__                38
-
-#define __GO_DATA_MODEL_COORDINATES__      39
-#define __GO_DATA_MODEL_X__                40
-#define __GO_DATA_MODEL_Y__                41
-#define __GO_DATA_MODEL_Z__                42
-
-#define __GO_DATA_MODEL_X_COORDINATES_SHIFT__          43
-#define __GO_DATA_MODEL_Y_COORDINATES_SHIFT__          44
-#define __GO_DATA_MODEL_Z_COORDINATES_SHIFT__          45
-
-#define __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__      46
-#define __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__      47
-#define __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__      48
-
-#define __GO_DATA_MODEL_NUM_ELEMENTS__                 49
-#define __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__           50
-#define __GO_DATA_MODEL_NUM_VERTICES_PER_GON__         51
-#define __GO_DATA_MODEL_NUM_GONS__                     52
-
-#define __GO_DATA_MODEL_Z_COORDINATES_SET__            53
-
-#define __GO_DATA_MODEL_COLORS__                       54
-#define __GO_DATA_MODEL_NUM_COLORS__                   55
-
-#define __GO_DATA_MODEL_NUM_VERTICES__                 56
-#define __GO_DATA_MODEL_NUM_INDICES__                  57
-#define __GO_DATA_MODEL_INDICES__                      58
-#define __GO_DATA_MODEL_VALUES__                       59
-
-#define __GO_DATA_MODEL_FEC_TRIANGLES__                60
-
-#define __GO_DATA_MODEL_NUM_X__                        61
-#define __GO_DATA_MODEL_NUM_Y__                        62
-#define __GO_DATA_MODEL_NUM_Z__                        63
-#define __GO_DATA_MODEL_GRID_SIZE__                    64
-#define __GO_DATA_MODEL_X_DIMENSIONS__                 65
-#define __GO_DATA_MODEL_Y_DIMENSIONS__                 66
-
-#define __GO_MATPLOT_TRANSLATE__                       67
-#define __GO_MATPLOT_SCALE__                           68
-#define __GO_DATA_MODEL_MATPLOT_BOUNDS__               69
-#define __GO_DATA_MODEL_MATPLOT_TYPE__                 70
-
-#define __GO_REFERENCED__                  71
-#define __GO_VALID__                       72
-
-#define __GO_POSITION__                    73
-#define __GO_SIZE__                        74
-#define __GO_CANVAS__                      75
-#define __GO_AUTORESIZE__                  76
-#define __GO_VIEWPORT__                    77
-#define __GO_AXES_SIZE__                   78
-#define __GO_FIGURE_NAME__                 79
-#define __GO_NAME__                        80
-#define __GO_ID__                          81
-#define __GO_INFO_MESSAGE__                82
-#define __GO_COLORMAP__                    83
-#define __GO_COLORMAP_SIZE__               84
-#define __GO_RENDERING_MODE__              85
-#define __GO_PIXMAP__                      86
-#define __GO_PIXEL_DRAWING_MODE__          87
-#define __GO_ANTIALIASING__                88
-#define __GO_IMMEDIATE_DRAWING__           89
-#define __GO_BACKGROUND__                  90
-#define __GO_EVENTHANDLER__                91
-#define __GO_EVENTHANDLER_NAME__           92
-#define __GO_EVENTHANDLER_ENABLE__         93
-#define __GO_TAG__                         94
-#define __GO_ROTATION_TYPE__               95
-#define __GO_RESIZEFCN__                   96
-#define __GO_CLOSEREQUESTFCN__             97
-
-#define __GO_UPPER_LEFT_POINT__            98
-#define __GO_WIDTH__                       99
-#define __GO_HEIGHT__                      100
-#define __GO_START_ANGLE__                 101
-#define __GO_END_ANGLE__                   102
-#define __GO_ARC_DRAWING_METHOD__          103
-
-#define __GO_X_AXIS_VISIBLE__              104
-#define __GO_X_AXIS_REVERSE__              105
-#define __GO_X_AXIS_GRID_COLOR__           106
-#define __GO_X_AXIS_LABEL__                107
-#define __GO_X_AXIS_LOCATION__                 108
-#define __GO_X_AXIS_LOG_FLAG__             109
-#define __GO_X_AXIS_TICKS__                            110
-#define __GO_X_AXIS_AUTO_TICKS__               111
-#define __GO_X_AXIS_NUMBER_TICKS__             112
-#define __GO_X_AXIS_TICKS_LOCATIONS__      113
-#define __GO_X_AXIS_TICKS_LABELS__         114
-#define __GO_X_AXIS_SUBTICKS__             115
-
-#define __GO_Y_AXIS_VISIBLE__              116
-#define __GO_Y_AXIS_REVERSE__              117
-#define __GO_Y_AXIS_GRID_COLOR__           118
-#define __GO_Y_AXIS_LABEL__                119
-#define __GO_Y_AXIS_LOCATION__                 120
-#define __GO_Y_AXIS_LOG_FLAG__             121
-#define __GO_Y_AXIS_TICKS__                            122
-#define __GO_Y_AXIS_AUTO_TICKS__               123
-#define __GO_Y_AXIS_NUMBER_TICKS__             124
-#define __GO_Y_AXIS_TICKS_LOCATIONS__      125
-#define __GO_Y_AXIS_TICKS_LABELS__         126
-#define __GO_Y_AXIS_SUBTICKS__             127
-
-#define __GO_Z_AXIS_VISIBLE__              128
-#define __GO_Z_AXIS_REVERSE__              129
-#define __GO_Z_AXIS_GRID_COLOR__           130
-#define __GO_Z_AXIS_LABEL__                131
-#define __GO_Z_AXIS_LOCATION__                 132
-#define __GO_Z_AXIS_LOG_FLAG__             133
-#define __GO_Z_AXIS_TICKS__                            134
-#define __GO_Z_AXIS_AUTO_TICKS__               135
-#define __GO_Z_AXIS_NUMBER_TICKS__             136
-#define __GO_Z_AXIS_TICKS_LOCATIONS__      137
-#define __GO_Z_AXIS_TICKS_LABELS__         138
-#define __GO_Z_AXIS_SUBTICKS__             139
-
-#define __GO_AUTO_SUBTICKS__               140
-
-#define __GO_GRID_POSITION__               141
-#define __GO_TITLE__                       142
-#define __GO_AUTO_CLEAR__                  143
-#define __GO_FILLED__                      144
-#define __GO_CAMERA__                      145
-#define __GO_VIEW__                        146
-#define __GO_ISOVIEW__                     147
-#define __GO_CUBE_SCALING__                148
-#define __GO_ROTATION_ANGLES__             149
-#define __GO_ROTATION_ANGLES_3D__          150
-#define __GO_BOX_TYPE__                    151
-#define __GO_HIDDEN_AXIS_COLOR__           152
-#define __GO_TIGHT_LIMITS__                153
-#define __GO_DATA_BOUNDS__                 154
-#define __GO_REAL_DATA_BOUNDS__            155
-#define __GO_ZOOM_ENABLED__                156
-#define __GO_ZOOM_BOX__                    157
-#define __GO_AUTO_SCALE__                  158
-#define __GO_FIRST_PLOT__                  159
-#define __GO_MARGINS__                     160
-#define __GO_AXES_BOUNDS__                 161
-
-#define __GO_CLIP_PROPERTY__               162
-#define __GO_CLIP_STATE__                  163
-#define __GO_CLIP_BOX__                    164
-#define __GO_CLIP_BOX_SET__                165
-
-#define __GO_LINE__                        166
-#define __GO_LINE_MODE__                   167
-#define __GO_LINE_STYLE__                  168
-#define __GO_LINE_THICKNESS__              169
-#define __GO_LINE_COLOR__                  170
-#define __GO_FILL_MODE__                   171
-#define __GO_MARK__                        172
-#define __GO_MARK_MODE__                   173
-#define __GO_MARK_STYLE__                  174
-#define __GO_MARK_SIZE_UNIT__              175
-#define __GO_MARK_SIZE__                   176
-#define __GO_MARK_FOREGROUND__             177
-#define __GO_MARK_BACKGROUND__             178
-
-#define __GO_TICKS_DIRECTION__             179
-#define __GO_X_NUMBER_TICKS__              180
-#define __GO_Y_NUMBER_TICKS__              181
-#define __GO_X_TICKS_COORDS__              182
-#define __GO_Y_TICKS_COORDS__              183
-#define __GO_TICKS_COLOR__                 184
-#define __GO_TICKS_SEGMENT__               185
-#define __GO_TICKS_STYLE__                 186
-#define __GO_SUBTICKS__                    187
-#define __GO_NUMBER_TICKS_LABELS__         188
-#define __GO_TICKS_LABELS__                189
-#define __GO_FORMATN__                     190
-#define __GO_FONT__                        191
-#define __GO_FONT_STYLE__                  192
-#define __GO_FONT_SIZE__                   193
-#define __GO_FONT_COLOR__                  194
-#define __GO_FONT_FRACTIONAL__             195
-
-#define __GO_Z_BOUNDS__                    196
-#define __GO_OUTSIDE_COLOR__               197
-#define __GO_COLOR_RANGE__                 198
-
-#define __GO_DATA_MAPPING__                199
-
-#define __GO_FONT_ANGLE__                  200
-#define __GO_AUTO_POSITION__               201
-#define __GO_CORNERS__                     202
-#define __GO_AUTO_ROTATION__               203
-
-#define __GO_LINKS__                       204
-#define __GO_LINKS_COUNT__                 205
-#define __GO_LEGEND_LOCATION__             206
-
-#define __GO_CLOSED__                      207
-#define __GO_ARROW_SIZE_FACTOR__           208
-#define __GO_POLYLINE_STYLE__              209
-#define __GO_INTERP_COLOR_VECTOR__         210
-#define __GO_INTERP_COLOR_VECTOR_SET__         211
-#define __GO_INTERP_COLOR_MODE__           212
-#define __GO_X_SHIFT__                     213
-#define __GO_Y_SHIFT__                     214
-#define __GO_Z_SHIFT__                     215
-#define __GO_BAR_WIDTH__                   216
-
-#define __GO_SURFACE_MODE__                217
-#define __GO_COLOR_MODE__                  218
-#define __GO_COLOR_FLAG__                  219
-
-#define __GO_ALIGNMENT__                   220
-#define __GO_BOX__                         221
-#define __GO_TEXT_BOX__                    222
-#define __GO_TEXT_BOX_MODE__               223
-#define __GO_AUTO_DIMENSIONING__           224
-
-#define __GO_FORMATTED_TEXT__              225
-#define __GO_TEXT_ARRAY_DIMENSIONS__       226
-#define __GO_TEXT_STRINGS__                227
-
-#define __GO_BASE__                        228
-#define __GO_BASE_X__                      229
-#define __GO_BASE_Y__                      230
-#define __GO_BASE_Z__                      231
-#define __GO_DIRECTION__                   232
-#define __GO_DIRECTION_X__                 233
-#define __GO_DIRECTION_Y__                 234
-#define __GO_DIRECTION_Z__                 235
-#define __GO_ARROW_SIZE__                  236
-#define __GO_SEGS_COLORS__                 237
-
-#define __GO_COLORED__                     238
-
-#define __GO_ARROWS__                      239
-#define __GO_NUMBER_ARROWS__               240
-#define __GO_CHAMP_DIMENSIONS__            241
-#define __GO_BOUNDING_BOX__                242
-#define __GO_MAX_LENGTH__                  243
-#define __GO_MAX_USABLE_LENGTH__           244
-
-#define __GO_HIDDEN_COLOR__                245
-
-#define __GO_STYLE__                       246
-#define __GO_UI_CHECKBOX__                 247
-#define __GO_UI_EDIT__                     248
-#define __GO_UI_FRAME__                    249
-#define __GO_UI_IMAGE__                    250
-#define __GO_UI_LISTBOX__                  251
-#define __GO_UI_POPUPMENU__                252
-#define __GO_UI_PUSHBUTTON__               253
-#define __GO_UI_RADIOBUTTON__              254
-#define __GO_UI_SLIDER__                   255
-#define __GO_UI_TABLE__                    256
-#define __GO_UI_TEXT__                     257
-
-#define __GO_UI_BACKGROUNDCOLOR__          258
-#define __GO_UI_ENABLE__                   259
-#define __GO_UI_FONTANGLE__                260
-#define __GO_UI_FONTNAME__                 261
-#define __GO_UI_FONTSIZE__                 262
-#define __GO_UI_FONTUNITS__                263
-#define __GO_UI_FONTWEIGHT__               264
-#define __GO_UI_FOREGROUNDCOLOR__          265
-#define __GO_UI_HORIZONTALALIGNMENT__      266
-#define __GO_UI_LISTBOXTOP__               267
-#define __GO_UI_LISTBOXTOP_SIZE__          268
-#define __GO_UI_MAX__                      269
-#define __GO_UI_MIN__                      270
-#define __GO_UI_RELIEF__                   271
-#define __GO_UI_STRING__                   272
-#define __GO_UI_STRING_SIZE__              273
-#define __GO_UI_STRING_COLNB__             274
-#define __GO_UI_TOOLTIPSTRING__            275
-#define __GO_UI_TOOLTIPSTRING_SIZE__       276
-#define __GO_UI_SLIDERSTEP__               277
-#define __GO_UI_UNITS__                    278
-#define __GO_UI_VALUE__                    279
-#define __GO_UI_VALUE_SIZE__               280
-#define __GO_UI_VERTICALALIGNMENT__        281
-
-#define __GO_UIPARENTMENU__                282
-#define __GO_UICHILDMENU__                 283
-#define __GO_UICHECKEDMENU__               284
-#define __GO_UI_CHECKED__                  285
-#define __GO_UI_LABEL__                    286
-#define __GO_UI_MNEMONIC__                 287
-#define __GO_UI_ACCELERATOR__              288
-#define __GO_UI_SEPARATOR__                289
-#define __GO_UI_ICON__                     290
-
-#define __GO_CONSOLE__                     291
-#define __GO_SHOWHIDDENHANDLES__           292
-
-#define __GO_WAITBAR__                     293
-#define __GO_PROGRESSIONBAR__              294
-#define __GO_UI_MESSAGE__                  295
-#define __GO_UI_MESSAGE_SIZE__             296
+#define __GO_ARC__ 0
+#define __GO_AXES__ 1
+#define __GO_AXESMODEL__ 2
+#define __GO_AXIS__ 3
+#define __GO_CHAMP__ 4
+#define __GO_COMPOUND__ 5
+#define __GO_FAC3D__ 6
+#define __GO_FEC__ 7
+#define __GO_FIGURE__ 8
+#define __GO_FIGUREMODEL__ 9
+#define __GO_GRAYPLOT__ 10
+#define __GO_LABEL__ 11
+#define __GO_LEGEND__ 12
+#define __GO_MATPLOT__ 13
+#define __GO_PLOT3D__ 14
+#define __GO_POLYLINE__ 15
+#define __GO_RECTANGLE__ 16
+#define __GO_SEGS__ 17
+#define __GO_TEXT__ 18
+#define __GO_UICONTROL__ 19
+#define __GO_UIMENU__ 20
+#define __GO_UICONTEXTMENU__ 21
+#define __GO_CHILDREN__ 22
+#define __GO_CHILDREN_COUNT__ 23
+#define __GO_PARENT__ 24
+#define __GO_USER_DATA__ 25
+#define __GO_USER_DATA_SIZE__ 26
+#define __GO_VISIBLE__ 27
+#define __GO_HIDDEN__ 28
+#define __GO_TYPE__ 29
+#define __GO_DATA_MODEL__ 30
+#define __GO_PARENT_FIGURE__ 31
+#define __GO_PARENT_AXES__ 32
+#define __GO_HAS_LEGEND_CHILD__ 33
+#define __GO_LEGEND_CHILD__ 34
+#define __GO_SELECTED_CHILD__ 35
+#define __GO_CALLBACK__ 36
+#define __GO_CALLBACKTYPE__ 37
+#define __GO_DATA_MODEL_COORDINATES__ 38
+#define __GO_DATA_MODEL_X__ 39
+#define __GO_DATA_MODEL_Y__ 40
+#define __GO_DATA_MODEL_Z__ 41
+#define __GO_DATA_MODEL_X_COORDINATES_SHIFT__ 42
+#define __GO_DATA_MODEL_Y_COORDINATES_SHIFT__ 43
+#define __GO_DATA_MODEL_Z_COORDINATES_SHIFT__ 44
+#define __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__ 45
+#define __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__ 46
+#define __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__ 47
+#define __GO_DATA_MODEL_NUM_ELEMENTS__ 48
+#define __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__ 49
+#define __GO_DATA_MODEL_NUM_VERTICES_PER_GON__ 50
+#define __GO_DATA_MODEL_NUM_GONS__ 51
+#define __GO_DATA_MODEL_Z_COORDINATES_SET__ 52
+#define __GO_DATA_MODEL_COLORS__ 53
+#define __GO_DATA_MODEL_NUM_COLORS__ 54
+#define __GO_DATA_MODEL_NUM_VERTICES__ 55
+#define __GO_DATA_MODEL_NUM_INDICES__ 56
+#define __GO_DATA_MODEL_INDICES__ 57
+#define __GO_DATA_MODEL_VALUES__ 58
+#define __GO_DATA_MODEL_FEC_TRIANGLES__ 59
+#define __GO_DATA_MODEL_NUM_X__ 60
+#define __GO_DATA_MODEL_NUM_Y__ 61
+#define __GO_DATA_MODEL_NUM_Z__ 62
+#define __GO_DATA_MODEL_GRID_SIZE__ 63
+#define __GO_DATA_MODEL_X_DIMENSIONS__ 64
+#define __GO_DATA_MODEL_Y_DIMENSIONS__ 65
+#define __GO_MATPLOT_TRANSLATE__ 66
+#define __GO_MATPLOT_SCALE__ 67
+#define __GO_DATA_MODEL_MATPLOT_BOUNDS__ 68
+#define __GO_DATA_MODEL_MATPLOT_TYPE__ 69
+#define __GO_DATA_MODEL_MATPLOT_GL_TYPE__ 70
+#define __GO_DATA_MODEL_MATPLOT_DATA_INFOS__ 71
+#define __GO_DATA_MODEL_MATPLOT_DATA_TYPE__ 72
+#define __GO_DATA_MODEL_MATPLOT_DATA_ORDER__ 73
+#define __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__ 74
+#define __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__ 75
+#define __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__ 76
+#define __GO_REFERENCED__ 77
+#define __GO_VALID__ 78
+#define __GO_POSITION__ 79
+#define __GO_SIZE__ 80
+#define __GO_CANVAS__ 81
+#define __GO_AUTORESIZE__ 82
+#define __GO_VIEWPORT__ 83
+#define __GO_AXES_SIZE__ 84
+#define __GO_FIGURE_NAME__ 85
+#define __GO_NAME__ 86
+#define __GO_ID__ 87
+#define __GO_INFO_MESSAGE__ 88
+#define __GO_COLORMAP__ 89
+#define __GO_COLORMAP_SIZE__ 90
+#define __GO_RENDERING_MODE__ 91
+#define __GO_PIXMAP__ 92
+#define __GO_PIXEL_DRAWING_MODE__ 93
+#define __GO_ANTIALIASING__ 94
+#define __GO_IMMEDIATE_DRAWING__ 95
+#define __GO_BACKGROUND__ 96
+#define __GO_EVENTHANDLER__ 97
+#define __GO_EVENTHANDLER_NAME__ 98
+#define __GO_EVENTHANDLER_ENABLE__ 99
+#define __GO_TAG__ 100
+#define __GO_ROTATION_TYPE__ 101
+#define __GO_RESIZEFCN__ 102
+#define __GO_CLOSEREQUESTFCN__ 103
+#define __GO_UPPER_LEFT_POINT__ 104
+#define __GO_WIDTH__ 105
+#define __GO_HEIGHT__ 106
+#define __GO_START_ANGLE__ 107
+#define __GO_END_ANGLE__ 108
+#define __GO_ARC_DRAWING_METHOD__ 109
+#define __GO_X_AXIS_VISIBLE__ 110
+#define __GO_X_AXIS_REVERSE__ 111
+#define __GO_X_AXIS_GRID_COLOR__ 112
+#define __GO_X_AXIS_LABEL__ 113
+#define __GO_X_AXIS_LOCATION__ 114
+#define __GO_X_AXIS_LOG_FLAG__ 115
+#define __GO_X_AXIS_TICKS__ 116
+#define __GO_X_AXIS_AUTO_TICKS__ 117
+#define __GO_X_AXIS_NUMBER_TICKS__ 118
+#define __GO_X_AXIS_TICKS_LOCATIONS__ 119
+#define __GO_X_AXIS_TICKS_LABELS__ 120
+#define __GO_X_AXIS_SUBTICKS__ 121
+#define __GO_Y_AXIS_VISIBLE__ 122
+#define __GO_Y_AXIS_REVERSE__ 123
+#define __GO_Y_AXIS_GRID_COLOR__ 124
+#define __GO_Y_AXIS_LABEL__ 125
+#define __GO_Y_AXIS_LOCATION__ 126
+#define __GO_Y_AXIS_LOG_FLAG__ 127
+#define __GO_Y_AXIS_TICKS__ 128
+#define __GO_Y_AXIS_AUTO_TICKS__ 129
+#define __GO_Y_AXIS_NUMBER_TICKS__ 130
+#define __GO_Y_AXIS_TICKS_LOCATIONS__ 131
+#define __GO_Y_AXIS_TICKS_LABELS__ 132
+#define __GO_Y_AXIS_SUBTICKS__ 133
+#define __GO_Z_AXIS_VISIBLE__ 134
+#define __GO_Z_AXIS_REVERSE__ 135
+#define __GO_Z_AXIS_GRID_COLOR__ 136
+#define __GO_Z_AXIS_LABEL__ 137
+#define __GO_Z_AXIS_LOCATION__ 138
+#define __GO_Z_AXIS_LOG_FLAG__ 139
+#define __GO_Z_AXIS_TICKS__ 140
+#define __GO_Z_AXIS_AUTO_TICKS__ 141
+#define __GO_Z_AXIS_NUMBER_TICKS__ 142
+#define __GO_Z_AXIS_TICKS_LOCATIONS__ 143
+#define __GO_Z_AXIS_TICKS_LABELS__ 144
+#define __GO_Z_AXIS_SUBTICKS__ 145
+#define __GO_AUTO_SUBTICKS__ 146
+#define __GO_GRID_POSITION__ 147
+#define __GO_TITLE__ 148
+#define __GO_AUTO_CLEAR__ 149
+#define __GO_FILLED__ 150
+#define __GO_CAMERA__ 151
+#define __GO_VIEW__ 152
+#define __GO_ISOVIEW__ 153
+#define __GO_CUBE_SCALING__ 154
+#define __GO_ROTATION_ANGLES__ 155
+#define __GO_ROTATION_ANGLES_3D__ 156
+#define __GO_BOX_TYPE__ 157
+#define __GO_HIDDEN_AXIS_COLOR__ 158
+#define __GO_TIGHT_LIMITS__ 159
+#define __GO_DATA_BOUNDS__ 160
+#define __GO_REAL_DATA_BOUNDS__ 161
+#define __GO_ZOOM_ENABLED__ 162
+#define __GO_ZOOM_BOX__ 163
+#define __GO_AUTO_SCALE__ 164
+#define __GO_FIRST_PLOT__ 165
+#define __GO_MARGINS__ 166
+#define __GO_AXES_BOUNDS__ 167
+#define __GO_CLIP_PROPERTY__ 168
+#define __GO_CLIP_STATE__ 169
+#define __GO_CLIP_BOX__ 170
+#define __GO_CLIP_BOX_SET__ 171
+#define __GO_LINE__ 172
+#define __GO_LINE_MODE__ 173
+#define __GO_LINE_STYLE__ 174
+#define __GO_LINE_THICKNESS__ 175
+#define __GO_LINE_COLOR__ 176
+#define __GO_FILL_MODE__ 177
+#define __GO_MARK__ 178
+#define __GO_MARK_MODE__ 179
+#define __GO_MARK_STYLE__ 180
+#define __GO_MARK_SIZE_UNIT__ 181
+#define __GO_MARK_SIZE__ 182
+#define __GO_MARK_FOREGROUND__ 183
+#define __GO_MARK_BACKGROUND__ 184
+#define __GO_TICKS_DIRECTION__ 185
+#define __GO_X_NUMBER_TICKS__ 186
+#define __GO_Y_NUMBER_TICKS__ 187
+#define __GO_X_TICKS_COORDS__ 188
+#define __GO_Y_TICKS_COORDS__ 189
+#define __GO_TICKS_COLOR__ 190
+#define __GO_TICKS_SEGMENT__ 191
+#define __GO_TICKS_STYLE__ 192
+#define __GO_SUBTICKS__ 193
+#define __GO_NUMBER_TICKS_LABELS__ 194
+#define __GO_TICKS_LABELS__ 195
+#define __GO_FORMATN__ 196
+#define __GO_FONT__ 197
+#define __GO_FONT_STYLE__ 198
+#define __GO_FONT_SIZE__ 199
+#define __GO_FONT_COLOR__ 200
+#define __GO_FONT_FRACTIONAL__ 201
+#define __GO_Z_BOUNDS__ 202
+#define __GO_OUTSIDE_COLOR__ 203
+#define __GO_COLOR_RANGE__ 204
+#define __GO_DATA_MAPPING__ 205
+#define __GO_FONT_ANGLE__ 206
+#define __GO_AUTO_POSITION__ 207
+#define __GO_CORNERS__ 208
+#define __GO_AUTO_ROTATION__ 209
+#define __GO_LINKS__ 210
+#define __GO_LINKS_COUNT__ 211
+#define __GO_LEGEND_LOCATION__ 212
+#define __GO_CLOSED__ 213
+#define __GO_ARROW_SIZE_FACTOR__ 214
+#define __GO_POLYLINE_STYLE__ 215
+#define __GO_INTERP_COLOR_VECTOR__ 216
+#define __GO_INTERP_COLOR_VECTOR_SET__ 217
+#define __GO_INTERP_COLOR_MODE__ 218
+#define __GO_X_SHIFT__ 219
+#define __GO_Y_SHIFT__ 220
+#define __GO_Z_SHIFT__ 221
+#define __GO_BAR_WIDTH__ 222
+#define __GO_SURFACE_MODE__ 223
+#define __GO_COLOR_MODE__ 224
+#define __GO_COLOR_FLAG__ 225
+#define __GO_ALIGNMENT__ 226
+#define __GO_BOX__ 227
+#define __GO_TEXT_BOX__ 228
+#define __GO_TEXT_BOX_MODE__ 229
+#define __GO_AUTO_DIMENSIONING__ 230
+#define __GO_FORMATTED_TEXT__ 231
+#define __GO_TEXT_ARRAY_DIMENSIONS__ 232
+#define __GO_TEXT_STRINGS__ 233
+#define __GO_BASE__ 234
+#define __GO_BASE_X__ 235
+#define __GO_BASE_Y__ 236
+#define __GO_BASE_Z__ 237
+#define __GO_DIRECTION__ 238
+#define __GO_DIRECTION_X__ 239
+#define __GO_DIRECTION_Y__ 240
+#define __GO_DIRECTION_Z__ 241
+#define __GO_ARROW_SIZE__ 242
+#define __GO_SEGS_COLORS__ 243
+#define __GO_COLORED__ 244
+#define __GO_ARROWS__ 245
+#define __GO_NUMBER_ARROWS__ 246
+#define __GO_CHAMP_DIMENSIONS__ 247
+#define __GO_BOUNDING_BOX__ 248
+#define __GO_MAX_LENGTH__ 249
+#define __GO_MAX_USABLE_LENGTH__ 250
+#define __GO_HIDDEN_COLOR__ 251
+#define __GO_STYLE__ 252
+#define __GO_UI_CHECKBOX__ 253
+#define __GO_UI_EDIT__ 254
+#define __GO_UI_FRAME__ 255
+#define __GO_UI_IMAGE__ 256
+#define __GO_UI_LISTBOX__ 257
+#define __GO_UI_POPUPMENU__ 258
+#define __GO_UI_PUSHBUTTON__ 259
+#define __GO_UI_RADIOBUTTON__ 260
+#define __GO_UI_SLIDER__ 261
+#define __GO_UI_TABLE__ 262
+#define __GO_UI_TEXT__ 263
+#define __GO_UI_BACKGROUNDCOLOR__ 264
+#define __GO_UI_ENABLE__ 265
+#define __GO_UI_FONTANGLE__ 266
+#define __GO_UI_FONTNAME__ 267
+#define __GO_UI_FONTSIZE__ 268
+#define __GO_UI_FONTUNITS__ 269
+#define __GO_UI_FONTWEIGHT__ 270
+#define __GO_UI_FOREGROUNDCOLOR__ 271
+#define __GO_UI_HORIZONTALALIGNMENT__ 272
+#define __GO_UI_LISTBOXTOP__ 273
+#define __GO_UI_LISTBOXTOP_SIZE__ 274
+#define __GO_UI_MAX__ 275
+#define __GO_UI_MIN__ 276
+#define __GO_UI_RELIEF__ 277
+#define __GO_UI_STRING__ 278
+#define __GO_UI_STRING_SIZE__ 279
+#define __GO_UI_STRING_COLNB__ 280
+#define __GO_UI_TOOLTIPSTRING__ 281
+#define __GO_UI_TOOLTIPSTRING_SIZE__ 282
+#define __GO_UI_SLIDERSTEP__ 283
+#define __GO_UI_UNITS__ 284
+#define __GO_UI_VALUE__ 285
+#define __GO_UI_VALUE_SIZE__ 286
+#define __GO_UI_VERTICALALIGNMENT__ 287
+#define __GO_UIPARENTMENU__ 288
+#define __GO_UICHILDMENU__ 289
+#define __GO_UICHECKEDMENU__ 290
+#define __GO_UI_CHECKED__ 291
+#define __GO_UI_LABEL__ 292
+#define __GO_UI_MNEMONIC__ 293
+#define __GO_UI_ACCELERATOR__ 294
+#define __GO_UI_SEPARATOR__ 295
+#define __GO_UI_ICON__ 296
+#define __GO_CONSOLE__ 297
+#define __GO_SHOWHIDDENHANDLES__ 298
+#define __GO_WAITBAR__ 299
+#define __GO_PROGRESSIONBAR__ 300
+#define __GO_UI_MESSAGE__ 301
+#define __GO_UI_MESSAGE_SIZE__ 302
 
 #endif /* !__GRAPHIC_OBJECT_PROPERTIES_H__ */
index cad1d4a..70c97cf 100644 (file)
@@ -11,7 +11,6 @@
  */
 
 #include "ColorComputer.hxx"
-#include  "DecompositionUtils.hxx"
 
 extern "C"
 {
@@ -118,47 +117,6 @@ double ColorComputer::getIndex(double s, double smin, double srange, double inde
     return index;
 }
 
-void ColorComputer::getDirectColor(double s, double* colormap, int colormapSize, float* returnedColor, bool clamped)
-{
-    int index = 0;
-
-    if (s <= (double) BLACK_LOWER_INDEX)
-    {
-        /* Clamp to white */
-        returnedColor[0] = MAX_COMPONENT_VALUE;
-        returnedColor[1] = MAX_COMPONENT_VALUE;
-        returnedColor[2] = MAX_COMPONENT_VALUE;
-    }
-    else if ((((double) BLACK_LOWER_INDEX < s) && (s < (double) BLACK_UPPER_INDEX)) || !DecompositionUtils::isANumber(s))
-    {
-        /* Black is also output for Nan values */
-        returnedColor[0] = MIN_COMPONENT_VALUE;
-        returnedColor[1] = MIN_COMPONENT_VALUE;
-        returnedColor[2] = MIN_COMPONENT_VALUE;
-    }
-    else
-    {
-        if (s > (double)(colormapSize - 1))
-        {
-            if (clamped)
-            {
-                s = (double) (colormapSize - 1);
-            }
-            else
-            {
-                returnedColor[0] = -1;
-                return;
-            }
-        }
-
-        index = (int) s;
-
-        returnedColor[0] = (float)colormap[index];
-        returnedColor[1] = (float)colormap[colormapSize + index];
-        returnedColor[2] = (float)colormap[2 * colormapSize + index];
-    }
-}
-
 double ColorComputer::getDirectIndex(double s, int colormapSize)
 {
     double index = 0.;
@@ -191,25 +149,6 @@ double ColorComputer::getDirectIndex(double s, int colormapSize)
     return index;
 }
 
-void ColorComputer::getDirectByteColor(double s, double* colormap, int colormapSize, unsigned char* returnedColor, bool clamped)
-{
-    float color[3];
-    getDirectColor(s, colormap, colormapSize, color, clamped);
-
-    returnedColor[0] = (unsigned char)(color[0] * 255);
-    returnedColor[1] = (unsigned char)(color[1] * 255);
-    returnedColor[2] = (unsigned char)(color[2] * 255);
-
-    if (!clamped && color[0] == -1)
-    {
-        returnedColor[3] = 0;
-    }
-    else
-    {
-        returnedColor[3] = 255;
-    }
-}
-
 double ColorComputer::getClampedDirectIndex(double s, int colormapSize)
 {
     double index = s;
index 6df6ebc..0886b2e 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "MatPlotDecomposer.hxx"
 #include "Fac3DDecomposer.hxx"
+#include "NgonGridMatplotData.hxx"
 #include "NgonGridGrayplotDataDecomposer.hxx"
 #include "NgonGridMatplotDataDecomposer.hxx"
 #include "Plot3DDecomposer.hxx"
@@ -98,20 +99,20 @@ int getDataSize(char* id)
 
     switch (iType)
     {
-    case __GO_FAC3D__ :
-        return Fac3DDecomposer::getDataSize(id);
-    case __GO_FEC__ :
-        return TriangleMeshFecDataDecomposer::getDataSize(id);
-    case __GO_GRAYPLOT__ :
-        return NgonGridGrayplotDataDecomposer::getDataSize(id);
-    case __GO_MATPLOT__ :
-        return NgonGridMatplotDataDecomposer::getDataSize(id);
-    case __GO_PLOT3D__ :
-        return Plot3DDecomposer::getDataSize(id);
-    case __GO_POLYLINE__ :
-        return PolylineDecomposer::getDataSize(id);
-    default :
-        return 0;
+        case __GO_FAC3D__ :
+            return Fac3DDecomposer::getDataSize(id);
+        case __GO_FEC__ :
+            return TriangleMeshFecDataDecomposer::getDataSize(id);
+        case __GO_GRAYPLOT__ :
+            return NgonGridGrayplotDataDecomposer::getDataSize(id);
+        case __GO_MATPLOT__ :
+            return NgonGridMatplotDataDecomposer::getDataSize(id);
+        case __GO_PLOT3D__ :
+            return Plot3DDecomposer::getDataSize(id);
+        case __GO_POLYLINE__ :
+            return PolylineDecomposer::getDataSize(id);
+        default :
+            return 0;
     }
 
 }
@@ -125,24 +126,24 @@ void fillVertices(char* id, float* buffer, int bufferLength, int elementsSize, i
 
     switch (iType)
     {
-    case __GO_FAC3D__ :
-        Fac3DDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
-        break;
-    case __GO_FEC__ :
-        TriangleMeshFecDataDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
-        break;
-    case __GO_GRAYPLOT__ :
-        NgonGridGrayplotDataDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
-        break;
-    case __GO_MATPLOT__ :
-        NgonGridMatplotDataDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
-        break;
-    case __GO_PLOT3D__ :
-        Plot3DDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
-        break;
-    case __GO_POLYLINE__ :
-        PolylineDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
-        break;
+        case __GO_FAC3D__ :
+            Fac3DDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+            break;
+        case __GO_FEC__ :
+            TriangleMeshFecDataDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+            break;
+        case __GO_GRAYPLOT__ :
+            NgonGridGrayplotDataDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+            break;
+        case __GO_MATPLOT__ :
+            NgonGridMatplotDataDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+            break;
+        case __GO_PLOT3D__ :
+            Plot3DDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+            break;
+        case __GO_POLYLINE__ :
+            PolylineDecomposer::fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+            break;
     }
 }
 
@@ -155,15 +156,15 @@ void fillTextureCoordinates(char* id, float* BUFF, int bufferLength)
 
     switch (iType)
     {
-    case __GO_FAC3D__ :
-        Fac3DDecomposer::fillTextureCoordinates(id, BUFF, bufferLength);
-        break;
-    case __GO_FEC__ :
-        TriangleMeshFecDataDecomposer::fillTextureCoordinates(id, BUFF, bufferLength);
-        break;
-    case __GO_POLYLINE__ :
-        PolylineDecomposer::fillTextureCoordinates(id, BUFF, bufferLength);
-        break;
+        case __GO_FAC3D__ :
+            Fac3DDecomposer::fillTextureCoordinates(id, BUFF, bufferLength);
+            break;
+        case __GO_FEC__ :
+            TriangleMeshFecDataDecomposer::fillTextureCoordinates(id, BUFF, bufferLength);
+            break;
+        case __GO_POLYLINE__ :
+            PolylineDecomposer::fillTextureCoordinates(id, BUFF, bufferLength);
+            break;
     }
 }
 
@@ -176,21 +177,21 @@ void fillColors(char* id, float* BUFF, int bufferLength, int elementsSize)
 
     switch (iType)
     {
-    case __GO_FEC__ :
-        TriangleMeshFecDataDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
-        break;
-    case __GO_GRAYPLOT__ :
-        NgonGridGrayplotDataDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
-        break;
-    case __GO_MATPLOT__ :
-        NgonGridMatplotDataDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
-        break;
-    case __GO_PLOT3D__ :
-        Plot3DDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
-        break;
-    case __GO_POLYLINE__ :
-        PolylineDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
-        break;
+        case __GO_FEC__ :
+            TriangleMeshFecDataDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
+            break;
+        case __GO_GRAYPLOT__ :
+            NgonGridGrayplotDataDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
+            break;
+        case __GO_MATPLOT__ :
+            NgonGridMatplotDataDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
+            break;
+        case __GO_PLOT3D__ :
+            Plot3DDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
+            break;
+        case __GO_POLYLINE__ :
+            PolylineDecomposer::fillColors(id, BUFF, bufferLength, elementsSize);
+            break;
     }
 }
 
@@ -204,20 +205,20 @@ int getIndicesSize(char* id)
 
     switch (iType)
     {
-    case __GO_FAC3D__ :
-        return Fac3DDecomposer::getIndicesSize(id);
-    case __GO_FEC__ :
-        return TriangleMeshFecDataDecomposer::getIndicesSize(id);
-    case __GO_GRAYPLOT__ :
-        return NgonGridGrayplotDataDecomposer::getIndicesSize(id);
-    case __GO_MATPLOT__ :
-        return NgonGridMatplotDataDecomposer::getIndicesSize(id);
-    case __GO_PLOT3D__ :
-        return Plot3DDecomposer::getIndicesSize(id);
-    case __GO_POLYLINE__ :
-        return PolylineDecomposer::getIndicesSize(id);
-    default :
-        return 0;
+        case __GO_FAC3D__ :
+            return Fac3DDecomposer::getIndicesSize(id);
+        case __GO_FEC__ :
+            return TriangleMeshFecDataDecomposer::getIndicesSize(id);
+        case __GO_GRAYPLOT__ :
+            return NgonGridGrayplotDataDecomposer::getIndicesSize(id);
+        case __GO_MATPLOT__ :
+            return NgonGridMatplotDataDecomposer::getIndicesSize(id);
+        case __GO_PLOT3D__ :
+            return Plot3DDecomposer::getIndicesSize(id);
+        case __GO_POLYLINE__ :
+            return PolylineDecomposer::getIndicesSize(id);
+        default :
+            return 0;
     }
 }
 
@@ -231,20 +232,20 @@ int fillIndices(char* id, int* buffer, int bufferLength, int logMask)
 
     switch (iType)
     {
-    case __GO_FAC3D__ :
-        return Fac3DDecomposer::fillIndices(id, buffer, bufferLength, logMask);
-    case __GO_FEC__ :
-        return TriangleMeshFecDataDecomposer::fillIndices(id, buffer, bufferLength, logMask);
-    case __GO_GRAYPLOT__ :
-        return NgonGridGrayplotDataDecomposer::fillIndices(id, buffer, bufferLength, logMask);
-    case __GO_MATPLOT__ :
-        return NgonGridMatplotDataDecomposer::fillIndices(id, buffer, bufferLength, logMask);
-    case __GO_PLOT3D__ :
-        return Plot3DDecomposer::fillIndices(id, buffer, bufferLength, logMask);
-    case __GO_POLYLINE__ :
-        return PolylineDecomposer::fillIndices(id, buffer, bufferLength, logMask);
-    default :
-        return 0;
+        case __GO_FAC3D__ :
+            return Fac3DDecomposer::fillIndices(id, buffer, bufferLength, logMask);
+        case __GO_FEC__ :
+            return TriangleMeshFecDataDecomposer::fillIndices(id, buffer, bufferLength, logMask);
+        case __GO_GRAYPLOT__ :
+            return NgonGridGrayplotDataDecomposer::fillIndices(id, buffer, bufferLength, logMask);
+        case __GO_MATPLOT__ :
+            return NgonGridMatplotDataDecomposer::fillIndices(id, buffer, bufferLength, logMask);
+        case __GO_PLOT3D__ :
+            return Plot3DDecomposer::fillIndices(id, buffer, bufferLength, logMask);
+        case __GO_POLYLINE__ :
+            return PolylineDecomposer::fillIndices(id, buffer, bufferLength, logMask);
+        default :
+            return 0;
     }
 }
 
@@ -257,16 +258,16 @@ int getWireIndicesSize(char* id)
 
     switch (iType)
     {
-    case __GO_FAC3D__ :
-        return Fac3DDecomposer::getWireIndicesSize(id);
-    case __GO_FEC__ :
-        return TriangleMeshFecDataDecomposer::getWireIndicesSize(id);
-    case __GO_PLOT3D__ :
-        return Plot3DDecomposer::getWireIndicesSize(id);
-    case __GO_POLYLINE__ :
-        return PolylineDecomposer::getWireIndicesSize(id);
-    default :
-        return 0;
+        case __GO_FAC3D__ :
+            return Fac3DDecomposer::getWireIndicesSize(id);
+        case __GO_FEC__ :
+            return TriangleMeshFecDataDecomposer::getWireIndicesSize(id);
+        case __GO_PLOT3D__ :
+            return Plot3DDecomposer::getWireIndicesSize(id);
+        case __GO_POLYLINE__ :
+            return PolylineDecomposer::getWireIndicesSize(id);
+        default :
+            return 0;
     }
 }
 
@@ -279,16 +280,16 @@ int fillWireIndices(char* id, int* buffer, int bufferLength, int logMask)
 
     switch (iType)
     {
-    case __GO_FAC3D__ :
-        return Fac3DDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
-    case __GO_FEC__ :
-        return TriangleMeshFecDataDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
-    case __GO_PLOT3D__ :
-        return Plot3DDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
-    case __GO_POLYLINE__ :
-        return PolylineDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
-    default :
-        return 0;
+        case __GO_FAC3D__ :
+            return Fac3DDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
+        case __GO_FEC__ :
+            return TriangleMeshFecDataDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
+        case __GO_PLOT3D__ :
+            return Plot3DDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
+        case __GO_POLYLINE__ :
+            return PolylineDecomposer::fillWireIndices(id, buffer, bufferLength, logMask);
+        default :
+            return 0;
     }
 }
 
@@ -302,3 +303,108 @@ int fillMarkIndices(char* id, int* BUFF, int bufferLength)
     // TODO.
     return 0;
 }
+
+JavaDirectBuffer getTextureData(char * id)
+{
+    JavaDirectBuffer info;
+    int iType = 0;
+    int *piType = &iType;
+
+    info.address = NULL;
+    info.size = 0;
+
+    getGraphicObjectProperty(id, __GO_TYPE__, jni_int, (void**) &piType);
+
+    if (iType == __GO_MATPLOT__)
+    {
+        void * address = NULL;
+        unsigned int size = 0;
+
+        if (!MatPlotDecomposer::getTextureData(id, &address, &size))
+        {
+            return info;
+        }
+        info.address = address;
+        info.size = size;
+    }
+
+    return info;
+}
+
+int getTextureImageType(char * id)
+{
+    int iType = 0;
+    int *piType = &iType;
+
+    getGraphicObjectProperty(id, __GO_TYPE__, jni_int, (void**) &piType);
+
+    if (iType == __GO_MATPLOT__)
+    {
+        return MatPlotDecomposer::getTextureImageType(id);
+    }
+
+    return -1;
+}
+
+int getTextureDataType(char * id)
+{
+    int iType = 0;
+    int *piType = &iType;
+
+    getGraphicObjectProperty(id, __GO_TYPE__, jni_int, (void**) &piType);
+
+    if (iType == __GO_MATPLOT__)
+    {
+        return MatPlotDecomposer::getTextureDataType(id);
+    }
+
+    return -1;
+}
+
+int getTextureGLType(char * id)
+{
+    int iType = 0;
+    int *piType = &iType;
+
+    getGraphicObjectProperty(id, __GO_TYPE__, jni_int, (void**) &piType);
+
+    if (iType == __GO_MATPLOT__)
+    {
+        return MatPlotDecomposer::getTextureGLType(id);
+    }
+
+    return -1;
+}
+
+void disposeTextureData(char * id, unsigned char * buffer)
+{
+    int iType = 0;
+    int *piType = &iType;
+
+    getGraphicObjectProperty(id, __GO_TYPE__, jni_int, (void**) &piType);
+
+    if (iType == __GO_MATPLOT__)
+    {
+        MatPlotDecomposer::disposeTextureData(id, buffer);
+    }
+}
+
+int isTextureRowOrder(char * id)
+{
+    int iType = 0;
+    int *piType = &iType;
+
+    getGraphicObjectProperty(id, __GO_TYPE__, jni_int, (void**) &piType);
+
+    if (iType == __GO_MATPLOT__)
+    {
+        return MatPlotDecomposer::isTextureRowOrder(id);
+    }
+
+    return 0;
+}
+
+void setABGRExt(int isAvailable)
+{
+    NgonGridMatplotData::setABGRSupported(isAvailable != 0);
+}
index 0d224de..72bffc6 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  *  Copyright (C) 2011-2012 - DIGITEO - Pierre Lando
+ *  Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
  *
  *  This file must be used under the terms of the CeCILL.
  *  This source file is licensed as described in the file COPYING, which
 #include "DataProperties.hxx"
 #include "ColorComputer.hxx"
 #include <iostream>
+#include <cstring>
 
 extern "C" {
 #include "getGraphicObjectProperty.h"
+#include "setGraphicObjectProperty.h"
 #include "graphicObjectProperties.h"
+#include "Matplot.h"
 }
 
 int MatPlotDecomposer::getTextureWidth(char* id)
@@ -26,6 +30,7 @@ int MatPlotDecomposer::getTextureWidth(char* id)
     int width = 0;
     int* piWidth = &width;
     getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_X__, jni_int, (void**) &piWidth);
+
     return width - 1;
 }
 
@@ -35,45 +40,109 @@ int MatPlotDecomposer::getTextureHeight(char* id)
     int height = 0;
     int* piHeight = &height;
     getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_Y__, jni_int, (void**) &piHeight);
+
     return height - 1;
 }
 
 
 int MatPlotDecomposer::fillTextureData(char* id, unsigned char* buffer, int bufferLength)
 {
-    double* value = NULL;
-    getGraphicObjectProperty(id, __GO_DATA_MODEL_Z__, jni_double_vector, (void**) &value);
-    int textureWidth = getTextureWidth(id);
-    int textureHeight = getTextureHeight(id);
-    int dataSize = textureWidth * textureHeight;
-    if (dataSize * 4 == bufferLength)
+    // Indexed colors
+    void * data = NULL;
+    char * parentFigure = NULL;
+    double * colormap = NULL;
+    int colormapSize = 0;
+    int * piColormapSize = &colormapSize;
+    int datatype = -1;
+    int * pidataType = &datatype;
+    const int h = getTextureHeight(id);
+    const int w = getTextureWidth(id);
+
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_Z__, jni_double_vector, &data);
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_DATA_TYPE__, jni_int, (void**) &pidataType);
+    getGraphicObjectProperty(id, __GO_PARENT_FIGURE__, jni_string, (void**) &parentFigure);
+    getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
+    getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
+
+    switch ((DataType)datatype)
     {
+        case MATPLOT_HM1_Char :
+        case MATPLOT_Char :
+        {
+            char * index = (char *)data;
+            for (unsigned int i = 0 ; i < w * h; i++)
+            {
+                ColorComputer::getDirectByteColor(index[i] - 1, colormap, colormapSize, &buffer[4 * i], false);
+            }
 
-        char* parentFigure = NULL;
-        double* colormap = NULL;
-        int colormapSize = 0;
-        int* piColormapSize = &colormapSize;
+            break;
+        }
+        case MATPLOT_HM1_UChar :
+        case MATPLOT_UChar :
+        {
+            unsigned char * index = (unsigned char *)data;
+            for (unsigned int i = 0 ; i < w * h; i++)
+            {
+                ColorComputer::getDirectByteColor(index[i] - 1, colormap, colormapSize, &buffer[4 * i], false);
+            }
 
-        getGraphicObjectProperty(id, __GO_PARENT_FIGURE__, jni_string, (void**) &parentFigure);
-        getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
-        getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
+            break;
+        }
+        case MATPLOT_Int :
+        {
+            int * index = (int *)data;
+            for (unsigned int i = 0 ; i < w * h; i++)
+            {
+                ColorComputer::getDirectByteColor(index[i] - 1, colormap, colormapSize, &buffer[4 * i], false);
+            }
 
-        for (int i = 0 ; i < textureWidth ; i++)
+            break;
+        }
+        case MATPLOT_UInt :
         {
-            for (int j = 0 ; j < textureHeight ; j++)
+            unsigned int * index = (unsigned int *)data;
+            for (unsigned int i = 0 ; i < w * h; i++)
             {
-                ColorComputer::getDirectByteColor(value[j + i * textureHeight] - 1, colormap, colormapSize, &buffer[4 * (i + j * textureWidth)], false);
+                ColorComputer::getDirectByteColor(index[i] - 1, colormap, colormapSize, &buffer[4 * i], false);
             }
+
+            break;
         }
+        case MATPLOT_Short :
+        {
+            short * index = (short *)data;
+            for (unsigned int i = 0 ; i < w * h; i++)
+            {
+                ColorComputer::getDirectByteColor(index[i] - 1, colormap, colormapSize, &buffer[4 * i], false);
+            }
 
-        releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
+            break;
+        }
+        case MATPLOT_UShort :
+        {
+            unsigned short * index = (unsigned short *)data;
+            for (unsigned int i = 0 ; i < w * h; i++)
+            {
+                ColorComputer::getDirectByteColor(index[i] - 1, colormap, colormapSize, &buffer[4 * i], false);
+            }
 
-        return bufferLength;
-    }
-    else
-    {
-        return 0;
+            break;
+        }
+        case MATPLOT_HM1_Double :
+        case MATPLOT_Double :
+        {
+            double * index = (double *)data;
+            for (unsigned int i = 0 ; i < w * h ; i++)
+            {
+                ColorComputer::getDirectByteColor(index[i] - 1, colormap, colormapSize, &buffer[4 * i], false);
+            }
+            break;
+        }
     }
+
+    releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
+
+    return bufferLength;
 }
 
 
@@ -112,4 +181,75 @@ int MatPlotDecomposer::fillTextureData(char* id, unsigned char* buffer, int buff
     }
 }
 
+int MatPlotDecomposer::getTextureImageType(char * id)
+{
+    int type = -1;
+    int * piType = &type;
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__, jni_int, (void**) &piType);
 
+    return type;
+}
+
+int MatPlotDecomposer::getTextureDataType(char * id)
+{
+    int type = -1;
+    int * piType = &type;
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_DATA_TYPE__, jni_int, (void**) &piType);
+
+    return type;
+}
+
+int MatPlotDecomposer::getTextureGLType(char * id)
+{
+    int type = -1;
+    int * piType = &type;
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_GL_TYPE__, jni_int, (void**) &piType);
+
+    return type;
+}
+
+int MatPlotDecomposer::getTextureData(char * id, void ** address, unsigned int * size)
+{
+    int type = getTextureImageType(id);
+    if (type == MATPLOT_INDEX)
+    {
+        // Indexed colors
+        const int h = getTextureHeight(id);
+        const int w = getTextureWidth(id);
+        const int bsize = w * h * sizeof(int);
+        unsigned char * buffer = new unsigned char[bsize];
+        fillTextureData(id, buffer, bsize);
+
+        *address = buffer;
+        *size = bsize;
+
+        return 1;
+    }
+
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__, jni_double_vector, address);
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__, jni_int, (void **)&size);
+
+    return 1;
+}
+
+void MatPlotDecomposer::disposeTextureData(char * id, unsigned char * buffer)
+{
+    if (buffer)
+    {
+        delete[] buffer;
+    }
+}
+
+int MatPlotDecomposer::isTextureRowOrder(char * id)
+{
+    int rowOrder;
+    int * piRowOrder = &rowOrder;
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_DATA_ORDER__, jni_int, (void**) &piRowOrder);
+
+    return rowOrder;
+}
+
+int buildMatplotType(DataType datatype, DataOrder dataorder, ImageType imagetype)
+{
+    return ((int)datatype) | ((int)dataorder << 8) | ((int)imagetype << 16);
+}
index 5ce0aae..4f5534d 100644 (file)
@@ -35,9 +35,9 @@ int NgonGridDataDecomposer::getDataSize(char* id)
     getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_Y__, jni_int, (void**) &piNumY);
 
 #if PER_VERTEX_VALUES
-    return numX*numY;
+    return numX * numY;
 #else
-    return 4*(numX-1)*(numY-1);
+    return 4 * (numX - 1) * (numY - 1);
 #endif
 }
 
@@ -66,7 +66,7 @@ void NgonGridDataDecomposer::fillVertices(char* id, float* buffer, int bufferLen
 }
 
 void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, int elementsSize, int coordinateMask, double* scale, double* translation, int logMask,
-    double* x, double* y, double* z, int numX, int numY)
+        double* x, double* y, double* z, int numX, int numY)
 {
     double xi = 0.;
     double yj = 0.;
@@ -90,7 +90,7 @@ void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, i
         for (int i = 0; i < numX; i++)
         {
             xi = x[i];
-            bufferOffset = elementsSize*(numX*j + i);
+            bufferOffset = elementsSize * (numX * j + i);
 
             if (coordinateMask & 0x1)
             {
@@ -104,19 +104,19 @@ void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, i
 
             if (coordinateMask  & 0x2)
             {
-                buffer[bufferOffset +1] = yj * scale[1] + translation[1];
+                buffer[bufferOffset + 1] = yj * scale[1] + translation[1];
             }
 
             if (coordinateMask & 0x4)
             {
                 zij = getZCoordinate(z, numX, numY, i, j, logMask & 0x4);
 
-                buffer[bufferOffset +2] = zij * scale[2] + translation[2];
+                buffer[bufferOffset + 2] = zij * scale[2] + translation[2];
             }
 
             if (elementsSize == 4 && (coordinateMask & 0x8))
             {
-                buffer[bufferOffset +3] = 1.0;
+                buffer[bufferOffset + 3] = 1.0;
             }
         }
     }
@@ -127,13 +127,13 @@ void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, i
 
     bufferOffset = 0;
 
-    for (int j = 0; j < numY-1; j++)
+    for (int j = 0; j < numY - 1; j++)
     {
         double ycoords[4];
         int yindices[4];
 
         yj = y[j];
-        yjp1 = y[j+1];
+        yjp1 = y[j + 1];
 
         if (coordinateMask  & 0x2)
         {
@@ -151,16 +151,16 @@ void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, i
 
         yindices[0] = j;
         yindices[1] = j;
-        yindices[2] = j+1;
-        yindices[3] = j+1;
+        yindices[2] = j + 1;
+        yindices[3] = j + 1;
 
-        for (int i = 0; i < numX-1; i++)
+        for (int i = 0; i < numX - 1; i++)
         {
             double xcoords[4];
             int xindices[4];
 
             xi = x[i];
-            xip1 = x[i+1];
+            xip1 = x[i + 1];
 
             if (logMask & 0x1)
             {
@@ -174,9 +174,9 @@ void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, i
             xcoords[3] = xip1;
 
             xindices[0] = i;
-            xindices[1] = i+1;
+            xindices[1] = i + 1;
             xindices[2] = i;
-            xindices[3] = i+1;
+            xindices[3] = i + 1;
 
             /*
              * If color values are defined per facet, we must duplicate shared vertices in order
@@ -192,19 +192,19 @@ void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, i
 
                 if (coordinateMask  & 0x2)
                 {
-                    buffer[bufferOffset +1] = (float)(ycoords[k] * scale[1] + translation[1]);
+                    buffer[bufferOffset + 1] = (float)(ycoords[k] * scale[1] + translation[1]);
                 }
 
                 if (coordinateMask & 0x4)
                 {
                     zij = getZCoordinate(z, numX, numY, xindices[k], yindices[k], logMask & 0x4);
 
-                    buffer[bufferOffset +2] = (float)(zij * scale[2] + translation[2]);
+                    buffer[bufferOffset + 2] = (float)(zij * scale[2] + translation[2]);
                 }
 
                 if (elementsSize == 4 && (coordinateMask & 0x8))
                 {
-                    buffer[bufferOffset +3] = 1.0;
+                    buffer[bufferOffset + 3] = 1.0;
                 }
 
                 bufferOffset += elementsSize;
@@ -219,7 +219,7 @@ void NgonGridDataDecomposer::fillGridVertices(float* buffer, int bufferLength, i
 }
 
 void NgonGridDataDecomposer::fillNormalizedZGridColors(float* buffer, int bufferLength, int elementsSize, double* colormap, int colormapSize,
-    double* z, int numX, int numY)
+        double* z, int numX, int numY)
 {
     double zMin = 0.;
     double zMax = 0.;
@@ -253,16 +253,16 @@ void NgonGridDataDecomposer::fillNormalizedZGridColors(float* buffer, int buffer
 
             if (elementsSize == 4)
             {
-                buffer[bufferOffset +3] = 1.0;
+                buffer[bufferOffset + 3] = 1.0;
             }
 
             bufferOffset += elementsSize;
         }
     }
 #else
-    for (int j = 0; j < numY-1; j++)
+    for (int j = 0; j < numY - 1; j++)
     {
-        for (int i = 0; i < numX-1; i++)
+        for (int i = 0; i < numX - 1; i++)
         {
             double avgz;
             float facetColor[3];
@@ -273,7 +273,7 @@ void NgonGridDataDecomposer::fillNormalizedZGridColors(float* buffer, int buffer
 
             writeFacetColorToBuffer(buffer, bufferOffset, facetColor, elementsSize);
 
-            bufferOffset += 4*elementsSize;
+            bufferOffset += 4 * elementsSize;
         }
     }
 #endif
@@ -281,7 +281,7 @@ void NgonGridDataDecomposer::fillNormalizedZGridColors(float* buffer, int buffer
 }
 
 void NgonGridDataDecomposer::fillDirectGridColors(float* buffer, int bufferLength, int elementsSize, double* colormap, int colormapSize,
-    double* z, int numX, int numY)
+        double* z, int numX, int numY)
 {
     int currentPointIndex = 0;
     int bufferOffset = 0;
@@ -297,16 +297,16 @@ void NgonGridDataDecomposer::fillDirectGridColors(float* buffer, int bufferLengt
 
             if (elementsSize == 4)
             {
-                buffer[bufferOffset +3] = 1.0;
+                buffer[bufferOffset + 3] = 1.0;
             }
 
             bufferOffset += elementsSize;
         }
     }
 #else
-    for (int j = 0; j < numY-1; j++)
+    for (int j = 0; j < numY - 1; j++)
     {
-        for (int i = 0; i < numX-1; i++)
+        for (int i = 0; i < numX - 1; i++)
         {
             float facetColor[3];
 
@@ -316,7 +316,7 @@ void NgonGridDataDecomposer::fillDirectGridColors(float* buffer, int bufferLengt
 
             writeFacetColorToBuffer(buffer, bufferOffset, facetColor, elementsSize);
 
-            bufferOffset += 4*elementsSize;
+            bufferOffset += 4 * elementsSize;
         }
     }
 #endif
@@ -324,23 +324,23 @@ void NgonGridDataDecomposer::fillDirectGridColors(float* buffer, int bufferLengt
 }
 
 void NgonGridDataDecomposer::getFacetCoordinates(double* x, double* y, double*z, int numX, int numY, int i, int j,
-    double vertices[4][3])
+        double vertices[4][3])
 {
     vertices[0][0] = x[i];
     vertices[0][1] = y[j];
     vertices[0][2] = getZCoordinate(z, numX, numY, i, j);;
 
-    vertices[1][0] = x[i+1];
+    vertices[1][0] = x[i + 1];
     vertices[1][1] = y[j];
-    vertices[1][2] = getZCoordinate(z, numX, numY, i+1, j);
+    vertices[1][2] = getZCoordinate(z, numX, numY, i + 1, j);
 
-    vertices[2][0] = x[i+1];
-    vertices[2][1] = y[j+1];
-    vertices[2][2] = getZCoordinate(z, numX, numY, i+1, j+1);
+    vertices[2][0] = x[i + 1];
+    vertices[2][1] = y[j + 1];
+    vertices[2][2] = getZCoordinate(z, numX, numY, i + 1, j + 1);
 
     vertices[3][0] = x[i];
-    vertices[3][1] = y[j+1];
-    vertices[3][2] = getZCoordinate(z, numX, numY, i, j+1);
+    vertices[3][1] = y[j + 1];
+    vertices[3][2] = getZCoordinate(z, numX, numY, i, j + 1);
 }
 
 double NgonGridDataDecomposer::getZCoordinate(double* z, int numX, int numY, int i, int j)
@@ -367,7 +367,7 @@ double NgonGridDataDecomposer::getZCoordinate(double* z, int numX, int numY, int
 
 double NgonGridDataDecomposer::getValue(double* values, int numX, int numY, int i, int j)
 {
-    return values[numX*j +i];
+    return values[numX * j + i];
 }
 
 int NgonGridDataDecomposer::getIndicesSize(char* id)
@@ -385,7 +385,7 @@ int NgonGridDataDecomposer::getIndicesSize(char* id)
         return 0;
     }
 
-    return 6*(numX-1)*(numY-1);
+    return 6 * (numX - 1) * (numY - 1);
 }
 
 
@@ -460,13 +460,13 @@ int NgonGridDataDecomposer::fillTriangleIndices(int* buffer, int bufferLength, i
     }
 
     /* To do: optimize */
-    for (int j = 0; j < numY-1; j++)
+    for (int j = 0; j < numY - 1; j++)
     {
-        nextRowValid = DecompositionUtils::isValid(y[j+1]);
+        nextRowValid = DecompositionUtils::isValid(y[j + 1]);
 
         if (logMask & 0x2)
         {
-            nextRowValid &= DecompositionUtils::isLogValid(y[j+1]);
+            nextRowValid &= DecompositionUtils::isLogValid(y[j + 1]);
         }
 
         if (!currentRowValid || !nextRowValid)
@@ -487,21 +487,21 @@ int NgonGridDataDecomposer::fillTriangleIndices(int* buffer, int bufferLength, i
         }
 
         ij = getPointIndex(numX, numY, 0, j);
-        ijp1 = getPointIndex(numX, numY, 0, j+1);
+        ijp1 = getPointIndex(numX, numY, 0, j + 1);
 
         currentEdgeValid = isFacetEdgeValid(z, values, perNodeValues, numX, numY, 0, j, logMask & 0x4);
 
-        for (int i = 0; i < numX-1; i++)
+        for (int i = 0; i < numX - 1; i++)
         {
-            nextColumnValid = DecompositionUtils::isValid(x[i+1]);
+            nextColumnValid = DecompositionUtils::isValid(x[i + 1]);
 
             if (logMask & 0x1)
             {
-                nextColumnValid &= DecompositionUtils::isLogValid(x[i+1]);
+                nextColumnValid &= DecompositionUtils::isLogValid(x[i + 1]);
             }
 
-            ip1j = getPointIndex(numX, numY, i+1, j);
-            ip1jp1 = getPointIndex(numX, numY, i+1, j+1);
+            ip1j = getPointIndex(numX, numY, i + 1, j);
+            ip1jp1 = getPointIndex(numX, numY, i + 1, j + 1);
 
             currentFacetValid = isFacetValid(z, values, perNodeValues, numX, numY, i, j, logMask & 0x4, currentEdgeValid, &nextEdgeValid);
 
@@ -520,19 +520,19 @@ int NgonGridDataDecomposer::fillTriangleIndices(int* buffer, int bufferLength, i
                 firstVertexIndex = getFirstVertexIndex(numX, numY, i, j);
 
                 facetVertexIndices[0] = firstVertexIndex;
-                facetVertexIndices[1] = firstVertexIndex+1;
-                facetVertexIndices[2] = firstVertexIndex+3;
-                facetVertexIndices[3] = firstVertexIndex+2;
+                facetVertexIndices[1] = firstVertexIndex + 1;
+                facetVertexIndices[2] = firstVertexIndex + 3;
+                facetVertexIndices[3] = firstVertexIndex + 2;
 #endif
 
                 getFacetTriangles(x, y, z, numX, numY, i, j, facetVertexIndices, triangleVertexIndices);
 
                 buffer[bufferOffset] = triangleVertexIndices[0];
-                buffer[bufferOffset+1] = triangleVertexIndices[1];
-                buffer[bufferOffset+2] = triangleVertexIndices[2];
-                buffer[bufferOffset+3] = triangleVertexIndices[3];
-                buffer[bufferOffset+4] = triangleVertexIndices[4];
-                buffer[bufferOffset+5] = triangleVertexIndices[5];
+                buffer[bufferOffset + 1] = triangleVertexIndices[1];
+                buffer[bufferOffset + 2] = triangleVertexIndices[2];
+                buffer[bufferOffset + 3] = triangleVertexIndices[3];
+                buffer[bufferOffset + 4] = triangleVertexIndices[4];
+                buffer[bufferOffset + 5] = triangleVertexIndices[5];
 
                 bufferOffset += 6;
             }
@@ -550,7 +550,7 @@ int NgonGridDataDecomposer::fillTriangleIndices(int* buffer, int bufferLength, i
 }
 
 void NgonGridDataDecomposer::getFacetTriangles(double* x, double* y, double* z, int numX, int numY, int i, int j,
-    int* facetVertexIndices, int* triangleVertexIndices)
+        int* facetVertexIndices, int* triangleVertexIndices)
 {
     /* Facets are plane: they are all decomposed the same way */
     triangleVertexIndices[0] = facetVertexIndices[0];
@@ -563,7 +563,7 @@ void NgonGridDataDecomposer::getFacetTriangles(double* x, double* y, double* z,
 
 int NgonGridDataDecomposer::isFacetValid(double* z, double* values, int perNodeValues, int numX, int numY, int i, int j, int logUsed, int currentEdgeValid, int* nextEdgeValid)
 {
-    *nextEdgeValid = isFacetEdgeValid(z, values, perNodeValues, numX, numY, i+1, j, logUsed);
+    *nextEdgeValid = isFacetEdgeValid(z, values, perNodeValues, numX, numY, i + 1, j, logUsed);
 
     if (currentEdgeValid && *nextEdgeValid)
     {
@@ -584,7 +584,7 @@ int NgonGridDataDecomposer::isFacetEdgeValid(double* z, double* values, int perN
     int upperZValid = 0;
 
     zij = getZCoordinate(z, numX, numY, i, j);
-    zijp1 = getZCoordinate(z, numX, numY, i, j+1);
+    zijp1 = getZCoordinate(z, numX, numY, i, j + 1);
 
     lowerZValid = DecompositionUtils::isValid(zij);
     upperZValid = DecompositionUtils::isValid(zijp1);
@@ -607,7 +607,7 @@ int NgonGridDataDecomposer::isFacetEdgeValid(double* z, double* values, int perN
 
 int NgonGridDataDecomposer::getPointIndex(int numX, int numY, int i, int j)
 {
-    return numX*j + i;
+    return numX * j + i;
 }
 
 void NgonGridDataDecomposer::computeMinMaxZValues(double* z, int numX, int numY, double* zMin, double* zMax)
@@ -633,7 +633,7 @@ void NgonGridDataDecomposer::computeMinMaxZValues(double* z, int numX, int numY,
 
             if (DecompositionUtils::isValid(zi))
             {
-                if(zi < tmpZMin)
+                if (zi < tmpZMin)
                 {
                     tmpZMin = zi;
                 }
@@ -658,11 +658,11 @@ double NgonGridDataDecomposer::computeFacetAverageZValue(double* z, int numX, in
     avgz = 0.0;
     pointIndex = getPointIndex(numX, numY, i, j);
     avgz += z[pointIndex];
-    pointIndex = getPointIndex(numX, numY, i+1, j);
+    pointIndex = getPointIndex(numX, numY, i + 1, j);
     avgz += z[pointIndex];
-    pointIndex = getPointIndex(numX, numY, i, j+1);
+    pointIndex = getPointIndex(numX, numY, i, j + 1);
     avgz += z[pointIndex];
-    pointIndex = getPointIndex(numX, numY, i+1, j+1);
+    pointIndex = getPointIndex(numX, numY, i + 1, j + 1);
     avgz += z[pointIndex];
 
     avgz *= 0.25;
@@ -670,17 +670,24 @@ double NgonGridDataDecomposer::computeFacetAverageZValue(double* z, int numX, in
     return avgz;
 }
 
-void NgonGridDataDecomposer::writeFacetColorToBuffer(float* buffer, int bufferOffset, float* color, int elementsSize)
+void NgonGridDataDecomposer::writeFacetColorToBuffer(float* buffer, int bufferOffset, float* color, int elementsSize, bool hasTransparency)
 {
     for (int k = 0; k < 4; k++)
     {
         buffer[bufferOffset] = color[0];
-        buffer[bufferOffset +1] = color[1];
-        buffer[bufferOffset +2] = color[2];
+        buffer[bufferOffset + 1] = color[1];
+        buffer[bufferOffset + 2] = color[2];
 
         if (elementsSize == 4)
         {
-            buffer[bufferOffset +3] = 1.0;
+            if (hasTransparency)
+            {
+                buffer[bufferOffset + 3] = color[3];
+            }
+            else
+            {
+                buffer[bufferOffset + 3] = 1.0;
+            }
         }
 
         bufferOffset += elementsSize;
@@ -689,6 +696,6 @@ void NgonGridDataDecomposer::writeFacetColorToBuffer(float* buffer, int bufferOf
 
 int NgonGridDataDecomposer::getFirstVertexIndex(int numX, int numY, int i, int j)
 {
-    return 4*j*(numX-1) + 4*i;
+    return 4 * j * (numX - 1) + 4 * i;
 }
 
index cf22dbf..5c0ae11 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  *  Copyright (C) 2011-2012 - DIGITEO - Manuel Juliachs
+ *  Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
  *
  *  This file must be used under the terms of the CeCILL.
  *  This source file is licensed as described in the file COPYING, which
@@ -11,6 +12,9 @@
  */
 
 #include "NgonGridMatplotData.hxx"
+#include "Texture.hxx"
+
+#include <climits>
 
 extern "C" {
 #include <string.h>
@@ -19,51 +23,105 @@ extern "C" {
 #include "graphicObjectProperties.h"
 }
 
+const bool NgonGridMatplotData::isLittleEndian = NgonGridMatplotData::initEndian();
+bool NgonGridMatplotData::isABGRSupported = false;
+
 NgonGridMatplotData::NgonGridMatplotData(void)
 {
-
+    this->data = NULL;
+    this->dataSize = 0;
+    this->scilabData = NULL;
+    this->type = 0;
+    this->imagetype = MATPLOT_NONE;
 }
 
 NgonGridMatplotData::~NgonGridMatplotData(void)
 {
-
+    disposeTextureData();
+    if (this->scilabData)
+    {
+        delete[] (unsigned char *)this->scilabData;
+        this->scilabData = NULL;
+    }
 }
 
 int NgonGridMatplotData::getPropertyFromName(int propertyName)
 {
     switch (propertyName)
     {
-    case __GO_DATA_MODEL_GRID_SIZE__ :
-        return GRID_SIZE;
-    case __GO_DATA_MODEL_MATPLOT_BOUNDS__ :
-        return MATPLOT_BOUNDS;
-    case __GO_DATA_MODEL_MATPLOT_TYPE__ :
-        return MATPLOT_TYPE;
-    case __GO_DATA_MODEL_Z__ :
-        return Z_COORDINATES;
-    default :
-        return NgonGridData::getPropertyFromName(propertyName);
+        case __GO_DATA_MODEL_GRID_SIZE__ :
+            return GRID_SIZE;
+        case __GO_DATA_MODEL_MATPLOT_BOUNDS__ :
+            return MATPLOT_BOUNDS;
+        case __GO_DATA_MODEL_MATPLOT_TYPE__ :
+            return MATPLOT_TYPE;
+        case __GO_DATA_MODEL_Z__ :
+            return Z_COORDINATES;
+        case __GO_DATA_MODEL_MATPLOT_GL_TYPE__ :
+            return MATPLOT_GL_TYPE;
+        case __GO_DATA_MODEL_MATPLOT_DATA_INFOS__ :
+            return MATPLOT_DATA_INFOS;
+        case __GO_DATA_MODEL_MATPLOT_DATA_TYPE__ :
+            return MATPLOT_DATA_TYPE;
+        case __GO_DATA_MODEL_MATPLOT_DATA_ORDER__ :
+            return MATPLOT_DATA_ORDER;
+        case __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__ :
+            return MATPLOT_IMAGE_TYPE;
+        case __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__ :
+            return MATPLOT_IMAGE_DATA;
+        case __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__ :
+            return MATPLOT_IMAGE_DATASIZE;
+        default :
+            return NgonGridData::getPropertyFromName(propertyName);
     }
-
 }
 
 int NgonGridMatplotData::setDataProperty(int property, void const* value, int numElements)
 {
-    if (property == GRID_SIZE)
-    {
-        return setGridSize((int const*) value);
-    }
-    else if (property == MATPLOT_BOUNDS)
-    {
-        setBounds((double const*) value);
-    }
-    else if (property == Z_COORDINATES)
+    switch (property)
     {
-        setDataZ((double const*) value, numElements);
-    }
-    else
-    {
-        return NgonGridData::setDataProperty(property, value, numElements);
+        case GRID_SIZE :
+        {
+            return setGridSize((int const*) value);
+        }
+        case MATPLOT_BOUNDS :
+        {
+            setBounds((double const*) value);
+            break;
+        }
+        case Z_COORDINATES :
+        {
+            setDataZ((double const*) value, numElements);
+            break;
+        }
+        case MATPLOT_IMAGE_TYPE :
+        {
+            return setImageType(*((int const*) value));
+        }
+        case MATPLOT_DATA_INFOS :
+        {
+            setDataInfos(*((int const*) value));
+            break;
+        }
+        case MATPLOT_DATA_TYPE :
+        {
+            setDataType(*((int const*) value));
+            break;
+        }
+        case MATPLOT_DATA_ORDER :
+        {
+            setDataOrder(*((int const*) value));
+            break;
+        }
+        case MATPLOT_IMAGE_DATA :
+        {
+            setImageData((void const *) value, numElements);
+            break;
+        }
+        default :
+        {
+            return NgonGridData::setDataProperty(property, value, numElements);
+        }
     }
 
     return 1;
@@ -71,21 +129,63 @@ int NgonGridMatplotData::setDataProperty(int property, void const* value, int nu
 
 void NgonGridMatplotData::getDataProperty(int property, void **_pvData)
 {
-    if (property == MATPLOT_BOUNDS)
+    switch (property)
     {
-        *_pvData = getBounds();
-    }
-    else if (property == MATPLOT_TYPE)
-    {
-        ((int *) *_pvData)[0] = getType();
-    }
-    else if (property == Z_COORDINATES)
-    {
-        *_pvData = getDataZ();
-    }
-    else
-    {
-        NgonGridData::getDataProperty(property, _pvData);
+        case MATPLOT_BOUNDS :
+        {
+            *_pvData = getBounds();
+            break;
+        }
+        case MATPLOT_TYPE :
+        {
+            ((int *) *_pvData)[0] = getType();
+            break;
+        }
+        case Z_COORDINATES :
+        {
+            *_pvData = getScilabData();
+            break;
+        }
+        case MATPLOT_IMAGE_TYPE :
+        {
+            ((int *) *_pvData)[0] = getImageType();
+            break;
+        }
+        case MATPLOT_GL_TYPE :
+        {
+            ((int *) *_pvData)[0] = getGLType();
+            break;
+        }
+        case MATPLOT_DATA_INFOS :
+        {
+            ((int *) *_pvData)[0] = getDataInfos();
+            break;
+        }
+        case MATPLOT_DATA_TYPE :
+        {
+            ((int *) *_pvData)[0] = getDataType();
+            break;
+        }
+        case MATPLOT_DATA_ORDER :
+        {
+            ((int *) *_pvData)[0] = getDataOrder();
+            break;
+        }
+        case MATPLOT_IMAGE_DATA :
+        {
+            *_pvData = getImageData();
+            break;
+        }
+        case MATPLOT_IMAGE_DATASIZE :
+        {
+            ((unsigned int *) *_pvData)[0] = getImageDataSize();
+            break;
+        }
+        default :
+        {
+            NgonGridData::getDataProperty(property, _pvData);
+            break;
+        }
     }
 }
 
@@ -156,6 +256,11 @@ int NgonGridMatplotData::setGridSize(int const* gridSize)
         }
     }
 
+    if (!result || (!xModified && !yModified))
+    {
+        return result;
+    }
+
     if (xSize > 0 && ySize > 0)
     {
         formerGridSize = (xSize - 1) * (ySize - 1);
@@ -333,9 +438,7 @@ void NgonGridMatplotData::computeCoordinates(void)
         {
             yCoordinates[i] = min + (double) i * (max - min) / (double) numElements;
         }
-
     }
-
 }
 
 void NgonGridMatplotData::setDataZ(double const* data, int numElements)
@@ -351,7 +454,235 @@ void NgonGridMatplotData::setDataZ(double const* data, int numElements)
     }
 }
 
+int NgonGridMatplotData::setImageType(int imagetype)
+{
+    const ImageType type = (ImageType)imagetype;
+
+    if (this->imagetype != type)
+    {
+        int grid[4] = {xSize, 1, ySize, 1};
+        if (this->datatype == MATPLOT_UChar || this->datatype == MATPLOT_Char)
+        {
+            if (this->imagetype == MATPLOT_RGB)
+            {
+                grid[2] = (ySize - 1) * 3 + 1;
+            }
+            else if (this->imagetype == MATPLOT_RGBA)
+            {
+                grid[2] = (ySize - 1) * 4 + 1;
+            }
+
+            if (type == MATPLOT_RGB)
+            {
+                if ((grid[2] - 1) % 3 != 0)
+                {
+                    return 0;
+                }
+                grid[2] = (grid[2] - 1) / 3 + 1;
+            }
+            else if (type == MATPLOT_RGBA)
+            {
+                if ((grid[2] - 1) % 4 != 0)
+                {
+                    return 0;
+                }
+                grid[2] = (grid[2] - 1) / 4 + 1;
+            }
+
+            this->setGridSize(grid);
+        }
+
+        this->imagetype = type;
+
+        if (this->scilabData)
+        {
+            setImageData(this->scilabData, (xSize - 1) * (ySize - 1));
+        }
+    }
+
+    return 1;
+}
+
+int NgonGridMatplotData::getImageType()
+{
+    return (int)this->imagetype;
+}
+
+int NgonGridMatplotData::getGLType()
+{
+    return (int)this->gltype;
+}
+
+int NgonGridMatplotData::getDataType()
+{
+    return (int)this->datatype;
+}
+
+void NgonGridMatplotData::setDataType(int datatype)
+{
+    if (this->datatype != (DataType)datatype)
+    {
+        this->datatype = (DataType)datatype;
+        disposeTextureData();
+    }
+}
+
+int NgonGridMatplotData::getDataOrder()
+{
+    return (int)this->dataorder;
+}
+
+void NgonGridMatplotData::setDataOrder(int dataorder)
+{
+    this->dataorder = (DataOrder)dataorder;
+}
+
+void * NgonGridMatplotData::getImageData()
+{
+    if (this->data)
+    {
+        return this->data;
+    }
+    else if (this->scilabData)
+    {
+        setImageData(this->scilabData, (xSize - 1) * (ySize - 1));
+        return this->data;
+    }
+
+    return NULL;
+}
+
+void * NgonGridMatplotData::getScilabData()
+{
+    return this->scilabData;
+}
+
+unsigned int NgonGridMatplotData::getImageDataSize()
+{
+    return this->dataSize;
+}
+
+void NgonGridMatplotData::setDataInfos(int infos)
+{
+    setDataType(infos & 0xFF);
+    setDataOrder((infos & 0xFF00) >> 8);
+    setImageType((infos & 0xFF0000) >> 16);
+}
+
+int NgonGridMatplotData::getDataInfos()
+{
+    return buildMatplotType(this->datatype, this->dataorder, this->imagetype);
+}
+
+void NgonGridMatplotData::setImageData(void const* data, const int numElements)
+{
+    if (!data)
+    {
+        disposeTextureData();
+        return;
+    }
+
+    unsigned int dataSize = 0;
+    const int N = ySize - 1;
+    const int M = xSize - 1;
+    const int NM = N * M;
+
+    if (numElements > NM)
+    {
+        return;
+    }
+
+    if (data != this->scilabData)
+    {
+        if (scilabData)
+        {
+            delete[] (unsigned char *)scilabData;
+            scilabData = NULL;
+        }
+
+        unsigned int _size;
+
+        switch (datatype)
+        {
+            case MATPLOT_HM3_Char :
+            case MATPLOT_HM3_UChar :
+                _size = numElements * 3;
+                break;
+            case MATPLOT_HM3_Double :
+                _size = numElements * sizeof(double) * 3;
+                break;
+            case MATPLOT_HM4_Char :
+            case MATPLOT_HM4_UChar :
+                _size = numElements * 4;
+                break;
+            case MATPLOT_HM4_Double :
+                _size = numElements * sizeof(double) * 4;
+                break;
+            case MATPLOT_HM1_Char :
+            case MATPLOT_HM1_UChar :
+            case MATPLOT_Char :
+            case MATPLOT_UChar :
+                _size = numElements;
+                break;
+            case MATPLOT_Int :
+            case MATPLOT_UInt :
+                _size = numElements * sizeof(int);
+                break;
+            case MATPLOT_Short :
+            case MATPLOT_UShort :
+                _size = numElements * sizeof(short);
+                break;
+            case MATPLOT_HM1_Double :
+            case MATPLOT_Double :
+                _size = numElements * sizeof(double);
+                break;
+        }
+        this->scilabData = new unsigned char[_size];
+        // todo: on peut ameliorer ca
+        // pr certains type de donnees (et certains modes) scilabData == data
+        // dc on peut eviter cette copie
+        memcpy(this->scilabData, data, _size);
+    }
+
+    void * dest = this->data;
+    if (this->imagetype == MATPLOT_INDEX)
+    {
+        this->gltype = MATPLOT_GL_RGBA;
+    }
+    else if (Texture::getImage(data, numElements, this->datatype, this->imagetype, &(this->data), &(this->dataSize), &(this->gltype)))
+    {
+        if (dest)
+        {
+            delete[] (unsigned char *)dest;
+        }
+    }
+
+    //std::cout << this->imagetype << "::" << this->datatype << "::" << this->dataorder << "::" << this->dataSize << "::" << (void*)this->data << std::endl;
+}
+
 int NgonGridMatplotData::getType(void)
 {
     return type;
 }
+
+bool NgonGridMatplotData::initEndian()
+{
+    const int num = 1;
+
+    return *(char *)&num == 1;
+}
+
+void NgonGridMatplotData::setABGRSupported(bool _isABGRSupported)
+{
+    isABGRSupported = _isABGRSupported;
+}
+
+void NgonGridMatplotData::disposeTextureData(void)
+{
+    if (this->data)
+    {
+        delete[] (unsigned char *)this->data;
+        this->data = NULL;
+        this->dataSize = 0;
+    }
+}
index 3804001..23b80bc 100644 (file)
@@ -15,6 +15,8 @@
 #include "NgonGridDataDecomposer.hxx"
 #include "NgonGridMatplotDataDecomposer.hxx"
 
+#include <iostream>
+
 extern "C"
 {
 #include <stdlib.h>
@@ -71,7 +73,7 @@ void NgonGridMatplotDataDecomposer::fillVertices(char* id, float* buffer, int bu
 
 /* To do: refactor with its parent class' same method */
 void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLength, int elementsSize, int coordinateMask, double* scale, double* translation, int logMask,
-                                                     double* x, double* y, double* z, int numX, int numY)
+        double* x, double* y, double* z, int numX, int numY)
 {
     double xi = 0.;
     double yj = 0.;
@@ -97,7 +99,7 @@ void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLe
         for (int i = 0; i < numX; i++)
         {
             xi = (double) i * x[1] + x[0];
-            bufferOffset = elementsSize*(numX*j + i);
+            bufferOffset = elementsSize * (numX * j + i);
 
             if (coordinateMask & 0x1)
             {
@@ -111,32 +113,32 @@ void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLe
 
             if (coordinateMask  & 0x2)
             {
-                buffer[bufferOffset +1] = yj * scale[1] + translation[1];
+                buffer[bufferOffset + 1] = yj * scale[1] + translation[1];
             }
 
             if (coordinateMask & 0x4)
             {
                 zij = getZCoordinate(z, numX, numY, i, j, logMask & 0x4);
 
-                buffer[bufferOffset +2] = zij * scale[2] + translation[2];
+                buffer[bufferOffset + 2] = zij * scale[2] + translation[2];
             }
 
             if (elementsSize == 4 && (coordinateMask & 0x8))
             {
-                buffer[bufferOffset +3] = 1.0;
+                buffer[bufferOffset + 3] = 1.0;
             }
         }
     }
 #else
     bufferOffset = 0;
 
-    for (int j = 0; j < numY-1; j++)
+    for (int j = 0; j < numY - 1; j++)
     {
         double ycoords[4];
         int yindices[4];
 
         yj = (double) j * y[1] + y[0];
-        yjp1 = (double) (j+1) * y[1] + y[0];
+        yjp1 = (double) (j + 1) * y[1] + y[0];
 
         if (coordinateMask  & 0x2)
         {
@@ -154,16 +156,16 @@ void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLe
 
         yindices[0] = j;
         yindices[1] = j;
-        yindices[2] = j+1;
-        yindices[3] = j+1;
+        yindices[2] = j + 1;
+        yindices[3] = j + 1;
 
-        for (int i = 0; i < numX-1; i++)
+        for (int i = 0; i < numX - 1; i++)
         {
             double xcoords[4];
             int xindices[4];
 
             xi = (double) i * x[1] + x[0];
-            xip1 = (double) (i+1) * x[1] + x[0];
+            xip1 = (double) (i + 1) * x[1] + x[0];
 
             if (logMask & 0x1)
             {
@@ -177,9 +179,9 @@ void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLe
             xcoords[3] = xip1;
 
             xindices[0] = i;
-            xindices[1] = i+1;
+            xindices[1] = i + 1;
             xindices[2] = i;
-            xindices[3] = i+1;
+            xindices[3] = i + 1;
 
             for (int k = 0; k < 4; k++)
             {
@@ -190,18 +192,18 @@ void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLe
 
                 if (coordinateMask  & 0x2)
                 {
-                    buffer[bufferOffset +1] = (float)(ycoords[k] * scale[1] + translation[1]);
+                    buffer[bufferOffset + 1] = (float)(ycoords[k] * scale[1] + translation[1]);
                 }
 
-                if (coordinateMask & 0x4)
-                {
-                    zij = getZCoordinate(z, numX, numY, xindices[k], yindices[k], logMask & 0x4);
-                    buffer[bufferOffset +2] = (float)(zij * scale[2] + translation[2]);
-                }
+                /*                if (coordinateMask & 0x4)
+                                {
+                                    zij = getZCoordinate(z, numX, numY, xindices[k], yindices[k], logMask & 0x4);
+                                    buffer[bufferOffset +2] = (float)(zij * scale[2] + translation[2]);
+                                   }*/
 
                 if (elementsSize == 4 && (coordinateMask & 0x8))
                 {
-                    buffer[bufferOffset +3] = 1.0;
+                    buffer[bufferOffset + 3] = 1.0;
                 }
 
                 bufferOffset += elementsSize;
@@ -223,7 +225,7 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
     char* parent = NULL;
     char* parentFigure = NULL;
 
-    double* z = NULL;
+    void * data = NULL;
     double* colormap = NULL;
     double currentZ = 0.;
 
@@ -233,8 +235,12 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
     int* piNumY = &numY;
     int colormapSize = 0;
     int* piColormapSize = &colormapSize;
-
-    int bufferOffset = 0;
+    int datatype = -1;
+    int * pidataType = &datatype;
+    int imagetype = 0;
+    int * piImagetype = &imagetype;
+    int gltype = 0;
+    int * piGltype = &gltype;
 
     getGraphicObjectProperty(id, __GO_PARENT__, jni_string, (void**) &parent);
 
@@ -245,11 +251,12 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
     }
 
     getGraphicObjectProperty(id, __GO_PARENT_FIGURE__, jni_string, (void**) &parentFigure);
-
     getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_X__, jni_int, (void**) &piNumX);
     getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_Y__, jni_int, (void**) &piNumY);
-
-    getGraphicObjectProperty(id, __GO_DATA_MODEL_Z__, jni_double_vector, (void**) &z);
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__, jni_double_vector, &data);
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_DATA_TYPE__, jni_int, (void**) &pidataType);
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__, jni_int, (void **)&piImagetype);
+    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_GL_TYPE__, jni_int, (void **)&piGltype);
 
     /* In order not to access invalid data when reading the last line's last element */
     if (numX < 2)
@@ -261,39 +268,39 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
     getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
 
 #if PER_VERTEX_VALUES
-    for (int j = 0; j < numY-1; j++)
+    for (int j = 0; j < numY - 1; j++)
     {
-        for (int i = 0; i < numX-1; i++)
+        for (int i = 0; i < numX - 1; i++)
         {
-            currentZ = z[i*(numY-1)+(numY-2-j)];
+            currentZ = z[i * (numY - 1) + (numY - 2 - j)];
 
             ColorComputer::getDirectColor((double) currentZ - 1.0, colormap, colormapSize, &buffer[bufferOffset]);
 
             if (elementsSize == 4)
             {
-                buffer[bufferOffset+3] = 1.0;
+                buffer[bufferOffset + 3] = 1.0;
             }
 
             bufferOffset += elementsSize;
         }
 
         /* Last element (same as the above loop's last) */
-        currentZ  = z[(numX-2)*(numY-1)+(numY-2-j)];
+        currentZ  = z[(numX - 2) * (numY - 1) + (numY - 2 - j)];
 
         ColorComputer::getDirectColor((double) currentZ - 1.0, colormap, colormapSize, &buffer[bufferOffset]);
 
         if (elementsSize == 4)
         {
-            buffer[bufferOffset+3] = 1.0;
+            buffer[bufferOffset + 3] = 1.0;
         }
 
         bufferOffset += elementsSize;
     }
 
     /* Last line */
-    for (int i = 0; i < numX-1; i++)
+    for (int i = 0; i < numX - 1; i++)
     {
-        currentZ = z[(numY-1)*i+0];
+        currentZ = z[(numY - 1) * i + 0];
 
         ColorComputer::getDirectColor((double) currentZ - 1.0, colormap, colormapSize, &buffer[bufferOffset]);
 
@@ -301,37 +308,37 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
 
         if (elementsSize == 4)
         {
-            buffer[bufferOffset+3] = 1.0;
+            buffer[bufferOffset + 3] = 1.0;
         }
     }
 
     /* Last element (same as the above loop's last) */
-    currentZ  = z[(numX-2)*(numY-1)+0];
+    currentZ  = z[(numX - 2) * (numY - 1) + 0];
 
     ColorComputer::getDirectColor((double) currentZ - 1.0, colormap, colormapSize, &buffer[bufferOffset]);
 
     if (elementsSize == 4)
     {
-        buffer[bufferOffset+3] = 1.0;
+        buffer[bufferOffset + 3] = 1.0;
     }
 
 #else
 
-    for (int j = 0; j < numY-1; j++)
+    getRGBAData((ImageType)imagetype, (DataType)datatype, (GLType)gltype, data, buffer, elementsSize, numY - 1, numX - 1, colormap, colormapSize);
+
+    /*for (int j = 0; j < numY-1; j++)
     {
         for (int i = 0; i < numX-1; i++)
         {
             float facetColor[3];
 
-            currentZ = z[i*(numY-1)+(numY-2-j)];
-
+            currentZ = z[i * (numY - 1) + (numY - 2 - j)];
             ColorComputer::getDirectColor((double) currentZ - 1.0, colormap, colormapSize, facetColor);
-
             writeFacetColorToBuffer(buffer, bufferOffset, facetColor, elementsSize);
 
             bufferOffset += 4*elementsSize;
         }
-    }
+    }*/
 
 #endif
 
@@ -386,19 +393,19 @@ int NgonGridMatplotDataDecomposer::fillIndices(char* id, int* buffer, int buffer
 int NgonGridMatplotDataDecomposer::isFacetValid(double* z, double* values, int perNodeValues, int numX, int numY, int i, int j, int logUsed, int currentEdgeValid, int* nextEdgeValid)
 {
     double zij = 0.;
-    int facetValid = 0;
+    int facetValid = 1;
 
-    zij = getZCoordinate(z, numX, numY, i, j, logUsed);
+    /*zij = getZCoordinate(z, numX, numY, i, j, logUsed);
 
     facetValid = DecompositionUtils::isValid(zij);
 
     if (logUsed)
     {
         facetValid &= DecompositionUtils::isLogValid(zij);
-    }
+    }*/
 
     /* Transposed relative to Grayplot */
-    facetValid &= DecompositionUtils::isValid(values[getPointIndex(numY-1, numX-1, numY-2-j, i)]);
+    //facetValid &= DecompositionUtils::isValid(values[getPointIndex(numY-1, numX-1, numY-2-j, i)]);
 
     /* Edge validity is always 1 since it is not used at all to determine facet validity for Matplot decomposition */
     *nextEdgeValid = 1;
@@ -412,3 +419,419 @@ int NgonGridMatplotDataDecomposer::isFacetEdgeValid(double* z, double* values, i
     return 1;
 }
 
+void NgonGridMatplotDataDecomposer::getRGBAData(ImageType imagetype, DataType datatype, GLType gltype, void * data, float * buffer, int elementsSize, const int nbRow, const int nbCol, double * colormap, const int colormapSize)
+{
+    if (imagetype == MATPLOT_INDEX)
+    {
+        switch (datatype)
+        {
+            case MATPLOT_Char :
+            {
+                fillColorsByIndex((char *)data, buffer, elementsSize, nbRow, nbCol, colormap, colormapSize);
+                break;
+            }
+            case MATPLOT_UChar :
+            {
+                fillColorsByIndex((unsigned char *)data, buffer, elementsSize, nbRow, nbCol, colormap, colormapSize);
+                break;
+            }
+            case MATPLOT_Int :
+            {
+                fillColorsByIndex((int *)data, buffer, elementsSize, nbRow, nbCol, colormap, colormapSize);
+                break;
+            }
+            case MATPLOT_UInt :
+            {
+                fillColorsByIndex((unsigned int *)data, buffer, elementsSize, nbRow, nbCol, colormap, colormapSize);
+                break;
+            }
+            case MATPLOT_Short :
+            {
+                fillColorsByIndex((short *)data, buffer, elementsSize, nbRow, nbCol, colormap, colormapSize);
+                break;
+            }
+            case MATPLOT_UShort :
+            {
+                fillColorsByIndex((unsigned short *)data, buffer, elementsSize, nbRow, nbCol, colormap, colormapSize);
+                break;
+            }
+            case MATPLOT_Double :
+            {
+                fillColorsByIndex((double *)data, buffer, elementsSize, nbRow, nbCol, colormap, colormapSize);
+                break;
+            }
+        }
+    }
+    else
+    {
+        float colors[4];
+
+        switch (gltype)
+        {
+            case MATPLOT_GL_RGBA :
+            {
+                unsigned int k = 0;
+                unsigned int * ui = (unsigned int *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        const unsigned int c = ui[nbRow - 1 + i * nbRow - j];
+                        colors[0] = ((c >> 24) & 0xFF) / 255.0f;
+                        colors[1] = ((c >> 16) & 0xFF) / 255.0f;
+                        colors[2] = ((c >> 8) & 0xFF) / 255.0f;
+                        colors[3] = (c & 0xFF) / 255.0f;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, true);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RGB_FLOAT :
+            {
+                unsigned int k = 0;
+                float * f = (float *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        writeFacetColorToBuffer(buffer, k, &f[3 * (nbRow - 1 + i * nbRow - j)], elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RGB :
+            {
+                unsigned int k = 0;
+                unsigned char * uc = (unsigned char *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        const unsigned int ind = 3 * (nbRow - 1 + i * nbRow - j);
+                        colors[0] = uc[ind] / 255.0f;
+                        colors[1] = uc[ind + 1] / 255.0f;
+                        colors[2] = uc[ind + 2] / 255.0f;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RGBA_BYTE :
+            {
+                unsigned int k = 0;
+                unsigned char * uc = (unsigned char *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        const unsigned int ind = 4 * (nbRow - 1 + i * nbRow - j);
+                        colors[0] = uc[ind] / 255.0f;
+                        colors[1] = uc[ind + 1] / 255.0f;
+                        colors[2] = uc[ind + 2] / 255.0f;
+                        colors[3] = uc[ind + 3] / 255.0f;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, true);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RGBA_FLOAT :
+            {
+                unsigned int k = 0;
+                float * f = (float *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        writeFacetColorToBuffer(buffer, k, &f[4 * (nbRow - 1 + i * nbRow - j)], elementsSize, true);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_GRAY :
+            {
+                unsigned int k = 0;
+                unsigned char * uc = (unsigned char *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = uc[nbRow - 1 + i * nbRow - j] / 255.0f;
+                        colors[1] = colors[0];
+                        colors[2] = colors[0];
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RED :
+            {
+                unsigned int k = 0;
+                unsigned char * uc = (unsigned char *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = uc[nbRow - 1 + i * nbRow - j] / 255.0f;
+                        colors[1] = 0;
+                        colors[2] = 0;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_GREEN :
+            {
+                unsigned int k = 0;
+                unsigned char * uc = (unsigned char *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = 0;
+                        colors[1] = uc[nbRow - 1 + i * nbRow - j] / 255.0f;
+                        colors[2] = 0;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_BLUE :
+            {
+                unsigned int k = 0;
+                unsigned char * uc = (unsigned char *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = 0;
+                        colors[1] = 0;
+                        colors[2] = uc[nbRow - 1 + i * nbRow - j] / 255.0f;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_GRAY_FLOAT :
+            {
+                unsigned int k = 0;
+                float * f = (float *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = f[nbRow - 1 + i * nbRow - j];
+                        colors[1] = colors[0];
+                        colors[2] = colors[0];
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RED_FLOAT :
+            {
+                unsigned int k = 0;
+                float * f = (float *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = f[nbRow - 1 + i * nbRow - j];
+                        colors[1] = 0;
+                        colors[2] = 0;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_GREEN_FLOAT :
+            {
+                unsigned int k = 0;
+                float * f = (float *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = 0;
+                        colors[1] = f[nbRow - 1 + i * nbRow - j];
+                        colors[2] = 0;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_BLUE_FLOAT :
+            {
+                unsigned int k = 0;
+                float * f = (float *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = 0;
+                        colors[1] = 0;
+                        colors[2] = f[nbRow - 1 + i * nbRow - j];
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RGBA_4444 :
+            {
+                unsigned int k = 0;
+                unsigned short * us = (unsigned short *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        const unsigned short c = us[nbRow - 1 + i * nbRow - j];
+                        colors[0] = ((c >> 12) & 0xFF) / 15.0f;
+                        colors[1] = ((c >> 8) & 0xFF) / 15.0f;
+                        colors[2] = ((c >> 4) & 0xFF) / 15.0f;
+                        colors[3] = (c & 0xFF) / 15.0f;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, true);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RGBA_5551 :
+            {
+                unsigned int k = 0;
+                unsigned short * us = (unsigned short *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        const unsigned short c = us[nbRow - 1 + i * nbRow - j];
+                        colors[0] = ((c >> 11) & 0xFF) / 31.0f;
+                        colors[1] = ((c >> 6) & 0xFF) / 31.0f;
+                        colors[2] = ((c >> 1) & 0xFF) / 31.0f;
+                        colors[3] = (float)(c & 0x1);
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, true);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RGB_332 :
+            {
+                unsigned int k = 0;
+                unsigned char * uc = (unsigned char *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        const unsigned char c = uc[nbRow - 1 + i * nbRow - j];
+                        colors[0] = ((c >> 5) & 0x7) / 7.0f;
+                        colors[1] = ((c >> 2) & 0x7) / 7.0f;
+                        colors[2] = (c & 0x3) / 3.0f;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_GRAY_16 :
+            {
+                unsigned int k = 0;
+                unsigned short * us = (unsigned short *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = us[nbRow - 1 + i * nbRow - j] / 65535.0f;
+                        colors[1] = colors[0];
+                        colors[2] = colors[0];
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_RED_16 :
+            {
+                unsigned int k = 0;
+                unsigned short * us = (unsigned short *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = us[nbRow - 1 + i * nbRow - j] / 65535.0f;
+                        colors[1] = 0;
+                        colors[2] = 0;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_GREEN_16 :
+            {
+                unsigned int k = 0;
+                unsigned short * us = (unsigned short *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = 0;
+                        colors[1] = us[nbRow - 1 + i * nbRow - j] / 65535.0f;
+                        colors[2] = 0;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+            case MATPLOT_GL_BLUE_16 :
+            {
+                unsigned int k = 0;
+                unsigned short * us = (unsigned short *)data;
+
+                for (unsigned int j = 0; j < nbRow; j++)
+                {
+                    for (unsigned int i = 0; i < nbCol; i++)
+                    {
+                        colors[0] = 0;
+                        colors[1] = 0;
+                        colors[2] = us[nbRow - 1 + i * nbRow - j] / 65535.0f;
+                        writeFacetColorToBuffer(buffer, k, colors, elementsSize, false);
+                        k += 4 * elementsSize;
+                    }
+                }
+                break;
+            }
+        }
+    }
+}
diff --git a/scilab/modules/graphic_objects/src/cpp/Texture.cpp b/scilab/modules/graphic_objects/src/cpp/Texture.cpp
new file mode 100644 (file)
index 0000000..367f308
--- /dev/null
@@ -0,0 +1,1293 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "Texture.hxx"
+#include <cstring>
+
+float Texture::GrayR[256];
+float Texture::GrayG[256];
+float Texture::GrayB[256];
+unsigned char Texture::RGB8R[256];
+unsigned char Texture::RGB8G[256];
+unsigned char Texture::RGB8B[256];
+unsigned char Texture::R12[256];
+const bool Texture::isGrayTableInit = Texture::initGrayTables();
+const bool Texture::isRGB8TableInit = Texture::initRGB8Tables();
+const bool Texture::isR12TableInit = Texture::initR12Table();
+
+#define _DOUBLE_TO_UCHAR_(x) ((x) < 0 ? 0 : ((x) > 1 ? 0xFF : ((unsigned char)((x) * 0xFF))))
+
+bool Texture::getImage(void const * data, const int numElements, const DataType datatype, const ImageType imagetype, void ** dest, unsigned int * dataSize, GLType * gltype)
+{
+    unsigned int size = 0;
+    bool ret = false;
+
+    switch (imagetype)
+    {
+        case MATPLOT_RGB :
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                    size = numElements * sizeof(int);
+                    break;
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                    size = numElements * sizeof(float) * 3;
+                    break;
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                    size = numElements * 3;
+                    break;
+                case MATPLOT_Int :
+                case MATPLOT_UInt :
+                    size = numElements * sizeof(int);
+                    break;
+                case MATPLOT_Short :
+                case MATPLOT_UShort :
+                    size = numElements * sizeof(short);
+                    break;
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                    size = numElements * sizeof(int);
+                    break;
+            }
+            break;
+        case MATPLOT_RGBA :
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                    size = numElements * sizeof(int);
+                    break;
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                    size = numElements * sizeof(float) * 4;
+                    break;
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                    size = numElements * 4;
+                    break;
+                case MATPLOT_Int :
+                case MATPLOT_UInt :
+                    size = numElements * sizeof(int);
+                    break;
+                case MATPLOT_Short :
+                case MATPLOT_UShort :
+                    size = numElements * sizeof(short);
+                    break;
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                    size = numElements * sizeof(int);
+                    break;
+            }
+            break;
+        case MATPLOT_GRAY :
+        case MATPLOT_RED :
+        case MATPLOT_GREEN :
+        case MATPLOT_BLUE :
+            if (datatype == MATPLOT_Short || datatype == MATPLOT_UShort)
+            {
+                size = numElements * sizeof(short);
+            }
+            else if (datatype == MATPLOT_HM3_Double || datatype == MATPLOT_HM4_Double || datatype == MATPLOT_Double)
+            {
+                size = numElements * sizeof(float);
+            }
+            else
+            {
+                size = numElements;
+            }
+            break;
+        case MATPLOT_INDEX :
+            switch (datatype)
+            {
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                    size = numElements;
+                    break;
+                case MATPLOT_Int :
+                case MATPLOT_UInt :
+                    size = numElements * sizeof(int);
+                    break;
+                case MATPLOT_Short :
+                case MATPLOT_UShort :
+                    size = numElements * sizeof(short);
+                    break;
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                    size = numElements * sizeof(double);
+                    break;
+            }
+            break;
+        case MATPLOT_RGB_332 :
+            size = numElements;
+            break;
+        case MATPLOT_RGB_444 :
+        case MATPLOT_RGB_555 :
+        case MATPLOT_RGBA_4444 :
+        case MATPLOT_RGBA_5551 :
+            size = numElements * sizeof(short);
+            break;
+    }
+
+    if (size != *dataSize)
+    {
+        ret = true;
+        *dataSize = size;
+        *dest = new unsigned char[size];
+    }
+
+    switch (imagetype)
+    {
+        case MATPLOT_RGB :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = (R[i] << 24) | (G[i] << 16) | (B[i] << 8) | 0xFF;
+                    }
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    float * fdata = (float *) * dest;
+                    unsigned int k = 0;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[k] = (float)R[i];
+                        fdata[k + 1] = (float)G[i];
+                        fdata[k + 2] = (float)B[i];
+                        k += 3;
+                    }
+
+                    *gltype = MATPLOT_GL_RGB_FLOAT;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_Char :
+                case MATPLOT_UChar :
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGB;
+                    break;
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = (ui[i] << 8) | 0xFF;
+                    }
+
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = ui[i] | 0xFF;
+                    }
+
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+                case MATPLOT_Short :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_UShort :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = (((unsigned int)d[i]) << 8) | 0xFF;
+                    }
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_RGBA :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = (R[i] << 24) | (G[i] << 16) | (B[i] << 8) | 0xFF;
+                    }
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    const unsigned char * A = B + numElements;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = (R[i] << 24) | (G[i] << 16) | (B[i] << 8) | A[i];
+                    }
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    float * fdata = (float *) * dest;
+                    unsigned int k = 0;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[k] = (float)R[i];
+                        fdata[k + 1] = (float)G[i];
+                        fdata[k + 2] = (float)B[i];
+                        fdata[k + 3] = 1.0f;
+                        k += 4;
+                    }
+                    *gltype = MATPLOT_GL_RGBA_FLOAT;
+                    break;
+                }
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    const double * A = B + numElements;
+                    float * fdata = (float *) * dest;
+                    unsigned int k = 0;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[k] = (float)R[i];
+                        fdata[k + 1] = (float)G[i];
+                        fdata[k + 2] = (float)B[i];
+                        fdata[k + 3] = (float)A[i];
+                        k += 4;
+                    }
+                    *gltype = MATPLOT_GL_RGBA_FLOAT;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_BYTE;
+                    break;
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = (ui[i] << 8) | 0xFF;
+                    }
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+                case MATPLOT_Short :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_UShort :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    unsigned int * uidata = (unsigned int *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        uidata[i] = (unsigned int)d[i];
+                    }
+                    *gltype = MATPLOT_GL_RGBA;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_GRAY :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) (GrayR[R[i]] + GrayG[G[i]] + GrayB[B[i]]);
+                    }
+                    *gltype = MATPLOT_GL_GRAY;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    float * fdata = (float *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[i] = (float) (0.299 * R[i] + 0.587 * G[i] + 0.114 * B[i]);
+                    }
+                    *gltype = MATPLOT_GL_GRAY_FLOAT;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_GRAY;
+                    break;
+                }
+                case MATPLOT_UShort :
+                case MATPLOT_Short :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_GRAY_16;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) (GrayR[(ui[i] >> 24) & 0xFF] + GrayG[(ui[i] >> 16) & 0xFF] + GrayB[(ui[i] >> 8) & 0xFF]);
+                    }
+                    *gltype = MATPLOT_GL_GRAY;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) (GrayR[(ui[i] >> 16) & 0xFF] + GrayG[(ui[i] >> 8) & 0xFF] + GrayB[ui[i] & 0xFF]);
+                    }
+                    *gltype = MATPLOT_GL_GRAY;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    float * fdata = (float *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[i] = (float)d[i];
+                    }
+                    *gltype = MATPLOT_GL_GRAY_FLOAT;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_INDEX :
+        {
+            memcpy(*dest, data, size);
+            *gltype = MATPLOT_GL_RGBA;
+            break;
+        }
+        case MATPLOT_RED :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    memcpy(*dest, data, numElements);
+                    *gltype = MATPLOT_GL_RED;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    float * fdata = (float *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[i] = (float)d[i];
+                    }
+                    *gltype = MATPLOT_GL_RED_FLOAT;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RED;
+                    break;
+                }
+                case MATPLOT_Short :
+                case MATPLOT_UShort :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RED_16;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) ((ui[i] >> 16) & 0xFF);
+                    }
+                    *gltype = MATPLOT_GL_RED;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) ((ui[i] >> 24) & 0xFF);
+                    }
+                    *gltype = MATPLOT_GL_RED;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_GREEN :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    memcpy(*dest, (unsigned char *)data + numElements, numElements);
+                    *gltype = MATPLOT_GL_GREEN;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                {
+                    const double * d = (const double *)data + numElements;
+                    float * fdata = (float *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[i] = (float)d[i];
+                    }
+                    *gltype = MATPLOT_GL_GREEN_FLOAT;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_GREEN;
+                    break;
+                }
+                case MATPLOT_Short :
+                case MATPLOT_UShort :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_GREEN_16;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) ((ui[i] >> 8) & 0xFF);
+                    }
+                    *gltype = MATPLOT_GL_GREEN;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) ((ui[i] >> 16) & 0xFF);
+                    }
+                    *gltype = MATPLOT_GL_GREEN;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    float * fdata = (float *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[i] = (float)d[i];
+                    }
+                    *gltype = MATPLOT_GL_GREEN_FLOAT;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_BLUE :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    memcpy(*dest, (unsigned char *)data + 2 * numElements, numElements);
+                    *gltype = MATPLOT_GL_BLUE;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                {
+                    const double * d = (const double *)data + 2 * numElements;
+                    float * fdata = (float *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[i] = (float)d[i];
+                    }
+                    *gltype = MATPLOT_GL_BLUE_FLOAT;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_BLUE;
+                    break;
+                }
+                case MATPLOT_Short :
+                case MATPLOT_UShort :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_BLUE_16;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) (ui[i] & 0xFF);
+                    }
+                    *gltype = MATPLOT_GL_BLUE;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char) ((ui[i] >> 8) & 0xFF);
+                    }
+                    *gltype = MATPLOT_GL_BLUE;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    float * fdata = (float *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        fdata[i] = (float)d[i];
+                    }
+                    *gltype = MATPLOT_GL_BLUE_FLOAT;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_RGB_332 :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char)(RGB8R[R[i]] | RGB8G[G[i]] | RGB8B[B[i]]);
+                    }
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char)(RGB8R[_DOUBLE_TO_UCHAR_(R[i])] | RGB8G[_DOUBLE_TO_UCHAR_(G[i])] | RGB8B[_DOUBLE_TO_UCHAR_(B[i])]);
+                    }
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char)(RGB8R[(ui[i] & 0xFF0000) >> 16] | RGB8G[(ui[i] & 0xFF00) >> 8] | RGB8B[ui[i] & 0xFF]);
+                    }
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char)(RGB8R[(ui[i] & 0xFF000000) >> 24] | RGB8G[(ui[i] & 0xFF0000) >> 16] | RGB8B[(ui[i] & 0xFF00) >> 8]);
+                    }
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+                case MATPLOT_Short :
+                {
+                    const unsigned short * us = (const unsigned short *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char)(((us[i] & 0xE00) >> 4) | ((us[i] & 0xE0) >> 3) | ((us[i] & 0xC) >> 2));
+                    }
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+                case MATPLOT_UShort :
+                {
+                    const unsigned short * us = (const unsigned short *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        ucdata[i] = (unsigned char)(((us[i] & 0xE000) >> 8) | ((us[i] & 0xE00) >> 7) | ((us[i] & 0xC0) >> 6));
+                    }
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    unsigned char * ucdata = (unsigned char *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        const unsigned int ui = (unsigned int)d[i];
+                        ucdata[i] = (unsigned char)(RGB8R[(ui & 0xFF000000) >> 24] | RGB8G[(ui & 0xFF0000) >> 16] | RGB8B[(ui & 0xFF00) >> 8]);
+                    }
+                    *gltype = MATPLOT_GL_RGB_332;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_RGB_444 :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[R[i]] << 12) | (R12[G[i]] << 8) | (R12[B[i]] << 4) | 0xF);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[_DOUBLE_TO_UCHAR_(R[i])] << 12) | (R12[_DOUBLE_TO_UCHAR_(G[i])] << 8) | (R12[_DOUBLE_TO_UCHAR_(B[i])] << 4) | 0xF);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[(ui[i] & 0xFF0000) >> 16] << 12) | (R12[(ui[i] & 0xFF00) >> 8] << 8) | (R12[ui[i] & 0xFF] << 4) | 0xF);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[(ui[i] & 0xFF000000) >> 24] << 12) | (R12[(ui[i] & 0xFF0000) >> 16] << 8) | (R12[(ui[i] & 0xFF00) >> 8] << 4) | (R12[ui[i] & 0xFF]));
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_UShort :
+                case MATPLOT_Short :
+                {
+                    const unsigned short * us = (const unsigned short *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (us[i] << 4) | 0xF;
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        const unsigned int ui = (unsigned int)d[i];
+                        usdata[i] = (unsigned short)((R12[(ui & 0xFF0000) >> 16] << 12) | (R12[(ui & 0xFF00) >> 8] << 8) | (R12[ui & 0xFF] << 4) | 0xF);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_RGB_555 :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((R[i] & 0xF8) << 8) | ((G[i] & 0xF8) << 3) | ((B[i] & 0xF8) >> 2) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((_DOUBLE_TO_UCHAR_(R[i]) & 0xF8) << 8) | ((_DOUBLE_TO_UCHAR_(G[i]) & 0xF8) << 3) | ((_DOUBLE_TO_UCHAR_(B[i]) & 0xF8) >> 2) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((ui[i] & 0xF80000) >> 8) | ((ui[i] & 0xF800) >> 5) | ((ui[i] & 0xF8) >> 2) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((ui[i] & 0xF8000000) >> 16) | ((ui[i] & 0xF80000) >> 13) | ((ui[i] & 0xF800) >> 10) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_UShort :
+                case MATPLOT_Short :
+                {
+                    const unsigned short * ui = (const unsigned short *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (ui[i] << 1) | 0x1;
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        const unsigned int ui = (unsigned int)d[i];
+                        usdata[i] = (unsigned short)(((ui & 0xF80000) >> 13) | ((ui & 0xF800) >> 5) | ((ui & 0xF8) >> 2) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_RGBA_4444 :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[R[i]] << 12) | (R12[G[i]] << 8) | (R12[B[i]] << 4) | 0xF);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    const unsigned char * A = B + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[R[i]] << 12) | (R12[G[i]] << 8) | (R12[B[i]] << 4) | R12[A[i]]);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[_DOUBLE_TO_UCHAR_(R[i])] << 12) | (R12[_DOUBLE_TO_UCHAR_(G[i])] << 8) | (R12[_DOUBLE_TO_UCHAR_(B[i])] << 4) | 0xF);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    const double * A = B + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[_DOUBLE_TO_UCHAR_(R[i])] << 12) | (R12[_DOUBLE_TO_UCHAR_(G[i])] << 8) | (R12[_DOUBLE_TO_UCHAR_(B[i])] << 4) | R12[_DOUBLE_TO_UCHAR_(A[i])]);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[(ui[i] & 0xFF0000) >> 16] << 12) | (R12[(ui[i] & 0xFF00) >> 8] << 8) | (R12[ui[i] & 0xFF] << 4) | 0xF);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)((R12[(ui[i] & 0xFF000000) >> 24] << 12) | (R12[(ui[i] & 0xFF0000) >> 16] << 8) | (R12[(ui[i] & 0xFF00) >> 8] << 4) | R12[ui[i] & 0xFF]);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_UShort :
+                case MATPLOT_Short :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        const unsigned int ui = (unsigned int)d[i];
+                        usdata[i] = (unsigned short)((R12[(ui & 0xFF000000) >> 24] << 12) | (R12[(ui & 0xFF0000) >> 16] << 8) | (R12[(ui & 0xFF) >> 8] << 4) | R12[ui & 0xFF]);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+            }
+            break;
+        }
+        case MATPLOT_RGBA_5551 :
+        {
+            switch (datatype)
+            {
+                case MATPLOT_HM3_Char :
+                case MATPLOT_HM3_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((R[i] & 0xF8) << 8) | ((G[i] & 0xF8) << 3) | ((B[i] & 0xF8) >> 2) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM4_Char :
+                case MATPLOT_HM4_UChar :
+                {
+                    const unsigned char * R = (const unsigned char *)data;
+                    const unsigned char * G = R + numElements;
+                    const unsigned char * B = G + numElements;
+                    const unsigned char * A = B + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((R[i] & 0xF8) << 8) | ((G[i] & 0xF8) << 3) | ((B[i] & 0xF8) >> 2) | ((A[i] & 0x1)));
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM3_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((_DOUBLE_TO_UCHAR_(R[i]) & 0xF8) << 8) | ((_DOUBLE_TO_UCHAR_(G[i]) & 0xF8) << 3) | ((_DOUBLE_TO_UCHAR_(B[i]) & 0xF8) >> 2) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM4_Double :
+                {
+                    const double * R = (const double *)data;
+                    const double * G = R + numElements;
+                    const double * B = G + numElements;
+                    const double * A = B + numElements;
+                    unsigned short * usdata = (unsigned short *) * dest;
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((_DOUBLE_TO_UCHAR_(R[i]) & 0xF8) << 8) | ((_DOUBLE_TO_UCHAR_(G[i]) & 0xF8) << 3) | ((_DOUBLE_TO_UCHAR_(B[i]) & 0xF8) >> 2) | (_DOUBLE_TO_UCHAR_(A[i]) & 0x1));
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM1_Char :
+                case MATPLOT_HM1_UChar :
+                case MATPLOT_UChar :
+                case MATPLOT_Char :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_Int :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((ui[i] & 0xF80000) >> 13) | ((ui[i] & 0xF800) >> 5) | ((ui[i] & 0xF8) >> 2) | 0x1);
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_UInt :
+                {
+                    const unsigned int * ui = (const unsigned int *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        usdata[i] = (unsigned short)(((ui[i] & 0xF8000000) >> 21) | ((ui[i] & 0xF80000) >> 13) | ((ui[i] & 0xF800) >> 10) | ((ui[i] & 0xFF) >> 7));
+                    }
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_UShort :
+                case MATPLOT_Short :
+                {
+                    memcpy(*dest, data, size);
+                    *gltype = MATPLOT_GL_RGBA_5551;
+                    break;
+                }
+                case MATPLOT_HM1_Double :
+                case MATPLOT_Double :
+                {
+                    const double * d = (const double *)data;
+                    unsigned short * usdata = (unsigned short *) * dest;
+
+                    for (unsigned int i = 0; i < numElements; i++)
+                    {
+                        const unsigned int ui = (unsigned int)d[i];
+                        usdata[i] = (unsigned short)(((ui & 0xF8000000) >> 21) | ((ui & 0xF80000) >> 13) | ((ui & 0xF800) >> 10) | ((ui & 0xFF) >> 7));
+                    }
+                    *gltype = MATPLOT_GL_RGBA_4444;
+                    break;
+                }
+            }
+            break;
+        }
+    }
+
+    return ret;
+}
+
+
+bool Texture::initGrayTables()
+{
+    for (unsigned int c = 0; c < 256; c++)
+    {
+        GrayR[c] = 0.299f * (float)c;
+        GrayG[c] = 0.587f * (float)c;
+        GrayB[c] = 0.114f * (float)c;
+    }
+
+    return true;
+}
+
+bool Texture::initRGB8Tables()
+{
+    for (unsigned int c = 0; c < 256; c++)
+    {
+        RGB8R[c] = (c / 36) << 5;
+        RGB8G[c] = (c / 36) << 2;
+        RGB8B[c] = c / 81;
+    }
+
+    return true;
+}
+
+bool Texture::initR12Table()
+{
+    for (unsigned int c = 0; c < 256; c++)
+    {
+        R12[c] = c / 17;
+    }
+
+    return true;
+}
index bfd8bec..ec6f1a0 100644 (file)
@@ -35,37 +35,44 @@ void getGraphicObjectProperty(char const* _pstID, int _iName, _ReturnType_ _retu
 
     /* All the Data model properties have the DATA_MODEL prefix */
     if (_iName == __GO_DATA_MODEL__
-        || _iName == __GO_DATA_MODEL_COORDINATES__
-        || _iName == __GO_DATA_MODEL_X__
-        || _iName == __GO_DATA_MODEL_Y__
-        || _iName == __GO_DATA_MODEL_Z__
-        || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_NUM_ELEMENTS__
-        || _iName == __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__
-        || _iName == __GO_DATA_MODEL_NUM_VERTICES_PER_GON__
-        || _iName == __GO_DATA_MODEL_NUM_GONS__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SET__
-        || _iName == __GO_DATA_MODEL_COLORS__
-        || _iName == __GO_DATA_MODEL_NUM_COLORS__
-        || _iName == __GO_DATA_MODEL_NUM_VERTICES__
-        || _iName == __GO_DATA_MODEL_NUM_INDICES__
-        || _iName == __GO_DATA_MODEL_INDICES__
-        || _iName == __GO_DATA_MODEL_VALUES__
-        || _iName == __GO_DATA_MODEL_FEC_TRIANGLES__
-        || _iName == __GO_DATA_MODEL_NUM_X__
-        || _iName == __GO_DATA_MODEL_NUM_Y__
-        || _iName == __GO_DATA_MODEL_NUM_Z__
-        || _iName == __GO_DATA_MODEL_GRID_SIZE__
-        || _iName == __GO_DATA_MODEL_X_DIMENSIONS__
-        || _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
-        || _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
-        || _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
-        )
+            || _iName == __GO_DATA_MODEL_COORDINATES__
+            || _iName == __GO_DATA_MODEL_X__
+            || _iName == __GO_DATA_MODEL_Y__
+            || _iName == __GO_DATA_MODEL_Z__
+            || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_NUM_ELEMENTS__
+            || _iName == __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__
+            || _iName == __GO_DATA_MODEL_NUM_VERTICES_PER_GON__
+            || _iName == __GO_DATA_MODEL_NUM_GONS__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SET__
+            || _iName == __GO_DATA_MODEL_COLORS__
+            || _iName == __GO_DATA_MODEL_NUM_COLORS__
+            || _iName == __GO_DATA_MODEL_NUM_VERTICES__
+            || _iName == __GO_DATA_MODEL_NUM_INDICES__
+            || _iName == __GO_DATA_MODEL_INDICES__
+            || _iName == __GO_DATA_MODEL_VALUES__
+            || _iName == __GO_DATA_MODEL_FEC_TRIANGLES__
+            || _iName == __GO_DATA_MODEL_NUM_X__
+            || _iName == __GO_DATA_MODEL_NUM_Y__
+            || _iName == __GO_DATA_MODEL_NUM_Z__
+            || _iName == __GO_DATA_MODEL_GRID_SIZE__
+            || _iName == __GO_DATA_MODEL_X_DIMENSIONS__
+            || _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_INFOS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_ORDER__
+            || _iName == __GO_DATA_MODEL_MATPLOT_GL_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__
+       )
     {
         DataController::getGraphicObjectProperty(_pstID, _iName, _pvData);
         return;
@@ -75,152 +82,159 @@ void getGraphicObjectProperty(char const* _pstID, int _iName, _ReturnType_ _retu
     {
         switch (_returnType)
         {
+            case jni_string:
+            {
+                *(_pvData) = CallGraphicController::getGraphicObjectPropertyAsString(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            case jni_string_vector:
+            {
+                *_pvData = CallGraphicController::getGraphicObjectPropertyAsStringVector(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            case jni_double:
+            {
+                ((double *)*_pvData)[0] = (double)CallGraphicController::getGraphicObjectPropertyAsDouble(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            case jni_double_vector:
+            {
+                *_pvData = CallGraphicController::getGraphicObjectPropertyAsDoubleVector(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            case jni_bool:
+            {
+                ((int *)*_pvData)[0] = (int)CallGraphicController::getGraphicObjectPropertyAsBoolean(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            case jni_bool_vector:
+            {
+                *_pvData = CallGraphicController::getGraphicObjectPropertyAsBooleanVector(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            case jni_int:
+            {
+                ((int *)*_pvData)[0] = CallGraphicController::getGraphicObjectPropertyAsInteger(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            case jni_int_vector:
+            {
+                *_pvData = CallGraphicController::getGraphicObjectPropertyAsIntegerVector(getScilabJavaVM(), _pstID, _iName);
+                return;
+            }
+            default:
+                *_pvData = NULL;
+                return;
+        }
+    }
+    catch (std::exception &e)
+    {
+        e.what();
+        // If we have an exception, return null to scilab to manage error.
+        *_pvData = NULL;
+        return;
+    }
+
+}
+
+
+void releaseGraphicObjectProperty(int _iName, void * _pvData, enum _ReturnType_ _returnType, int numElements)
+{
+
+    /* All the Data model properties have the DATA_MODEL prefix */
+    if (_iName == __GO_DATA_MODEL__
+            || _iName == __GO_DATA_MODEL_COORDINATES__
+            || _iName == __GO_DATA_MODEL_X__
+            || _iName == __GO_DATA_MODEL_Y__
+            || _iName == __GO_DATA_MODEL_Z__
+            || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_NUM_ELEMENTS__
+            || _iName == __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__
+            || _iName == __GO_DATA_MODEL_NUM_VERTICES_PER_GON__
+            || _iName == __GO_DATA_MODEL_NUM_GONS__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SET__
+            || _iName == __GO_DATA_MODEL_COLORS__
+            || _iName == __GO_DATA_MODEL_NUM_COLORS__
+            || _iName == __GO_DATA_MODEL_NUM_VERTICES__
+            || _iName == __GO_DATA_MODEL_NUM_INDICES__
+            || _iName == __GO_DATA_MODEL_INDICES__
+            || _iName == __GO_DATA_MODEL_VALUES__
+            || _iName == __GO_DATA_MODEL_FEC_TRIANGLES__
+            || _iName == __GO_DATA_MODEL_NUM_X__
+            || _iName == __GO_DATA_MODEL_NUM_Y__
+            || _iName == __GO_DATA_MODEL_NUM_Z__
+            || _iName == __GO_DATA_MODEL_GRID_SIZE__
+            || _iName == __GO_DATA_MODEL_X_DIMENSIONS__
+            || _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_INFOS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_ORDER__
+            || _iName == __GO_DATA_MODEL_MATPLOT_GL_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__
+       )
+    {
+        // passed by reference, do not free them
+        return;
+    }
+
+    switch (_returnType)
+    {
         case jni_string:
         {
-            *(_pvData) = CallGraphicController::getGraphicObjectPropertyAsString(getScilabJavaVM(), _pstID, _iName);
+            delete[] (char*) _pvData;
             return;
         }
         case jni_string_vector:
         {
-            *_pvData = CallGraphicController::getGraphicObjectPropertyAsStringVector(getScilabJavaVM(), _pstID, _iName);
+            char** data = (char**) _pvData;
+            for (int i = 0; i < numElements; ++i)
+            {
+                delete[] data[i];
+            }
+            delete[] data;
             return;
         }
         case jni_double:
         {
-            ((double *)*_pvData)[0] = (double)CallGraphicController::getGraphicObjectPropertyAsDouble(getScilabJavaVM(), _pstID, _iName);
+            // passed by value
             return;
         }
         case jni_double_vector:
         {
-            *_pvData = CallGraphicController::getGraphicObjectPropertyAsDoubleVector(getScilabJavaVM(), _pstID, _iName);
+            delete[] (double*) _pvData;
             return;
         }
         case jni_bool:
         {
-            ((int *)*_pvData)[0] = (int)CallGraphicController::getGraphicObjectPropertyAsBoolean(getScilabJavaVM(), _pstID, _iName);
+            // passed by value
             return;
         }
         case jni_bool_vector:
         {
-            *_pvData = CallGraphicController::getGraphicObjectPropertyAsBooleanVector(getScilabJavaVM(), _pstID, _iName);
+            delete[] (int*) _pvData;
             return;
         }
         case jni_int:
         {
-            ((int *)*_pvData)[0] = CallGraphicController::getGraphicObjectPropertyAsInteger(getScilabJavaVM(), _pstID, _iName);
+            // passed by value
             return;
         }
         case jni_int_vector:
         {
-            *_pvData = CallGraphicController::getGraphicObjectPropertyAsIntegerVector(getScilabJavaVM(), _pstID, _iName);
+            delete[] (int*) _pvData;
             return;
         }
         default:
-            *_pvData = NULL;
             return;
-        }
-    }
-    catch (std::exception &e)
-    {
-        e.what();
-        // If we have an exception, return null to scilab to manage error.
-        *_pvData = NULL;
-        return;
-    }
-
-}
-
-
-void releaseGraphicObjectProperty(int _iName, void * _pvData, enum _ReturnType_ _returnType, int numElements)
-{
-
-    /* All the Data model properties have the DATA_MODEL prefix */
-    if (_iName == __GO_DATA_MODEL__
-        || _iName == __GO_DATA_MODEL_COORDINATES__
-        || _iName == __GO_DATA_MODEL_X__
-        || _iName == __GO_DATA_MODEL_Y__
-        || _iName == __GO_DATA_MODEL_Z__
-        || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_NUM_ELEMENTS__
-        || _iName == __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__
-        || _iName == __GO_DATA_MODEL_NUM_VERTICES_PER_GON__
-        || _iName == __GO_DATA_MODEL_NUM_GONS__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SET__
-        || _iName == __GO_DATA_MODEL_COLORS__
-        || _iName == __GO_DATA_MODEL_NUM_COLORS__
-        || _iName == __GO_DATA_MODEL_NUM_VERTICES__
-        || _iName == __GO_DATA_MODEL_NUM_INDICES__
-        || _iName == __GO_DATA_MODEL_INDICES__
-        || _iName == __GO_DATA_MODEL_VALUES__
-        || _iName == __GO_DATA_MODEL_FEC_TRIANGLES__
-        || _iName == __GO_DATA_MODEL_NUM_X__
-        || _iName == __GO_DATA_MODEL_NUM_Y__
-        || _iName == __GO_DATA_MODEL_NUM_Z__
-        || _iName == __GO_DATA_MODEL_GRID_SIZE__
-        || _iName == __GO_DATA_MODEL_X_DIMENSIONS__
-        || _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
-        || _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
-        || _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
-        )
-    {
-        // passed by reference, do not free them
-        return;
-    }
-
-    switch (_returnType)
-    {
-    case jni_string:
-    {
-        delete[] (char*) _pvData;
-        return;
-    }
-    case jni_string_vector:
-    {
-        char** data = (char**) _pvData;
-        for (int i = 0; i < numElements; ++i)
-        {
-            delete[] data[i];
-        }
-        delete[] data;
-        return;
-    }
-    case jni_double:
-    {
-        // passed by value
-        return;
-    }
-    case jni_double_vector:
-    {
-        delete[] (double*) _pvData;
-        return;
-    }
-    case jni_bool:
-    {
-        // passed by value
-        return;
-    }
-    case jni_bool_vector:
-    {
-        delete[] (int*) _pvData;
-        return;
-    }
-    case jni_int:
-    {
-        // passed by value
-        return;
-    }
-    case jni_int_vector:
-    {
-        delete[] (int*) _pvData;
-        return;
-    }
-    default:
-        return;
     }
 
 }
index bf087bf..d65a0d1 100644 (file)
@@ -53,37 +53,42 @@ BOOL setGraphicObjectProperty(char const* _pstID, int _iName, void const* _pvVal
 
     // Special Case for data, no need to go through Java.
     if (_iName == __GO_DATA_MODEL__
-        || _iName == __GO_DATA_MODEL_COORDINATES__
-        || _iName == __GO_DATA_MODEL_X__
-        || _iName == __GO_DATA_MODEL_Y__
-        || _iName == __GO_DATA_MODEL_Z__
-        || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT__
-        || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__
-        || _iName == __GO_DATA_MODEL_NUM_ELEMENTS__
-        || _iName == __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__
-        || _iName == __GO_DATA_MODEL_NUM_VERTICES_PER_GON__
-        || _iName == __GO_DATA_MODEL_NUM_GONS__
-        || _iName == __GO_DATA_MODEL_Z_COORDINATES_SET__
-        || _iName == __GO_DATA_MODEL_COLORS__
-        || _iName == __GO_DATA_MODEL_NUM_COLORS__
-        || _iName == __GO_DATA_MODEL_NUM_VERTICES__
-        || _iName == __GO_DATA_MODEL_NUM_INDICES__
-        || _iName == __GO_DATA_MODEL_INDICES__
-        || _iName == __GO_DATA_MODEL_VALUES__
-        || _iName == __GO_DATA_MODEL_FEC_TRIANGLES__
-        || _iName == __GO_DATA_MODEL_NUM_X__
-        || _iName == __GO_DATA_MODEL_NUM_Y__
-        || _iName == __GO_DATA_MODEL_NUM_Z__
-        || _iName == __GO_DATA_MODEL_GRID_SIZE__
-        || _iName == __GO_DATA_MODEL_X_DIMENSIONS__
-        || _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
-        || _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
-        || _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
-        )
+            || _iName == __GO_DATA_MODEL_COORDINATES__
+            || _iName == __GO_DATA_MODEL_X__
+            || _iName == __GO_DATA_MODEL_Y__
+            || _iName == __GO_DATA_MODEL_Z__
+            || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT__
+            || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__
+            || _iName == __GO_DATA_MODEL_NUM_ELEMENTS__
+            || _iName == __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__
+            || _iName == __GO_DATA_MODEL_NUM_VERTICES_PER_GON__
+            || _iName == __GO_DATA_MODEL_NUM_GONS__
+            || _iName == __GO_DATA_MODEL_Z_COORDINATES_SET__
+            || _iName == __GO_DATA_MODEL_COLORS__
+            || _iName == __GO_DATA_MODEL_NUM_COLORS__
+            || _iName == __GO_DATA_MODEL_NUM_VERTICES__
+            || _iName == __GO_DATA_MODEL_NUM_INDICES__
+            || _iName == __GO_DATA_MODEL_INDICES__
+            || _iName == __GO_DATA_MODEL_VALUES__
+            || _iName == __GO_DATA_MODEL_FEC_TRIANGLES__
+            || _iName == __GO_DATA_MODEL_NUM_X__
+            || _iName == __GO_DATA_MODEL_NUM_Y__
+            || _iName == __GO_DATA_MODEL_NUM_Z__
+            || _iName == __GO_DATA_MODEL_GRID_SIZE__
+            || _iName == __GO_DATA_MODEL_X_DIMENSIONS__
+            || _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_INFOS__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_DATA_ORDER__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__
+            || _iName == __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__
+       )
     {
         result = BOOLtobool(DataController::setGraphicObjectProperty(_pstID, _iName, _pvValue, numElements));
         CallGraphicController::setGraphicObjectProperty(getScilabJavaVM(), _pstID, __GO_DATA_MODEL__, _pstID);
index d46cc83..5daefbe 100644 (file)
 package org.scilab.modules.graphic_objects;
 
 public class DataLoader {
-  public static int getTextureWidth(String id) {
-    return DataLoaderJNI.getTextureWidth(id);
-  }
+    public static int getTextureWidth(String id) {
+        return DataLoaderJNI.getTextureWidth(id);
+    }
+
+    public static int getTextureHeight(String id) {
+        return DataLoaderJNI.getTextureHeight(id);
+    }
+
+    public static int fillTextureData(String id, java.nio.ByteBuffer buffer, int bufferLength) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            return DataLoaderJNI.fillTextureData(id, buffer, bufferLength);
+        }
+    }
+
+    public static int fillSubTextureData(String id, java.nio.ByteBuffer buffer, int bufferLength, int x, int y, int width, int height) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            return DataLoaderJNI.fillSubTextureData(id, buffer, bufferLength, x, y, width, height);
+        }
+    }
+
+    public static int getDataSize(String id) {
+        return DataLoaderJNI.getDataSize(id);
+    }
+
+    public static void fillVertices(String id, java.nio.FloatBuffer buffer, int bufferLength, int elementsSize, int coordinateMask, double[] scale, double[] translation, int logMask) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            DataLoaderJNI.fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+        }
+    }
+
+    public static void fillColors(String id, java.nio.FloatBuffer buffer, int bufferLength, int elementsSize) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            DataLoaderJNI.fillColors(id, buffer, bufferLength, elementsSize);
+        }
+    }
+
+    public static void fillTextureCoordinates(String id, java.nio.FloatBuffer buffer, int bufferLength) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            DataLoaderJNI.fillTextureCoordinates(id, buffer, bufferLength);
+        }
+    }
 
-  public static int getTextureHeight(String id) {
-    return DataLoaderJNI.getTextureHeight(id);
-  }
+    public static int getIndicesSize(String id) {
+        return DataLoaderJNI.getIndicesSize(id);
+    }
 
-  public static int fillTextureData(String id, java.nio.ByteBuffer buffer, int bufferLength) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      return DataLoaderJNI.fillTextureData(id, buffer, bufferLength);
+    public static int fillIndices(String id, java.nio.IntBuffer buffer, int bufferLength, int logMask) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            return DataLoaderJNI.fillIndices(id, buffer, bufferLength, logMask);
+        }
     }
-  }
 
-  public static int fillSubTextureData(String id, java.nio.ByteBuffer buffer, int bufferLength, int x, int y, int width, int height) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      return DataLoaderJNI.fillSubTextureData(id, buffer, bufferLength, x, y, width, height);
+    public static int getWireIndicesSize(String id) {
+        return DataLoaderJNI.getWireIndicesSize(id);
     }
-  }
 
-  public static int getDataSize(String id) {
-    return DataLoaderJNI.getDataSize(id);
-  }
+    public static int fillWireIndices(String id, java.nio.IntBuffer buffer, int bufferLength, int logMask) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            return DataLoaderJNI.fillWireIndices(id, buffer, bufferLength, logMask);
+        }
+    }
 
-  public static void fillVertices(String id, java.nio.FloatBuffer buffer, int bufferLength, int elementsSize, int coordinateMask, double[] scale, double[] translation, int logMask) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      DataLoaderJNI.fillVertices(id, buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask);
+    public static int getMarkIndicesSize(String id) {
+        return DataLoaderJNI.getMarkIndicesSize(id);
     }
-  }
 
-  public static void fillColors(String id, java.nio.FloatBuffer buffer, int bufferLength, int elementsSize) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      DataLoaderJNI.fillColors(id, buffer, bufferLength, elementsSize);
+    public static int fillMarkIndices(String id, java.nio.IntBuffer buffer, int bufferLength) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            return DataLoaderJNI.fillMarkIndices(id, buffer, bufferLength);
+        }
     }
-  }
 
-  public static void fillTextureCoordinates(String id, java.nio.FloatBuffer buffer, int bufferLength) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      DataLoaderJNI.fillTextureCoordinates(id, buffer, bufferLength);
+    public static java.nio.ByteBuffer getTextureData(String id) {
+        return DataLoaderJNI.getTextureData(id);
     }
-  }
 
-  public static int getIndicesSize(String id) {
-    return DataLoaderJNI.getIndicesSize(id);
-  }
+    public static int getTextureImageType(String id) {
+        return DataLoaderJNI.getTextureImageType(id);
+    }
 
-  public static int fillIndices(String id, java.nio.IntBuffer buffer, int bufferLength, int logMask) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      return DataLoaderJNI.fillIndices(id, buffer, bufferLength, logMask);
+    public static int getTextureDataType(String id) {
+        return DataLoaderJNI.getTextureDataType(id);
     }
-  }
 
-  public static int getWireIndicesSize(String id) {
-    return DataLoaderJNI.getWireIndicesSize(id);
-  }
+    public static int getTextureGLType(String id) {
+        return DataLoaderJNI.getTextureGLType(id);
+    }
 
-  public static int fillWireIndices(String id, java.nio.IntBuffer buffer, int bufferLength, int logMask) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      return DataLoaderJNI.fillWireIndices(id, buffer, bufferLength, logMask);
+    public static void disposeTextureData(String id, java.nio.ByteBuffer buffer) {
+        assert buffer.isDirect() : "Buffer must be allocated direct.";
+        {
+            DataLoaderJNI.disposeTextureData(id, buffer);
+        }
     }
-  }
 
-  public static int getMarkIndicesSize(String id) {
-    return DataLoaderJNI.getMarkIndicesSize(id);
-  }
+    public static int isTextureRowOrder(String id) {
+        return DataLoaderJNI.isTextureRowOrder(id);
+    }
 
-  public static int fillMarkIndices(String id, java.nio.IntBuffer buffer, int bufferLength) {
-    assert buffer.isDirect() : "Buffer must be allocated direct.";
-    {
-      return DataLoaderJNI.fillMarkIndices(id, buffer, bufferLength);
+    public static void setABGRExt(int isAvailable) {
+        DataLoaderJNI.setABGRExt(isAvailable);
     }
-  }
 
 }
index 843d9dd..ebb1562 100644 (file)
@@ -10,27 +10,34 @@ package org.scilab.modules.graphic_objects;
 
 public class DataLoaderJNI {
 
-  static {
-    try {
-        System.loadLibrary("scigraphic_objects");
-    } catch (UnsatisfiedLinkError e) {
-      System.err.println("Native library failed to load. \n" + e);
-      System.exit(1);
+    static {
+        try {
+            System.loadLibrary("scigraphic_objects");
+        } catch (UnsatisfiedLinkError e) {
+            System.err.println("Native library failed to load. \n" + e);
+            System.exit(1);
+        }
     }
-  }
 
-  public final static native int getTextureWidth(String jarg1);
-  public final static native int getTextureHeight(String jarg1);
-  public final static native int fillTextureData(String jarg1, java.nio.ByteBuffer jarg2, int jarg3);
-  public final static native int fillSubTextureData(String jarg1, java.nio.ByteBuffer jarg2, int jarg3, int jarg4, int jarg5, int jarg6, int jarg7);
-  public final static native int getDataSize(String jarg1);
-  public final static native void fillVertices(String jarg1, java.nio.FloatBuffer jarg2, int jarg3, int jarg4, int jarg5, double[] jarg6, double[] jarg7, int jarg8);
-  public final static native void fillColors(String jarg1, java.nio.FloatBuffer jarg2, int jarg3, int jarg4);
-  public final static native void fillTextureCoordinates(String jarg1, java.nio.FloatBuffer jarg2, int jarg3);
-  public final static native int getIndicesSize(String jarg1);
-  public final static native int fillIndices(String jarg1, java.nio.IntBuffer jarg2, int jarg3, int jarg4);
-  public final static native int getWireIndicesSize(String jarg1);
-  public final static native int fillWireIndices(String jarg1, java.nio.IntBuffer jarg2, int jarg3, int jarg4);
-  public final static native int getMarkIndicesSize(String jarg1);
-  public final static native int fillMarkIndices(String jarg1, java.nio.IntBuffer jarg2, int jarg3);
+    public final static native int getTextureWidth(String jarg1);
+    public final static native int getTextureHeight(String jarg1);
+    public final static native int fillTextureData(String jarg1, java.nio.ByteBuffer jarg2, int jarg3);
+    public final static native int fillSubTextureData(String jarg1, java.nio.ByteBuffer jarg2, int jarg3, int jarg4, int jarg5, int jarg6, int jarg7);
+    public final static native int getDataSize(String jarg1);
+    public final static native void fillVertices(String jarg1, java.nio.FloatBuffer jarg2, int jarg3, int jarg4, int jarg5, double[] jarg6, double[] jarg7, int jarg8);
+    public final static native void fillColors(String jarg1, java.nio.FloatBuffer jarg2, int jarg3, int jarg4);
+    public final static native void fillTextureCoordinates(String jarg1, java.nio.FloatBuffer jarg2, int jarg3);
+    public final static native int getIndicesSize(String jarg1);
+    public final static native int fillIndices(String jarg1, java.nio.IntBuffer jarg2, int jarg3, int jarg4);
+    public final static native int getWireIndicesSize(String jarg1);
+    public final static native int fillWireIndices(String jarg1, java.nio.IntBuffer jarg2, int jarg3, int jarg4);
+    public final static native int getMarkIndicesSize(String jarg1);
+    public final static native int fillMarkIndices(String jarg1, java.nio.IntBuffer jarg2, int jarg3);
+    public final static native java.nio.ByteBuffer getTextureData(String jarg1);
+    public final static native int getTextureImageType(String jarg1);
+    public final static native int getTextureDataType(String jarg1);
+    public final static native int getTextureGLType(String jarg1);
+    public final static native void disposeTextureData(String jarg1, java.nio.ByteBuffer jarg2);
+    public final static native int isTextureRowOrder(String jarg1);
+    public final static native void setABGRExt(int jarg1);
 }
index 02e118e..b18a342 100644 (file)
@@ -38,11 +38,11 @@ public class MainDataLoader {
      * The names of Java-based objects.
      */
     private static final Set<Integer> JAVA_OBJECTS = new HashSet<Integer>(Arrays.asList(
-            GraphicObjectProperties.__GO_ARC__,
-            GraphicObjectProperties.__GO_CHAMP__,
-            GraphicObjectProperties.__GO_RECTANGLE__,
-            GraphicObjectProperties.__GO_SEGS__
-    ));
+                GraphicObjectProperties.__GO_ARC__,
+                GraphicObjectProperties.__GO_CHAMP__,
+                GraphicObjectProperties.__GO_RECTANGLE__,
+                GraphicObjectProperties.__GO_SEGS__
+            ));
 
     /**
      * Returns the data width for the given object.
@@ -62,6 +62,63 @@ public class MainDataLoader {
         return DataLoader.getTextureHeight(id);
     }
 
+    /**
+     * Returns the data for the given object.
+     * @param id of the given object.
+     * @return the data.
+     */
+    public static ByteBuffer getTextureData(String id) {
+        return DataLoader.getTextureData(id);
+    }
+
+    /**
+     * Returns the data for the given object.
+     * @param id of the given object.
+     * @return the data.
+     */
+    public static boolean isTextureRowOrder(String id) {
+        return DataLoader.isTextureRowOrder(id) != 0;
+    }
+
+    /**
+     * Returns the data for the given object.
+     * @param id of the given object.
+     * @return the data.
+     */
+    public static void disposeTextureData(String id, ByteBuffer buffer) {
+        DataLoader.disposeTextureData(id, buffer);
+    }
+
+    /**
+     * Returns the image type of the texture data.
+     * 0 for RGB, 1 for RGBA, 2 for GRAY.
+     * @param id of the given object.
+     * @return the image type.
+     */
+    public static int getTextureImageType(String id) {
+        return DataLoader.getTextureImageType(id);
+    }
+
+    /**
+     * Returns the image type of the texture data.
+     * 0 for RGB, 1 for RGBA, 2 for GRAY.
+     * @param id of the given object.
+     * @return the image type.
+     */
+    public static int getTextureDataType(String id) {
+        return DataLoader.getTextureDataType(id);
+    }
+
+    /**
+     * Returns the image type of the texture data.
+     * 0 for RGB, 1 for RGBA, 2 for GRAY.
+     * @param id of the given object.
+     * @return the image type.
+     */
+    public static int getTextureGLType(String id) {
+        return DataLoader.getTextureGLType(id);
+    }
+
     public static void fillTextureCoordinates(String id, FloatBuffer buffer, int bufferLength) {
         DataLoader.fillTextureCoordinates(id, buffer, bufferLength);
     }
@@ -81,17 +138,17 @@ public class MainDataLoader {
      * @throws ObjectRemovedException if the object no longer exist.
      */
     public static int getDataSize(String id) throws ObjectRemovedException {
-            Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
+        Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
 
-            if (type == null) {
-                throw (new ObjectRemovedException(id));
-            }
-            
-            if (JAVA_OBJECTS.contains(type)) {
-                    return JavaObjectLoader.getDataSize(id);
-            } else {
-                    return DataLoader.getDataSize(id);
-            }
+        if (type == null) {
+            throw (new ObjectRemovedException(id));
+        }
+
+        if (JAVA_OBJECTS.contains(type)) {
+            return JavaObjectLoader.getDataSize(id);
+        } else {
+            return DataLoader.getDataSize(id);
+        }
     }
 
     /**
@@ -106,18 +163,18 @@ public class MainDataLoader {
      * @throws ObjectRemovedException if the object no longer exist.
      */
     public static void fillVertices(String id, FloatBuffer buffer, int elementsSize,
-            int coordinateMask, double[] scale, double[] translation, int logMask) throws ObjectRemovedException {
-            Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
-            
-            if (type == null) {
-                throw (new ObjectRemovedException(id));
-            }
-            
-            if (JAVA_OBJECTS.contains(type)) {
-                    JavaObjectLoader.fillVertices(id, buffer, elementsSize, coordinateMask, scale, translation, logMask);
-            } else {
-                    DataLoader.fillVertices(id, buffer, buffer.capacity(), elementsSize, coordinateMask, scale, translation, logMask);
-            }
+                                    int coordinateMask, double[] scale, double[] translation, int logMask) throws ObjectRemovedException {
+        Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
+
+        if (type == null) {
+            throw (new ObjectRemovedException(id));
+        }
+
+        if (JAVA_OBJECTS.contains(type)) {
+            JavaObjectLoader.fillVertices(id, buffer, elementsSize, coordinateMask, scale, translation, logMask);
+        } else {
+            DataLoader.fillVertices(id, buffer, buffer.capacity(), elementsSize, coordinateMask, scale, translation, logMask);
+        }
     }
 
     /**
@@ -128,17 +185,17 @@ public class MainDataLoader {
      * @throws ObjectRemovedException if the object no longer exist.
      */
     public static void fillColors(String id, FloatBuffer buffer, int elementsSize) throws ObjectRemovedException {
-            Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
-            
-            if (type == null) {
-                throw (new ObjectRemovedException(id));
-            }
-            
-            if (JAVA_OBJECTS.contains(type)) {
-                    JavaObjectLoader.fillColors(id, buffer, elementsSize);
-            } else {
-                    DataLoader.fillColors(id, buffer, buffer.capacity(), elementsSize);
-            }
+        Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
+
+        if (type == null) {
+            throw (new ObjectRemovedException(id));
+        }
+
+        if (JAVA_OBJECTS.contains(type)) {
+            JavaObjectLoader.fillColors(id, buffer, elementsSize);
+        } else {
+            DataLoader.fillColors(id, buffer, buffer.capacity(), elementsSize);
+        }
     }
 
     /**
@@ -149,16 +206,16 @@ public class MainDataLoader {
      */
     public static int getIndicesSize(String id) throws ObjectRemovedException {
         Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
-            
-            if (type == null) {
-                throw (new ObjectRemovedException(id));
-            }
-            
-            if (JAVA_OBJECTS.contains(type)) {
-                    return JavaObjectLoader.getIndicesSize(id);
-            } else {
-                    return DataLoader.getIndicesSize(id);
-            }
+
+        if (type == null) {
+            throw (new ObjectRemovedException(id));
+        }
+
+        if (JAVA_OBJECTS.contains(type)) {
+            return JavaObjectLoader.getIndicesSize(id);
+        } else {
+            return DataLoader.getIndicesSize(id);
+        }
     }
 
     /**
@@ -172,15 +229,15 @@ public class MainDataLoader {
     public static int fillIndices(String id, IntBuffer buffer, int logMask) throws ObjectRemovedException {
         Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
 
-            if (type == null) {
-                throw (new ObjectRemovedException(id));
-            }
-            
-              if (JAVA_OBJECTS.contains(type)) {
-                    return JavaObjectLoader.fillIndices(id, buffer, logMask);
-            } else {
-                    return DataLoader.fillIndices(id, buffer, buffer.capacity(), logMask);
-            }
+        if (type == null) {
+            throw (new ObjectRemovedException(id));
+        }
+
+        if (JAVA_OBJECTS.contains(type)) {
+            return JavaObjectLoader.fillIndices(id, buffer, logMask);
+        } else {
+            return DataLoader.fillIndices(id, buffer, buffer.capacity(), logMask);
+        }
     }
 
     /**
@@ -192,16 +249,16 @@ public class MainDataLoader {
     public static int getWireIndicesSize(String id) throws ObjectRemovedException {
         Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
 
-            
-            if (type == null) {
-                throw (new ObjectRemovedException(id));
-            }
-            
-            if (JAVA_OBJECTS.contains(type)) {
-                    return JavaObjectLoader.getWireIndicesSize(id);
-            } else {
-                    return DataLoader.getWireIndicesSize(id);
-            }
+
+        if (type == null) {
+            throw (new ObjectRemovedException(id));
+        }
+
+        if (JAVA_OBJECTS.contains(type)) {
+            return JavaObjectLoader.getWireIndicesSize(id);
+        } else {
+            return DataLoader.getWireIndicesSize(id);
+        }
     }
 
     /**
@@ -215,15 +272,15 @@ public class MainDataLoader {
     public static int fillWireIndices(String id, IntBuffer buffer, int logMask) throws ObjectRemovedException {
         Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
 
-            if (type == null) {
-                throw (new ObjectRemovedException(id));
-            }
-            
-            if (JAVA_OBJECTS.contains(type)) {
-                    return JavaObjectLoader.fillWireIndices(id, buffer, logMask);
-            } else {
-                    return DataLoader.fillWireIndices(id, buffer, buffer.capacity(), logMask);
-            }
+        if (type == null) {
+            throw (new ObjectRemovedException(id));
+        }
+
+        if (JAVA_OBJECTS.contains(type)) {
+            return JavaObjectLoader.fillWireIndices(id, buffer, logMask);
+        } else {
+            return DataLoader.fillWireIndices(id, buffer, buffer.capacity(), logMask);
+        }
     }
 
     /**
@@ -233,7 +290,7 @@ public class MainDataLoader {
      * @return the number of mark indices.
      */
     public static int getMarkIndicesSize(String id) {
-            return 0;
+        return 0;
     }
 
     /**
@@ -244,7 +301,7 @@ public class MainDataLoader {
      * @return the number of indices actually written.
      */
     public static int fillMarkIndices(String id, IntBuffer buffer) {
-            return 0;
+        return 0;
     }
 
     public static int getLogMask(String id) {
index 9e36ebe..3df8602 100644 (file)
@@ -20,340 +20,308 @@ package org.scilab.modules.graphic_objects.graphicObject;
 
 public class GraphicObjectProperties {
 
-    public static final int __GO_ARC__   =                  1;
-    public static final int __GO_AXES__   =                 2;
-    public static final int __GO_AXESMODEL__   =            3;
-    public static final int __GO_AXIS__   =                 4;
-    public static final int __GO_CHAMP__  =                 5;
-    public static final int __GO_COMPOUND__ =               6;
-    public static final int __GO_FAC3D__ =                  7;
-    public static final int __GO_FEC__ =                    8;
-    public static final int __GO_FIGURE__ =                 9;
-    public static final int __GO_FIGUREMODEL__ =            10;
-    public static final int __GO_GRAYPLOT__ =               11;
-    public static final int __GO_LABEL__ =                  12;
-    public static final int __GO_LEGEND__ =                 13;
-    public static final int __GO_MATPLOT__ =                14;
-    public static final int __GO_PLOT3D__ =                 15;
-    public static final int __GO_POLYLINE__ =               16;
-    public static final int __GO_RECTANGLE__ =              17;
-    public static final int __GO_SEGS__ =                   18;
-    public static final int __GO_TEXT__ =                   19;
-    public static final int __GO_UICONTROL__ =              20;
-    public static final int __GO_UIMENU__ =                 21;
-    public static final int __GO_UICONTEXTMENU__ =          22;
-
-    public static final int __GO_CHILDREN__ =               23;
-    public static final int __GO_CHILDREN_COUNT__ =         24;
-    public static final int __GO_PARENT__ =                 25;
-    public static final int __GO_USER_DATA__ =              26;
-    public static final int __GO_USER_DATA_SIZE__ =         27;
-    public static final int __GO_VISIBLE__ =                28;
-    public static final int __GO_HIDDEN__ =                 29;
-    public static final int __GO_TYPE__ =                   30;
-    public static final int __GO_DATA_MODEL__ =             31;
-    public static final int __GO_PARENT_FIGURE__ =          32;
-    public static final int __GO_PARENT_AXES__ =            33;
-    public static final int __GO_HAS_LEGEND_CHILD__ =       34;
-    public static final int __GO_LEGEND_CHILD__ =           35;
-    public static final int __GO_SELECTED_CHILD__ =         36;
-    public static final int __GO_CALLBACK__ =               37;
-    public static final int __GO_CALLBACKTYPE__ =           38;
-
-    public static final int __GO_DATA_MODEL_COORDINATES__ = 39;
-    public static final int __GO_DATA_MODEL_X__ =           40;
-    public static final int __GO_DATA_MODEL_Y__ =           41;
-    public static final int __GO_DATA_MODEL_Z__ =           42;
-
-    public static final int __GO_DATA_MODEL_X_COORDINATES_SHIFT__ =     43;
-    public static final int __GO_DATA_MODEL_Y_COORDINATES_SHIFT__ =     44;
-    public static final int __GO_DATA_MODEL_Z_COORDINATES_SHIFT__ =     45;
-
-    public static final int __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__ = 46;
-    public static final int __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__ = 47;
-    public static final int __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__ = 48;
-
-    public static final int __GO_DATA_MODEL_NUM_ELEMENTS__ =            49;
-    public static final int __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__ =      50;
-    public static final int __GO_DATA_MODEL_NUM_VERTICES_PER_GON__ =    51;
-    public static final int __GO_DATA_MODEL_NUM_GONS__ =                52;
-
-    public static final int __GO_DATA_MODEL_Z_COORDINATES_SET__ =       53;
-
-    public static final int __GO_DATA_MODEL_COLORS__ =                  54;
-    public static final int __GO_DATA_MODEL_NUM_COLORS__ =              55;
-
-    public static final int __GO_DATA_MODEL_NUM_VERTICES__ =            56;
-    public static final int __GO_DATA_MODEL_NUM_INDICES__ =             57;
-    public static final int __GO_DATA_MODEL_INDICES__ =                 58;
-    public static final int __GO_DATA_MODEL_VALUES__ =                  59;
-
-    public static final int __GO_DATA_MODEL_FEC_TRIANGLES__ =           60;
-
-    public static final int __GO_DATA_MODEL_NUM_X__ =                   61;
-    public static final int __GO_DATA_MODEL_NUM_Y__ =                   62;
-    public static final int __GO_DATA_MODEL_NUM_Z__ =                   63;
-    public static final int __GO_DATA_MODEL_GRID_SIZE__ =               64;
-    public static final int __GO_DATA_MODEL_X_DIMENSIONS__ =            65;
-    public static final int __GO_DATA_MODEL_Y_DIMENSIONS__ =            66;
-
-    public static final int __GO_MATPLOT_TRANSLATE__ =                  67;
-    public static final int __GO_MATPLOT_SCALE__ =                      68;
-    public static final int __GO_DATA_MODEL_MATPLOT_BOUNDS__ =          69;
-    public static final int __GO_DATA_MODEL_MATPLOT_TYPE__ =            70;
-
-    public static final int __GO_REFERENCED__ =             71;
-    public static final int __GO_VALID__ =                  72;
-
-    public static final int __GO_POSITION__ =               73;
-    public static final int __GO_SIZE__ =                   74;
-    public static final int __GO_CANVAS__ =                 75;
-    public static final int __GO_AUTORESIZE__ =             76;
-    public static final int __GO_VIEWPORT__ =               77;
-    public static final int __GO_AXES_SIZE__ =              78;
-    public static final int __GO_FIGURE_NAME__ =            79;
-    public static final int __GO_NAME__ =                   80;
-    public static final int __GO_ID__ =                     81;
-    public static final int __GO_INFO_MESSAGE__ =           82;
-    public static final int __GO_COLORMAP__ =               83;
-    public static final int __GO_COLORMAP_SIZE__ =          84;
-    public static final int __GO_RENDERING_MODE__ =         85;
-    public static final int __GO_PIXMAP__ =                 86;
-    public static final int __GO_PIXEL_DRAWING_MODE__ =     87;
-    public static final int __GO_ANTIALIASING__ =           88;
-    public static final int __GO_IMMEDIATE_DRAWING__ =      89;
-    public static final int __GO_BACKGROUND__ =             90;
-    public static final int __GO_EVENTHANDLER__ =           91;
-    public static final int __GO_EVENTHANDLER_NAME__ =      92;
-    public static final int __GO_EVENTHANDLER_ENABLE__ =    93;
-    public static final int __GO_TAG__ =                    94;
-    public static final int __GO_ROTATION_TYPE__ =          95;
-    public static final int __GO_RESIZEFCN__ =              96;
-    public static final int __GO_CLOSEREQUESTFCN__ =        97;
-
-    public static final int __GO_UPPER_LEFT_POINT__ =       98;
-    public static final int __GO_WIDTH__ =                  99;
-    public static final int __GO_HEIGHT__ =                 100;
-    public static final int __GO_START_ANGLE__ =            101;
-    public static final int __GO_END_ANGLE__ =              102;
-    public static final int __GO_ARC_DRAWING_METHOD__ =     103;
-
-    public static final int __GO_X_AXIS_VISIBLE__ =         104;
-    public static final int __GO_X_AXIS_REVERSE__ =         105;
-    public static final int __GO_X_AXIS_GRID_COLOR__ =      106;
-    public static final int __GO_X_AXIS_LABEL__ =           107;
-    public static final int __GO_X_AXIS_LOCATION__ =           108;
-    public static final int __GO_X_AXIS_LOG_FLAG__ =        109;
-    public static final int __GO_X_AXIS_TICKS__ =                      110;
-    public static final int __GO_X_AXIS_AUTO_TICKS__ =         111;
-    public static final int __GO_X_AXIS_NUMBER_TICKS__ =       112;
-    public static final int __GO_X_AXIS_TICKS_LOCATIONS__ = 113;
-    public static final int __GO_X_AXIS_TICKS_LABELS__ =    114;
-    public static final int __GO_X_AXIS_SUBTICKS__ =        115;
-
-    public static final int __GO_Y_AXIS_VISIBLE__ =         116;
-    public static final int __GO_Y_AXIS_REVERSE__ =         117;
-    public static final int __GO_Y_AXIS_GRID_COLOR__ =      118;
-    public static final int __GO_Y_AXIS_LABEL__ =           119;
-    public static final int __GO_Y_AXIS_LOCATION__ =           120;
-    public static final int __GO_Y_AXIS_LOG_FLAG__ =        121;
-    public static final int __GO_Y_AXIS_TICKS__ =                      122;
-    public static final int __GO_Y_AXIS_AUTO_TICKS__ =         123;
-    public static final int __GO_Y_AXIS_NUMBER_TICKS__ =       124;
-    public static final int __GO_Y_AXIS_TICKS_LOCATIONS__ = 125;
-    public static final int __GO_Y_AXIS_TICKS_LABELS__ =    126;
-    public static final int __GO_Y_AXIS_SUBTICKS__ =        127;
-
-    public static final int __GO_Z_AXIS_VISIBLE__ =         128;
-    public static final int __GO_Z_AXIS_REVERSE__ =         129;
-    public static final int __GO_Z_AXIS_GRID_COLOR__ =      130;
-    public static final int __GO_Z_AXIS_LABEL__ =           131;
-    public static final int __GO_Z_AXIS_LOCATION__ =           132;
-    public static final int __GO_Z_AXIS_LOG_FLAG__ =        133;
-    public static final int __GO_Z_AXIS_TICKS__ =                      134;
-    public static final int __GO_Z_AXIS_AUTO_TICKS__ =         135;
-    public static final int __GO_Z_AXIS_NUMBER_TICKS__ =       136;
-    public static final int __GO_Z_AXIS_TICKS_LOCATIONS__ = 137;
-    public static final int __GO_Z_AXIS_TICKS_LABELS__ =    138;
-    public static final int __GO_Z_AXIS_SUBTICKS__ =        139;
-
-    public static final int __GO_AUTO_SUBTICKS__ =          140;
-
-    public static final int __GO_GRID_POSITION__ =          141;
-    public static final int __GO_TITLE__ =                  142;
-    public static final int __GO_AUTO_CLEAR__ =             143;
-    public static final int __GO_FILLED__ =                 144;
-    public static final int __GO_CAMERA__ =                 145;
-    public static final int __GO_VIEW__ =                   146;
-    public static final int __GO_ISOVIEW__ =                147;
-    public static final int __GO_CUBE_SCALING__ =           148;
-    public static final int __GO_ROTATION_ANGLES__ =        149;
-    public static final int __GO_ROTATION_ANGLES_3D__ =     150;
-    public static final int __GO_BOX_TYPE__ =               151;
-    public static final int __GO_HIDDEN_AXIS_COLOR__ =      152;
-    public static final int __GO_TIGHT_LIMITS__ =           153;
-    public static final int __GO_DATA_BOUNDS__ =            154;
-    public static final int __GO_REAL_DATA_BOUNDS__ =       155;
-    public static final int __GO_ZOOM_ENABLED__ =           156;
-    public static final int __GO_ZOOM_BOX__ =               157;
-    public static final int __GO_AUTO_SCALE__ =             158;
-    public static final int __GO_FIRST_PLOT__ =             159;
-    public static final int __GO_MARGINS__ =                160;
-    public static final int __GO_AXES_BOUNDS__ =            161;
-
-    public static final int __GO_CLIP_PROPERTY__ =          162;
-    public static final int __GO_CLIP_STATE__ =             163;
-    public static final int __GO_CLIP_BOX__ =               164;
-    public static final int __GO_CLIP_BOX_SET__ =           165;
-
-    public static final int __GO_LINE__ =                   166;
-    public static final int __GO_LINE_MODE__ =              167;
-    public static final int __GO_LINE_STYLE__ =             168;
-    public static final int __GO_LINE_THICKNESS__ =         169;
-    public static final int __GO_LINE_COLOR__ =             170;
-    public static final int __GO_FILL_MODE__ =              171;
-    public static final int __GO_MARK__ =                   172;
-    public static final int __GO_MARK_MODE__ =              173;
-    public static final int __GO_MARK_STYLE__ =             174;
-    public static final int __GO_MARK_SIZE_UNIT__ =         175;
-    public static final int __GO_MARK_SIZE__ =              176;
-    public static final int __GO_MARK_FOREGROUND__ =        177;
-    public static final int __GO_MARK_BACKGROUND__ =        178;
-
-    public static final int __GO_TICKS_DIRECTION__ =        179;
-    public static final int __GO_X_NUMBER_TICKS__ =         180;
-    public static final int __GO_Y_NUMBER_TICKS__ =         181;
-    public static final int __GO_X_TICKS_COORDS__ =         182;
-    public static final int __GO_Y_TICKS_COORDS__ =         183;
-    public static final int __GO_TICKS_COLOR__ =            184;
-    public static final int __GO_TICKS_SEGMENT__ =          185;
-    public static final int __GO_TICKS_STYLE__ =            186;
-    public static final int __GO_SUBTICKS__ =               187;
-    public static final int __GO_NUMBER_TICKS_LABELS__ =    188;
-    public static final int __GO_TICKS_LABELS__ =           189;
-    public static final int __GO_FORMATN__ =                190;
-    public static final int __GO_FONT__ =                   191;
-    public static final int __GO_FONT_STYLE__ =             192;
-    public static final int __GO_FONT_SIZE__ =              193;
-    public static final int __GO_FONT_COLOR__ =             194;
-    public static final int __GO_FONT_FRACTIONAL__ =        195;
-
-    public static final int __GO_Z_BOUNDS__ =               196;
-    public static final int __GO_OUTSIDE_COLOR__ =          197;
-    public static final int __GO_COLOR_RANGE__ =            198;
-
-    public static final int __GO_DATA_MAPPING__ =           199;
-
-    public static final int __GO_FONT_ANGLE__ =             200;
-    public static final int __GO_AUTO_POSITION__ =          201;
-    public static final int __GO_CORNERS__ =                202;
-    public static final int __GO_AUTO_ROTATION__ =          203;
-
-    public static final int __GO_LINKS__ =                  204;
-    public static final int __GO_LINKS_COUNT__ =            205;
-    public static final int __GO_LEGEND_LOCATION__ =        206;
-
-    public static final int __GO_CLOSED__ =                 207;
-    public static final int __GO_ARROW_SIZE_FACTOR__ =      208;
-    public static final int __GO_POLYLINE_STYLE__ =         209;
-    public static final int __GO_INTERP_COLOR_VECTOR__ =    210;
-    public static final int __GO_INTERP_COLOR_VECTOR_SET__ =    211;
-    public static final int __GO_INTERP_COLOR_MODE__ =      212;
-    public static final int __GO_X_SHIFT__ =                213;
-    public static final int __GO_Y_SHIFT__ =                214;
-    public static final int __GO_Z_SHIFT__ =                215;
-    public static final int __GO_BAR_WIDTH__ =              216;
-
-    public static final int __GO_SURFACE_MODE__ =           217;
-    public static final int __GO_COLOR_MODE__ =             218;
-    public static final int __GO_COLOR_FLAG__ =             219;
-
-    public static final int __GO_ALIGNMENT__ =              220;
-    public static final int __GO_BOX__ =                    221;
-    public static final int __GO_TEXT_BOX__ =               222;
-    public static final int __GO_TEXT_BOX_MODE__ =          223;
-    public static final int __GO_AUTO_DIMENSIONING__ =      224;
-
-    public static final int __GO_FORMATTED_TEXT__ =         225;
-    public static final int __GO_TEXT_ARRAY_DIMENSIONS__ =  226;
-    public static final int __GO_TEXT_STRINGS__ =           227;
-
-    public static final int __GO_BASE__ =                   228;
-    public static final int __GO_BASE_X__ =                 229;
-    public static final int __GO_BASE_Y__ =                 230;
-    public static final int __GO_BASE_Z__ =                 231;
-    public static final int __GO_DIRECTION__ =              232;
-    public static final int __GO_DIRECTION_X__ =            233;
-    public static final int __GO_DIRECTION_Y__ =            234;
-    public static final int __GO_DIRECTION_Z__ =            235;
-    public static final int __GO_ARROW_SIZE__ =             236;
-    public static final int __GO_SEGS_COLORS__ =            237;
-
-    public static final int __GO_COLORED__ =                238;
-
-    public static final int __GO_ARROWS__ =                 239;
-    public static final int __GO_NUMBER_ARROWS__ =          240;
-    public static final int __GO_CHAMP_DIMENSIONS__ =       241;
-    public static final int __GO_BOUNDING_BOX__ =           242;
-    public static final int __GO_MAX_LENGTH__ =             243;
-    public static final int __GO_MAX_USABLE_LENGTH__ =      244;
-
-    public static final int __GO_HIDDEN_COLOR__ =           245;
-
-    public static final int __GO_STYLE__ =                  246;
-    public static final int __GO_UI_CHECKBOX__ =            247;
-    public static final int __GO_UI_EDIT__ =                248;
-    public static final int __GO_UI_FRAME__ =               249;
-    public static final int __GO_UI_IMAGE__ =               250;
-    public static final int __GO_UI_LISTBOX__ =             251;
-    public static final int __GO_UI_POPUPMENU__ =           252;
-    public static final int __GO_UI_PUSHBUTTON__ =          253;
-    public static final int __GO_UI_RADIOBUTTON__ =         254;
-    public static final int __GO_UI_SLIDER__ =              255;
-    public static final int __GO_UI_TABLE__ =               256;
-    public static final int __GO_UI_TEXT__ =                257;
-
-    public static final int __GO_UI_BACKGROUNDCOLOR__ =     258;
-    public static final int __GO_UI_ENABLE__ =              259;
-    public static final int __GO_UI_FONTANGLE__ =           260;
-    public static final int __GO_UI_FONTNAME__ =            261;
-    public static final int __GO_UI_FONTSIZE__ =            262;
-    public static final int __GO_UI_FONTUNITS__ =           263;
-    public static final int __GO_UI_FONTWEIGHT__ =          264;
-    public static final int __GO_UI_FOREGROUNDCOLOR__ =     265;
-    public static final int __GO_UI_HORIZONTALALIGNMENT__ = 266;
-    public static final int __GO_UI_LISTBOXTOP__ =          267;
-    public static final int __GO_UI_LISTBOXTOP_SIZE__ =     268;
-    public static final int __GO_UI_MAX__ =                 269;
-    public static final int __GO_UI_MIN__ =                 270;
-    public static final int __GO_UI_RELIEF__ =              271;
-    public static final int __GO_UI_STRING__ =              272;
-    public static final int __GO_UI_STRING_SIZE__ =         273;
-    public static final int __GO_UI_STRING_COLNB__ =        274;
-    public static final int __GO_UI_TOOLTIPSTRING__ =       275;
-    public static final int __GO_UI_TOOLTIPSTRING_SIZE__ =  276;
-    public static final int __GO_UI_SLIDERSTEP__ =          277;
-    public static final int __GO_UI_UNITS__ =               278;
-    public static final int __GO_UI_VALUE__ =               279;
-    public static final int __GO_UI_VALUE_SIZE__ =          280;
-    public static final int __GO_UI_VERTICALALIGNMENT__ =   281;
-
-    public static final int __GO_UIPARENTMENU__ =           282;
-    public static final int __GO_UICHILDMENU__ =            283;
-    public static final int __GO_UICHECKEDMENU__ =          284;
-    public static final int __GO_UI_CHECKED__ =             285;
-    public static final int __GO_UI_LABEL__ =               286;
-    public static final int __GO_UI_MNEMONIC__ =            287;
-    public static final int __GO_UI_ACCELERATOR__ =         288;
-    public static final int __GO_UI_SEPARATOR__ =           289;
-    public static final int __GO_UI_ICON__ =                290;
-
-    public static final int __GO_CONSOLE__ =                291;
-    public static final int __GO_SHOWHIDDENHANDLES__ =      292;
-
-    public static final int __GO_WAITBAR__ =                293;
-    public static final int __GO_PROGRESSIONBAR__ =         294;
-    public static final int __GO_UI_MESSAGE__ =             295;
-    public static final int __GO_UI_MESSAGE_SIZE__ =        296;
+    public static final int __GO_ARC__ = 0;
+    public static final int __GO_AXES__ = 1;
+    public static final int __GO_AXESMODEL__ = 2;
+    public static final int __GO_AXIS__ = 3;
+    public static final int __GO_CHAMP__ = 4;
+    public static final int __GO_COMPOUND__ = 5;
+    public static final int __GO_FAC3D__ = 6;
+    public static final int __GO_FEC__ = 7;
+    public static final int __GO_FIGURE__ = 8;
+    public static final int __GO_FIGUREMODEL__ = 9;
+    public static final int __GO_GRAYPLOT__ = 10;
+    public static final int __GO_LABEL__ = 11;
+    public static final int __GO_LEGEND__ = 12;
+    public static final int __GO_MATPLOT__ = 13;
+    public static final int __GO_PLOT3D__ = 14;
+    public static final int __GO_POLYLINE__ = 15;
+    public static final int __GO_RECTANGLE__ = 16;
+    public static final int __GO_SEGS__ = 17;
+    public static final int __GO_TEXT__ = 18;
+    public static final int __GO_UICONTROL__ = 19;
+    public static final int __GO_UIMENU__ = 20;
+    public static final int __GO_UICONTEXTMENU__ = 21;
+    public static final int __GO_CHILDREN__ = 22;
+    public static final int __GO_CHILDREN_COUNT__ = 23;
+    public static final int __GO_PARENT__ = 24;
+    public static final int __GO_USER_DATA__ = 25;
+    public static final int __GO_USER_DATA_SIZE__ = 26;
+    public static final int __GO_VISIBLE__ = 27;
+    public static final int __GO_HIDDEN__ = 28;
+    public static final int __GO_TYPE__ = 29;
+    public static final int __GO_DATA_MODEL__ = 30;
+    public static final int __GO_PARENT_FIGURE__ = 31;
+    public static final int __GO_PARENT_AXES__ = 32;
+    public static final int __GO_HAS_LEGEND_CHILD__ = 33;
+    public static final int __GO_LEGEND_CHILD__ = 34;
+    public static final int __GO_SELECTED_CHILD__ = 35;
+    public static final int __GO_CALLBACK__ = 36;
+    public static final int __GO_CALLBACKTYPE__ = 37;
+    public static final int __GO_DATA_MODEL_COORDINATES__ = 38;
+    public static final int __GO_DATA_MODEL_X__ = 39;
+    public static final int __GO_DATA_MODEL_Y__ = 40;
+    public static final int __GO_DATA_MODEL_Z__ = 41;
+    public static final int __GO_DATA_MODEL_X_COORDINATES_SHIFT__ = 42;
+    public static final int __GO_DATA_MODEL_Y_COORDINATES_SHIFT__ = 43;
+    public static final int __GO_DATA_MODEL_Z_COORDINATES_SHIFT__ = 44;
+    public static final int __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__ = 45;
+    public static final int __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__ = 46;
+    public static final int __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__ = 47;
+    public static final int __GO_DATA_MODEL_NUM_ELEMENTS__ = 48;
+    public static final int __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__ = 49;
+    public static final int __GO_DATA_MODEL_NUM_VERTICES_PER_GON__ = 50;
+    public static final int __GO_DATA_MODEL_NUM_GONS__ = 51;
+    public static final int __GO_DATA_MODEL_Z_COORDINATES_SET__ = 52;
+    public static final int __GO_DATA_MODEL_COLORS__ = 53;
+    public static final int __GO_DATA_MODEL_NUM_COLORS__ = 54;
+    public static final int __GO_DATA_MODEL_NUM_VERTICES__ = 55;
+    public static final int __GO_DATA_MODEL_NUM_INDICES__ = 56;
+    public static final int __GO_DATA_MODEL_INDICES__ = 57;
+    public static final int __GO_DATA_MODEL_VALUES__ = 58;
+    public static final int __GO_DATA_MODEL_FEC_TRIANGLES__ = 59;
+    public static final int __GO_DATA_MODEL_NUM_X__ = 60;
+    public static final int __GO_DATA_MODEL_NUM_Y__ = 61;
+    public static final int __GO_DATA_MODEL_NUM_Z__ = 62;
+    public static final int __GO_DATA_MODEL_GRID_SIZE__ = 63;
+    public static final int __GO_DATA_MODEL_X_DIMENSIONS__ = 64;
+    public static final int __GO_DATA_MODEL_Y_DIMENSIONS__ = 65;
+    public static final int __GO_MATPLOT_TRANSLATE__ = 66;
+    public static final int __GO_MATPLOT_SCALE__ = 67;
+    public static final int __GO_DATA_MODEL_MATPLOT_BOUNDS__ = 68;
+    public static final int __GO_DATA_MODEL_MATPLOT_TYPE__ = 69;
+    public static final int __GO_DATA_MODEL_MATPLOT_GL_TYPE__ = 70;
+    public static final int __GO_DATA_MODEL_MATPLOT_DATA_INFOS__ = 71;
+    public static final int __GO_DATA_MODEL_MATPLOT_DATA_TYPE__ = 72;
+    public static final int __GO_DATA_MODEL_MATPLOT_DATA_ORDER__ = 73;
+    public static final int __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__ = 74;
+    public static final int __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__ = 75;
+    public static final int __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__ = 76;
+    public static final int __GO_REFERENCED__ = 77;
+    public static final int __GO_VALID__ = 78;
+    public static final int __GO_POSITION__ = 79;
+    public static final int __GO_SIZE__ = 80;
+    public static final int __GO_CANVAS__ = 81;
+    public static final int __GO_AUTORESIZE__ = 82;
+    public static final int __GO_VIEWPORT__ = 83;
+    public static final int __GO_AXES_SIZE__ = 84;
+    public static final int __GO_FIGURE_NAME__ = 85;
+    public static final int __GO_NAME__ = 86;
+    public static final int __GO_ID__ = 87;
+    public static final int __GO_INFO_MESSAGE__ = 88;
+    public static final int __GO_COLORMAP__ = 89;
+    public static final int __GO_COLORMAP_SIZE__ = 90;
+    public static final int __GO_RENDERING_MODE__ = 91;
+    public static final int __GO_PIXMAP__ = 92;
+    public static final int __GO_PIXEL_DRAWING_MODE__ = 93;
+    public static final int __GO_ANTIALIASING__ = 94;
+    public static final int __GO_IMMEDIATE_DRAWING__ = 95;
+    public static final int __GO_BACKGROUND__ = 96;
+    public static final int __GO_EVENTHANDLER__ = 97;
+    public static final int __GO_EVENTHANDLER_NAME__ = 98;
+    public static final int __GO_EVENTHANDLER_ENABLE__ = 99;
+    public static final int __GO_TAG__ = 100;
+    public static final int __GO_ROTATION_TYPE__ = 101;
+    public static final int __GO_RESIZEFCN__ = 102;
+    public static final int __GO_CLOSEREQUESTFCN__ = 103;
+    public static final int __GO_UPPER_LEFT_POINT__ = 104;
+    public static final int __GO_WIDTH__ = 105;
+    public static final int __GO_HEIGHT__ = 106;
+    public static final int __GO_START_ANGLE__ = 107;
+    public static final int __GO_END_ANGLE__ = 108;
+    public static final int __GO_ARC_DRAWING_METHOD__ = 109;
+    public static final int __GO_X_AXIS_VISIBLE__ = 110;
+    public static final int __GO_X_AXIS_REVERSE__ = 111;
+    public static final int __GO_X_AXIS_GRID_COLOR__ = 112;
+    public static final int __GO_X_AXIS_LABEL__ = 113;
+    public static final int __GO_X_AXIS_LOCATION__ = 114;
+    public static final int __GO_X_AXIS_LOG_FLAG__ = 115;
+    public static final int __GO_X_AXIS_TICKS__ = 116;
+    public static final int __GO_X_AXIS_AUTO_TICKS__ = 117;
+    public static final int __GO_X_AXIS_NUMBER_TICKS__ = 118;
+    public static final int __GO_X_AXIS_TICKS_LOCATIONS__ = 119;
+    public static final int __GO_X_AXIS_TICKS_LABELS__ = 120;
+    public static final int __GO_X_AXIS_SUBTICKS__ = 121;
+    public static final int __GO_Y_AXIS_VISIBLE__ = 122;
+    public static final int __GO_Y_AXIS_REVERSE__ = 123;
+    public static final int __GO_Y_AXIS_GRID_COLOR__ = 124;
+    public static final int __GO_Y_AXIS_LABEL__ = 125;
+    public static final int __GO_Y_AXIS_LOCATION__ = 126;
+    public static final int __GO_Y_AXIS_LOG_FLAG__ = 127;
+    public static final int __GO_Y_AXIS_TICKS__ = 128;
+    public static final int __GO_Y_AXIS_AUTO_TICKS__ = 129;
+    public static final int __GO_Y_AXIS_NUMBER_TICKS__ = 130;
+    public static final int __GO_Y_AXIS_TICKS_LOCATIONS__ = 131;
+    public static final int __GO_Y_AXIS_TICKS_LABELS__ = 132;
+    public static final int __GO_Y_AXIS_SUBTICKS__ = 133;
+    public static final int __GO_Z_AXIS_VISIBLE__ = 134;
+    public static final int __GO_Z_AXIS_REVERSE__ = 135;
+    public static final int __GO_Z_AXIS_GRID_COLOR__ = 136;
+    public static final int __GO_Z_AXIS_LABEL__ = 137;
+    public static final int __GO_Z_AXIS_LOCATION__ = 138;
+    public static final int __GO_Z_AXIS_LOG_FLAG__ = 139;
+    public static final int __GO_Z_AXIS_TICKS__ = 140;
+    public static final int __GO_Z_AXIS_AUTO_TICKS__ = 141;
+    public static final int __GO_Z_AXIS_NUMBER_TICKS__ = 142;
+    public static final int __GO_Z_AXIS_TICKS_LOCATIONS__ = 143;
+    public static final int __GO_Z_AXIS_TICKS_LABELS__ = 144;
+    public static final int __GO_Z_AXIS_SUBTICKS__ = 145;
+    public static final int __GO_AUTO_SUBTICKS__ = 146;
+    public static final int __GO_GRID_POSITION__ = 147;
+    public static final int __GO_TITLE__ = 148;
+    public static final int __GO_AUTO_CLEAR__ = 149;
+    public static final int __GO_FILLED__ = 150;
+    public static final int __GO_CAMERA__ = 151;
+    public static final int __GO_VIEW__ = 152;
+    public static final int __GO_ISOVIEW__ = 153;
+    public static final int __GO_CUBE_SCALING__ = 154;
+    public static final int __GO_ROTATION_ANGLES__ = 155;
+    public static final int __GO_ROTATION_ANGLES_3D__ = 156;
+    public static final int __GO_BOX_TYPE__ = 157;
+    public static final int __GO_HIDDEN_AXIS_COLOR__ = 158;
+    public static final int __GO_TIGHT_LIMITS__ = 159;
+    public static final int __GO_DATA_BOUNDS__ = 160;
+    public static final int __GO_REAL_DATA_BOUNDS__ = 161;
+    public static final int __GO_ZOOM_ENABLED__ = 162;
+    public static final int __GO_ZOOM_BOX__ = 163;
+    public static final int __GO_AUTO_SCALE__ = 164;
+    public static final int __GO_FIRST_PLOT__ = 165;
+    public static final int __GO_MARGINS__ = 166;
+    public static final int __GO_AXES_BOUNDS__ = 167;
+    public static final int __GO_CLIP_PROPERTY__ = 168;
+    public static final int __GO_CLIP_STATE__ = 169;
+    public static final int __GO_CLIP_BOX__ = 170;
+    public static final int __GO_CLIP_BOX_SET__ = 171;
+    public static final int __GO_LINE__ = 172;
+    public static final int __GO_LINE_MODE__ = 173;
+    public static final int __GO_LINE_STYLE__ = 174;
+    public static final int __GO_LINE_THICKNESS__ = 175;
+    public static final int __GO_LINE_COLOR__ = 176;
+    public static final int __GO_FILL_MODE__ = 177;
+    public static final int __GO_MARK__ = 178;
+    public static final int __GO_MARK_MODE__ = 179;
+    public static final int __GO_MARK_STYLE__ = 180;
+    public static final int __GO_MARK_SIZE_UNIT__ = 181;
+    public static final int __GO_MARK_SIZE__ = 182;
+    public static final int __GO_MARK_FOREGROUND__ = 183;
+    public static final int __GO_MARK_BACKGROUND__ = 184;
+    public static final int __GO_TICKS_DIRECTION__ = 185;
+    public static final int __GO_X_NUMBER_TICKS__ = 186;
+    public static final int __GO_Y_NUMBER_TICKS__ = 187;
+    public static final int __GO_X_TICKS_COORDS__ = 188;
+    public static final int __GO_Y_TICKS_COORDS__ = 189;
+    public static final int __GO_TICKS_COLOR__ = 190;
+    public static final int __GO_TICKS_SEGMENT__ = 191;
+    public static final int __GO_TICKS_STYLE__ = 192;
+    public static final int __GO_SUBTICKS__ = 193;
+    public static final int __GO_NUMBER_TICKS_LABELS__ = 194;
+    public static final int __GO_TICKS_LABELS__ = 195;
+    public static final int __GO_FORMATN__ = 196;
+    public static final int __GO_FONT__ = 197;
+    public static final int __GO_FONT_STYLE__ = 198;
+    public static final int __GO_FONT_SIZE__ = 199;
+    public static final int __GO_FONT_COLOR__ = 200;
+    public static final int __GO_FONT_FRACTIONAL__ = 201;
+    public static final int __GO_Z_BOUNDS__ = 202;
+    public static final int __GO_OUTSIDE_COLOR__ = 203;
+    public static final int __GO_COLOR_RANGE__ = 204;
+    public static final int __GO_DATA_MAPPING__ = 205;
+    public static final int __GO_FONT_ANGLE__ = 206;
+    public static final int __GO_AUTO_POSITION__ = 207;
+    public static final int __GO_CORNERS__ = 208;
+    public static final int __GO_AUTO_ROTATION__ = 209;
+    public static final int __GO_LINKS__ = 210;
+    public static final int __GO_LINKS_COUNT__ = 211;
+    public static final int __GO_LEGEND_LOCATION__ = 212;
+    public static final int __GO_CLOSED__ = 213;
+    public static final int __GO_ARROW_SIZE_FACTOR__ = 214;
+    public static final int __GO_POLYLINE_STYLE__ = 215;
+    public static final int __GO_INTERP_COLOR_VECTOR__ = 216;
+    public static final int __GO_INTERP_COLOR_VECTOR_SET__ = 217;
+    public static final int __GO_INTERP_COLOR_MODE__ = 218;
+    public static final int __GO_X_SHIFT__ = 219;
+    public static final int __GO_Y_SHIFT__ = 220;
+    public static final int __GO_Z_SHIFT__ = 221;
+    public static final int __GO_BAR_WIDTH__ = 222;
+    public static final int __GO_SURFACE_MODE__ = 223;
+    public static final int __GO_COLOR_MODE__ = 224;
+    public static final int __GO_COLOR_FLAG__ = 225;
+    public static final int __GO_ALIGNMENT__ = 226;
+    public static final int __GO_BOX__ = 227;
+    public static final int __GO_TEXT_BOX__ = 228;
+    public static final int __GO_TEXT_BOX_MODE__ = 229;
+    public static final int __GO_AUTO_DIMENSIONING__ = 230;
+    public static final int __GO_FORMATTED_TEXT__ = 231;
+    public static final int __GO_TEXT_ARRAY_DIMENSIONS__ = 232;
+    public static final int __GO_TEXT_STRINGS__ = 233;
+    public static final int __GO_BASE__ = 234;
+    public static final int __GO_BASE_X__ = 235;
+    public static final int __GO_BASE_Y__ = 236;
+    public static final int __GO_BASE_Z__ = 237;
+    public static final int __GO_DIRECTION__ = 238;
+    public static final int __GO_DIRECTION_X__ = 239;
+    public static final int __GO_DIRECTION_Y__ = 240;
+    public static final int __GO_DIRECTION_Z__ = 241;
+    public static final int __GO_ARROW_SIZE__ = 242;
+    public static final int __GO_SEGS_COLORS__ = 243;
+    public static final int __GO_COLORED__ = 244;
+    public static final int __GO_ARROWS__ = 245;
+    public static final int __GO_NUMBER_ARROWS__ = 246;
+    public static final int __GO_CHAMP_DIMENSIONS__ = 247;
+    public static final int __GO_BOUNDING_BOX__ = 248;
+    public static final int __GO_MAX_LENGTH__ = 249;
+    public static final int __GO_MAX_USABLE_LENGTH__ = 250;
+    public static final int __GO_HIDDEN_COLOR__ = 251;
+    public static final int __GO_STYLE__ = 252;
+    public static final int __GO_UI_CHECKBOX__ = 253;
+    public static final int __GO_UI_EDIT__ = 254;
+    public static final int __GO_UI_FRAME__ = 255;
+    public static final int __GO_UI_IMAGE__ = 256;
+    public static final int __GO_UI_LISTBOX__ = 257;
+    public static final int __GO_UI_POPUPMENU__ = 258;
+    public static final int __GO_UI_PUSHBUTTON__ = 259;
+    public static final int __GO_UI_RADIOBUTTON__ = 260;
+    public static final int __GO_UI_SLIDER__ = 261;
+    public static final int __GO_UI_TABLE__ = 262;
+    public static final int __GO_UI_TEXT__ = 263;
+    public static final int __GO_UI_BACKGROUNDCOLOR__ = 264;
+    public static final int __GO_UI_ENABLE__ = 265;
+    public static final int __GO_UI_FONTANGLE__ = 266;
+    public static final int __GO_UI_FONTNAME__ = 267;
+    public static final int __GO_UI_FONTSIZE__ = 268;
+    public static final int __GO_UI_FONTUNITS__ = 269;
+    public static final int __GO_UI_FONTWEIGHT__ = 270;
+    public static final int __GO_UI_FOREGROUNDCOLOR__ = 271;
+    public static final int __GO_UI_HORIZONTALALIGNMENT__ = 272;
+    public static final int __GO_UI_LISTBOXTOP__ = 273;
+    public static final int __GO_UI_LISTBOXTOP_SIZE__ = 274;
+    public static final int __GO_UI_MAX__ = 275;
+    public static final int __GO_UI_MIN__ = 276;
+    public static final int __GO_UI_RELIEF__ = 277;
+    public static final int __GO_UI_STRING__ = 278;
+    public static final int __GO_UI_STRING_SIZE__ = 279;
+    public static final int __GO_UI_STRING_COLNB__ = 280;
+    public static final int __GO_UI_TOOLTIPSTRING__ = 281;
+    public static final int __GO_UI_TOOLTIPSTRING_SIZE__ = 282;
+    public static final int __GO_UI_SLIDERSTEP__ = 283;
+    public static final int __GO_UI_UNITS__ = 284;
+    public static final int __GO_UI_VALUE__ = 285;
+    public static final int __GO_UI_VALUE_SIZE__ = 286;
+    public static final int __GO_UI_VERTICALALIGNMENT__ = 287;
+    public static final int __GO_UIPARENTMENU__ = 288;
+    public static final int __GO_UICHILDMENU__ = 289;
+    public static final int __GO_UICHECKEDMENU__ = 290;
+    public static final int __GO_UI_CHECKED__ = 291;
+    public static final int __GO_UI_LABEL__ = 292;
+    public static final int __GO_UI_MNEMONIC__ = 293;
+    public static final int __GO_UI_ACCELERATOR__ = 294;
+    public static final int __GO_UI_SEPARATOR__ = 295;
+    public static final int __GO_UI_ICON__ = 296;
+    public static final int __GO_CONSOLE__ = 297;
+    public static final int __GO_SHOWHIDDENHANDLES__ = 298;
+    public static final int __GO_WAITBAR__ = 299;
+    public static final int __GO_PROGRESSIONBAR__ = 300;
+    public static final int __GO_UI_MESSAGE__ = 301;
+    public static final int __GO_UI_MESSAGE_SIZE__ = 302;
 
 }
index b35f9d6..82f422d 100644 (file)
@@ -67,6 +67,23 @@ NIO_BUFFER_TYPEMAP(float, BUFF, java.nio.FloatBuffer);
 %apply unsigned char* BUFF {unsigned char* buffer};
 %apply float* BUFF {float* buffer};
 
+%typemap(jni) JavaDirectBuffer "jobject"
+%typemap(jtype) JavaDirectBuffer "java.nio.ByteBuffer"
+%typemap(jstype) JavaDirectBuffer "java.nio.ByteBuffer"
+
+%typemap(out) JavaDirectBuffer {
+    if ($1.address)
+    {
+       jresult = (*jenv)->NewDirectByteBuffer(jenv, $1.address, $1.size);
+    }
+ }
+
+%typemap(javaout) JavaDirectBuffer {
+    return $jnicall;
+}
+
+%ignore JavaDirectBuffer;
+
 %include "../../includes/DataLoader.hxx"
 
 %inline
index bfb4376..e396a4c 100644 (file)
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
  * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGJAVA
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
 
 /* Fix for jlong on some versions of gcc on Windows */
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
-  typedef long long __int64;
+typedef long long __int64;
 #endif
 
 /* Fix for jlong on 64-bit x86 Solaris */
 
 
 /* Support for throwing Java exceptions */
-typedef enum {
-  SWIG_JavaOutOfMemoryError = 1, 
-  SWIG_JavaIOException, 
-  SWIG_JavaRuntimeException, 
-  SWIG_JavaIndexOutOfBoundsException,
-  SWIG_JavaArithmeticException,
-  SWIG_JavaIllegalArgumentException,
-  SWIG_JavaNullPointerException,
-  SWIG_JavaDirectorPureVirtual,
-  SWIG_JavaUnknownError
+typedef enum
+{
+    SWIG_JavaOutOfMemoryError = 1,
+    SWIG_JavaIOException,
+    SWIG_JavaRuntimeException,
+    SWIG_JavaIndexOutOfBoundsException,
+    SWIG_JavaArithmeticException,
+    SWIG_JavaIllegalArgumentException,
+    SWIG_JavaNullPointerException,
+    SWIG_JavaDirectorPureVirtual,
+    SWIG_JavaUnknownError
 } SWIG_JavaExceptionCodes;
 
-typedef struct {
-  SWIG_JavaExceptionCodes code;
-  const char *java_exception;
+typedef struct
+{
+    SWIG_JavaExceptionCodes code;
+    const char *java_exception;
 } SWIG_JavaExceptions_t;
 
 
-static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
-  jclass excep;
-  static const SWIG_JavaExceptions_t java_exceptions[] = {
-    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
-    { SWIG_JavaIOException, "java/io/IOException" },
-    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
-    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
-    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
-    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
-    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
-    { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
-    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
-    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
-  };
-  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
-
-  while (except_ptr->code != code && except_ptr->code)
-    except_ptr++;
-
-  (*jenv)->ExceptionClear(jenv);
-  excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
-  if (excep)
-    (*jenv)->ThrowNew(jenv, excep, msg);
+static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg)
+{
+    jclass excep;
+    static const SWIG_JavaExceptions_t java_exceptions[] =
+    {
+        { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
+        { SWIG_JavaIOException, "java/io/IOException" },
+        { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
+        { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
+        { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
+        { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
+        { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
+        { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
+        { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
+        { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
+    };
+    const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
+
+    while (except_ptr->code != code && except_ptr->code)
+    {
+        except_ptr++;
+    }
+
+    (*jenv)->ExceptionClear(jenv);
+    excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
+    if (excep)
+    {
+        (*jenv)->ThrowNew(jenv, excep, msg);
+    }
 }
 
 
@@ -249,875 +257,1370 @@ static jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize
 
 
 /* signed char[] support */
-static int SWIG_JavaArrayInSchar (JNIEnv *jenv, jbyte **jarr, signed char **carr, jbyteArray input) {
-  int i;
-  jsize sz;
-  if (!input) {
-    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
-    return 0;
-  }
-  sz = (*jenv)->GetArrayLength(jenv, input);
-  *jarr = (*jenv)->GetByteArrayElements(jenv, input, 0);
-  if (!*jarr)
-    return 0; 
-  *carr = (signed char*) calloc(sz, sizeof(signed char)); 
-  if (!*carr) {
-    SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
-    return 0;
-  }
-  for (i=0; i<sz; i++)
-    (*carr)[i] = (signed char)(*jarr)[i];
-  return 1;
+static int SWIG_JavaArrayInSchar (JNIEnv *jenv, jbyte **jarr, signed char **carr, jbyteArray input)
+{
+    int i;
+    jsize sz;
+    if (!input)
+    {
+        SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
+        return 0;
+    }
+    sz = (*jenv)->GetArrayLength(jenv, input);
+    *jarr = (*jenv)->GetByteArrayElements(jenv, input, 0);
+    if (!*jarr)
+    {
+        return 0;
+    }
+    *carr = (signed char*) calloc(sz, sizeof(signed char));
+    if (!*carr)
+    {
+        SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
+        return 0;
+    }
+    for (i = 0; i < sz; i++)
+    {
+        (*carr)[i] = (signed char)(*jarr)[i];
+    }
+    return 1;
 }
 
-static void SWIG_JavaArrayArgoutSchar (JNIEnv *jenv, jbyte *jarr, signed char *carr, jbyteArray input) {
-  int i;
-  jsize sz = (*jenv)->GetArrayLength(jenv, input);
-  for (i=0; i<sz; i++)
-    jarr[i] = (jbyte)carr[i];
-  (*jenv)->ReleaseByteArrayElements(jenv, input, jarr, 0);
+static void SWIG_JavaArrayArgoutSchar (JNIEnv *jenv, jbyte *jarr, signed char *carr, jbyteArray input)
+{
+    int i;
+    jsize sz = (*jenv)->GetArrayLength(jenv, input);
+    for (i = 0; i < sz; i++)
+    {
+        jarr[i] = (jbyte)carr[i];
+    }
+    (*jenv)->ReleaseByteArrayElements(jenv, input, jarr, 0);
 }
 
-static jbyteArray SWIG_JavaArrayOutSchar (JNIEnv *jenv, signed char *result, jsize sz) {
-  jbyte *arr;
-  int i;
-  jbyteArray jresult = (*jenv)->NewByteArray(jenv, sz);
-  if (!jresult)
-    return NULL;
-  arr = (*jenv)->GetByteArrayElements(jenv, jresult, 0);
-  if (!arr)
-    return NULL;
-  for (i=0; i<sz; i++)
-    arr[i] = (jbyte)result[i];
-  (*jenv)->ReleaseByteArrayElements(jenv, jresult, arr, 0);
-  return jresult;
+static jbyteArray SWIG_JavaArrayOutSchar (JNIEnv *jenv, signed char *result, jsize sz)
+{
+    jbyte *arr;
+    int i;
+    jbyteArray jresult = (*jenv)->NewByteArray(jenv, sz);
+    if (!jresult)
+    {
+        return NULL;
+    }
+    arr = (*jenv)->GetByteArrayElements(jenv, jresult, 0);
+    if (!arr)
+    {
+        return NULL;
+    }
+    for (i = 0; i < sz; i++)
+    {
+        arr[i] = (jbyte)result[i];
+    }
+    (*jenv)->ReleaseByteArrayElements(jenv, jresult, arr, 0);
+    return jresult;
 }
 
 
 /* unsigned char[] support */
-static int SWIG_JavaArrayInUchar (JNIEnv *jenv, jshort **jarr, unsigned char **carr, jshortArray input) {
-  int i;
-  jsize sz;
-  if (!input) {
-    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
-    return 0;
-  }
-  sz = (*jenv)->GetArrayLength(jenv, input);
-  *jarr = (*jenv)->GetShortArrayElements(jenv, input, 0);
-  if (!*jarr)
-    return 0; 
-  *carr = (unsigned char*) calloc(sz, sizeof(unsigned char)); 
-  if (!*carr) {
-    SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
-    return 0;
-  }
-  for (i=0; i<sz; i++)
-    (*carr)[i] = (unsigned char)(*jarr)[i];
-  return 1;
+static int SWIG_JavaArrayInUchar (JNIEnv *jenv, jshort **jarr, unsigned char **carr, jshortArray input)
+{
+    int i;
+    jsize sz;
+    if (!input)
+    {
+        SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
+        return 0;
+    }
+    sz = (*jenv)->GetArrayLength(jenv, input);
+    *jarr = (*jenv)->GetShortArrayElements(jenv, input, 0);
+    if (!*jarr)
+    {
+        return 0;
+    }
+    *carr = (unsigned char*) calloc(sz, sizeof(unsigned char));
+    if (!*carr)
+    {
+        SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
+        return 0;
+    }
+    for (i = 0; i < sz; i++)
+    {
+        (*carr)[i] = (unsigned char)(*jarr)[i];
+    }
+    return 1;
 }
 
-static void SWIG_JavaArrayArgoutUchar (JNIEnv *jenv, jshort *jarr, unsigned char *carr, jshortArray input) {
-  int i;
-  jsize sz = (*jenv)->GetArrayLength(jenv, input);
-  for (i=0; i<sz; i++)
-    jarr[i] = (jshort)carr[i];
-  (*jenv)->ReleaseShortArrayElements(jenv, input, jarr, 0);
+static void SWIG_JavaArrayArgoutUchar (JNIEnv *jenv, jshort *jarr, unsigned char *carr, jshortArray input)
+{
+    int i;
+    jsize sz = (*jenv)->GetArrayLength(jenv, input);
+    for (i = 0; i < sz; i++)
+    {
+        jarr[i] = (jshort)carr[i];
+    }
+    (*jenv)->ReleaseShortArrayElements(jenv, input, jarr, 0);
 }
 
-static jshortArray SWIG_JavaArrayOutUchar (JNIEnv *jenv, unsigned char *result, jsize sz) {
-  jshort *arr;
-  int i;
-  jshortArray jresult = (*jenv)->NewShortArray(jenv, sz);
-  if (!jresult)
-    return NULL;
-  arr = (*jenv)->GetShortArrayElements(jenv, jresult, 0);
-  if (!arr)
-    return NULL;
-  for (i=0; i<sz; i++)
-    arr[i] = (jshort)result[i];
-  (*jenv)->ReleaseShortArrayElements(jenv, jresult, arr, 0);
-  return jresult;
+static jshortArray SWIG_JavaArrayOutUchar (JNIEnv *jenv, unsigned char *result, jsize sz)
+{
+    jshort *arr;
+    int i;
+    jshortArray jresult = (*jenv)->NewShortArray(jenv, sz);
+    if (!jresult)
+    {
+        return NULL;
+    }
+    arr = (*jenv)->GetShortArrayElements(jenv, jresult, 0);
+    if (!arr)
+    {
+        return NULL;
+    }
+    for (i = 0; i < sz; i++)
+    {
+        arr[i] = (jshort)result[i];
+    }
+    (*jenv)->ReleaseShortArrayElements(jenv, jresult, arr, 0);
+    return jresult;
 }
 
 
 /* short[] support */
-static int SWIG_JavaArrayInShort (JNIEnv *jenv, jshort **jarr, short **carr, jshortArray input) {
-  int i;
-  jsize sz;
-  if (!input) {
-    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
-    return 0;
-  }
-  sz = (*jenv)->GetArrayLength(jenv, input);
-  *jarr = (*jenv)->GetShortArrayElements(jenv, input, 0);
-  if (!*jarr)
-    return 0; 
-  *carr = (short*) calloc(sz, sizeof(short)); 
-  if (!*carr) {
-    SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
-    return 0;
-  }
-  for (i=0; i<sz; i++)
-    (*carr)[i] = (short)(*jarr)[i];
-  return 1;
+static int SWIG_JavaArrayInShort (JNIEnv *jenv, jshort **jarr, short **carr, jshortArray input)
+{
+    int i;