From 99073cde9042a58affea31029db418ce0decac62 Mon Sep 17 00:00:00 2001 From: Calixte DENIZET Date: Wed, 25 Sep 2013 13:15:22 +0200 Subject: [PATCH] Update Matplot doc to take into account image_type property Change-Id: I74a81f4413095c896504fbce75617a35f8efc713 --- .../help/en_US/2d_plot/Matplot_properties.xml | 84 +++++++++++++++++++- .../c/getHandleProperty/get_image_type_property.c | 4 +- scilab/modules/helptools/etc/images_md5.txt | 1 + .../helptools/images/Matplot_properties_1.png | Bin 0 -> 7895 bytes scilab/modules/io/macros/%_save.sci | 1 + 5 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 scilab/modules/helptools/images/Matplot_properties_1.png diff --git a/scilab/modules/graphics/help/en_US/2d_plot/Matplot_properties.xml b/scilab/modules/graphics/help/en_US/2d_plot/Matplot_properties.xml index 1488d80..30542b0 100644 --- a/scilab/modules/graphics/help/en_US/2d_plot/Matplot_properties.xml +++ b/scilab/modules/graphics/help/en_US/2d_plot/Matplot_properties.xml @@ -61,13 +61,88 @@ this field defines a [mxn] - color data matrix using the current colormap. The color - associated to color(i,j) is used do draw a small square + color data matrix (double, (u)int8, (u)int16, (u)int32) or hypermatrix. + The colors are interpreted according to the image_type property. + The color associated to color(i,j) is used do draw a small square of length 1 with center at location (x=j,y=(m-i+1)). + image_type: + + + this field defines the image type. It could be one of the values: "rgb", "rgba", "gray", "index", + "red", "green", "blue", "rgb332", "rgb444", "rgb555", "rgba5551". + + + Colors are determinated by the data type and by image_type: + + + + + When image_type is equals to index, the data are just considered as an index in the colormap. + + + + + When image_type is equals to rgb, hypermat of int8 or uint8 will give the RGB components, hypermat of doubles will give normalized RGB components (values between 0 and 1), matrices of int8 or uint8 where number of rows is a multiple of 3 will give the RGB components, matrices of int32 will give RGB colors, matrices of uint32 will give RGBA colors where the alpha channel will be set to 0xFF. + + + + + When image_type is equals to rgba, hypermat of int8 or uint8 will give the RGBA components, hypermat of doubles will give normalized RGBA components (values between 0 and 1), matrices of int8 or uint8 where number of rows is a multiple of 4 will give the RGB components, matrices of int32 will give RGBA colors, matrices of uint32 will give RGBA colors. + + + + + When image_type is equals to gray, matrices of int8 or uint8 will give Gray level color (R-G-B=GRAY-GRAY-GRAY), for other types, data will be considered as RGB ones and converted into gray colors (0.299*R+0.587*G+0.114*B). + + + + + When image_type is equals to red, matrices of int8 or uint8 will give Red level color (R-G-B=RED-00-00), for other types, data will be considered as RGB ones and converted into red colors (a mask is applied to keep the Red component). + + + + + When image_type is equals to green, matrices of int8 or uint8 will give Green level color (R-G-B=00-GREEN-00), for other types, data will be considered as RGB ones and converted into green colors (a mask is applied to keep the Green component). + + + + + When image_type is equals to blue, matrices of int8 or uint8 will give Blue level color (R-G-B=00-00-BLUE), for other types, data will be considered as RGB ones and converted into blue colors (a mask is applied to keep the Blue component). + + + + + When image_type is equals to rgb332, matrices of int8 or uint8 will give RGB colors where R component is wrote on 3 bits, G component on 3 bits and B component on 2 bits. For other data types, RGB (8-8-8) data are converted into RGB (3-3-2). + + + + + When image_type is equals to rgb444, matrices of int16 or uint16 will give RGB colors where each components is wrote on 4 bits. For other data types, RGB (8-8-8) data are converted into RGB (4-4-4). + + + + + When image_type is equals to rgb555, matrices of int16 or uint16 will give RGB colors where each components is wrote on 5 bits. For other data types, RGB (8-8-8) data are converted into RGB (5-5-5). + + + + + When image_type is equals to rgb4444, matrices of int16 or uint16 will give RGBA colors where each components is wrote on 4 bits. For other data types, RGBA (8-8-8-8) data are converted into RGBA (4-4-4-4). + + + + + When image_type is equals to rgb5551, matrices of int16 or uint16 will give RGBA colors where each non-alpha components is wrote on 5 bits and the alpha component on 1 bit. For other data types, RGBA (8-8-8-8) data are converted into RGBA (5-5-5-1). + + + + + + clip_state: @@ -127,6 +202,11 @@ e=gce(); // get current entity e.data=e.data($:-1:1) // reverse order ]]> + +Matplot((1:xget("lastpattern"))); +e=gce(); +e.data=e.data($:-1:1); + See Also diff --git a/scilab/modules/graphics/src/c/getHandleProperty/get_image_type_property.c b/scilab/modules/graphics/src/c/getHandleProperty/get_image_type_property.c index 88434b5..78398b3 100644 --- a/scilab/modules/graphics/src/c/getHandleProperty/get_image_type_property.c +++ b/scilab/modules/graphics/src/c/getHandleProperty/get_image_type_property.c @@ -33,7 +33,7 @@ int get_image_type_property(void* _pvCtx, char* pobjUID) { int imagetype = 0; int * piImagetype = &imagetype; - ImageType itype = (ImageType)imagetype; + ImageType itype; getGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__, jni_int, (void **)&piImagetype); if (piImagetype == NULL) @@ -42,6 +42,8 @@ int get_image_type_property(void* _pvCtx, char* pobjUID) return -1; } + itype = (ImageType)imagetype; + switch (itype) { case MATPLOT_RGB : diff --git a/scilab/modules/helptools/etc/images_md5.txt b/scilab/modules/helptools/etc/images_md5.txt index c68659c..6f189a6 100644 --- a/scilab/modules/helptools/etc/images_md5.txt +++ b/scilab/modules/helptools/etc/images_md5.txt @@ -140,6 +140,7 @@ LineSpec_4.png=57732b0000bb78016145a6d579836134 Matplot1_1.png=d6a47166ab86e17add7e33932c1c75e0 Matplot_1.png=d64708ebf99438b7fc27b1c4e1926050 Matplot_2.png=381a3f1b985afe7b120ae9f9f02efcb1 +Matplot_properties_1.png=b4af781435d771a8e27a1fa6b146cd6 Modulo_Count_1.png=fe92d3f9f46d41fdef932dbbe062073a OUTIMPL_f_1.png=aa84fd3d40f5524d09bcc978095e7aba OUT_f_1.png=b8152428f0292e0ebee5182e015dd47b diff --git a/scilab/modules/helptools/images/Matplot_properties_1.png b/scilab/modules/helptools/images/Matplot_properties_1.png new file mode 100644 index 0000000000000000000000000000000000000000..456d654010ae255607c578825f076dbb4cfc347f GIT binary patch literal 7895 zcmd5>2UJtp)@Bs(DN<}89R-OXh`=Dt02Wk0Wkf_EAihXZ10p3-0z~97L`9qd!3qpI zDpiaKF#$z6eT_?%e=j^?|Zq#ihPG^` zy?jlZjP$S;KRCVo$}fmy8)=`ntd&TMHOZ2iF^#`2ALq!bt0C2Pi)m<>)tyawd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#}XoHJOyo!;_>)ZA|l0g zbvCO+MN3}2GHqgCi;muh!x?c;s>LhP7qy@A$e?vNPVeQrdR~{fhttITv!0&U7z_pk z64d@0dAIDnXW;8*{tNevUl6UU(H2EdJC<&JpsMLv8gx+XsK+=F*dF(CuF)-<;gK6h zku&roWZ0@vCnqNpL-(mO5J^&7TPkU2N_G8&^murd7L!s^-(?~~gmnd-A`u7~=hosk z(4_1>4CJ+Vrd%#zqa~~3c{H}spQgp^H)8*TdP0DjaZ0W^7MsyZ$&NOy6uXGcx3e!b zbYmJqOs*igC0xk)JfCK-nk~S+MFDOn3d&%)r+x$a5GT(h8CLzD`B!yWqLf(kUod53ru|l&jO3vuQPNz;h57f1f72#^3m0p-=^Sc~H~17GEcxD)-E9i zqRIxIs^53U&*(yL2e$M+gvqPVOp@R%jh_}_54TrDG#|%}_a91fad&fjk6?sMan_3x zH+8lIUf-YSdnE7h5uGDAlv$NopP^ZGabsz6nSEJM{zz!(Ega6wM6c2*y{wZ!X0Ou~ zUeUYF>E#Vp=+D_dKvLX?&IyDddW6={Af26^4ZTh!$x1p6vu|?-niU|Ou>Zu|)A!y~ zea}E=KzPpDf+eIMIvtRKB5iw_m)BZyO(r5^WM;g%baIScJD>!;>6jIkNg7DnU*FGK zq!*-I>koD6E=X2j&91(_^`9Dl$g|~XusVCNt#43|6`<75DnQZI>rjsg_9>)!%`}^& zhzg+-8*|S!NhgJH?339U4mmx}NtvoGk?Q1un8Fa_K%-w$NDi@xL9&;TM>A!{#D8A~ z0RrlA%Iy^Y=Ji^VIqY>>l4J6bo7^_ChpKU+JxwQ$`2K`#Zbu4_(Nud3TFOy@<;-+5 zW6ioJN9%ld_x+ba&d$xXzyJ3e&M&X|g}cx{z0_@Qock_6IY?A;PCgF0uof^kJG}SF?vt1P12e4JjsO4v literal 0 HcmV?d00001 diff --git a/scilab/modules/io/macros/%_save.sci b/scilab/modules/io/macros/%_save.sci index 980e0ee..d32615c 100644 --- a/scilab/modules/io/macros/%_save.sci +++ b/scilab/modules/io/macros/%_save.sci @@ -579,6 +579,7 @@ function [] = %_save(%__filename__, varargin) "type", ... "visible", ... "data", ... + "image_type", ... "clip_state", ... "clip_box", ... "user_data"]); -- 1.7.9.5