1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2004-2006 - INRIA - Fabrice Leray
4  * Copyright (C) 2006 - INRIA - Allan Cornet
5  * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
6  * Copyright (C) 2010 - DIGITEO - Manuel Juliachs
7  * Copyright (C) 2010 - DIGITEO - Bruno JOFRET
8  * Copyright (C) 2011 - DIGITEO - Vincent Couvert
9  *
10  * Copyright (C) 2012 - 2016 - Scilab Enterprises
11  *
12  * This file is hereby licensed under the terms of the GNU GPL v2.0,
13  * pursuant to article 5.3.4 of the CeCILL v.2.1.
14  * This file was originally licensed under the terms of the CeCILL v2.1,
15  * and continues to be available under such terms.
16  * For more information, see the COPYING file which you should have received
17  * along with this program.
18  *
19  */
20 
21 /*------------------------------------------------------------------------*/
22 /* file: get_color_map_property.c                                         */
23 /* desc : function to retrieve in Scilab the color_map field of a         */
24 /*        handle                                                          */
25 /*------------------------------------------------------------------------*/
26 
27 #include "getHandleProperty.h"
28 #include "returnProperty.h"
29 #include "Scierror.h"
30 #include "localization.h"
31 
32 #include "getGraphicObjectProperty.h"
33 #include "graphicObjectProperties.h"
34 
35 /*--------------------------------------------------------------------------*/
get_color_map_property(void * _pvCtx,int iObjUID)36 void* get_color_map_property(void* _pvCtx, int iObjUID)
37 {
38     double *pdblColorMap = NULL;
39 
40     int iCmapSize = 0;
41     int * piCmapSize = &iCmapSize;
42 
43     getGraphicObjectProperty(iObjUID, __GO_COLORMAP_SIZE__, jni_int, (void **)&piCmapSize);
44     getGraphicObjectProperty(iObjUID, __GO_COLORMAP__, jni_double_vector, (void **)&pdblColorMap);
45     if (pdblColorMap == NULL)
46     {
47         Scierror(999, _("'%s' property does not exist for this handle.\n"), "color_map");
48         return NULL;
49     }
50 
51     return sciReturnMatrix(pdblColorMap, iCmapSize, 3);
52 }
53 /*--------------------------------------------------------------------------*/
54