Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Graphics > figure_operations > pixel_drawing_mode

pixel_drawing_mode

Figure's property setting the RGBwise pixels update mode when drawing

Description

Pixels colors are RGB encoded. Each R, G or B channel has an uint(8) value on [0, 255].

The pixel_drawing_mode is a figure property that specifies a RGBwise operation applied on every pixel of the incoming object, between RGB values of the input pixel color and RGB values the already existing pixel color of the figure. The result of this operation sets the new pixel color.

  • src is the incoming color of the pixel.
  • cur is the current color of the pixel (which is already drawn).
Possible case-sensitive values for pixel_drawing_mode are listed herebelow.
  • NOT v means 255 - v
  • a AND b means a & b
  • a OR b means a | b
  • a XOR b means (a OR b) AND NOT (a AND b)

Value result
"copy" (default) src
"copyInverted" NOT src
"noop" cur
"invert" NOT cur
"set" White
"clear" Black
"equiv" cur XOR (NOT src)
"xor" cur XOR src
"or" cur OR src
"orInverted" cur OR (NOT src)
"orReverse" (NOT cur) OR src
"nor" NOT (cur OR src)
"and" cur AND src
"andInverted" cur AND (NOT src)
"andReverse" (NOT cur) AND src
"nand" NOT (cur AND src)

Examples

pxmodes = ["copy", "copyInverted", "equiv", "xor", ..
            "and", "nand", "andReverse", "andInverted", ..
            "or", "nor", "orReverse", "orInverted", ..
            "noop", "set", "clear", "invert" ..
           ];
// sizes, and overlaying margins of figures
s = 300;
hm = 8;
vm = 52;
//
for k = 16:-1:1
    m = pxmodes(k);

    // Position of the figure
    i = fix((k-1)/4);
    j = modulo(k-1,4);

    // Creating the figure
    f = figure("toolbar_visible","off", ..
               "menubar_visible","off", ..
               "infobar_visible","off", ..
               "figure_position", [j*(s-hm), i*(s-vm)], ..
               "figure_size", [s s], ..
               "background", color("grey85"), ..
               "pixel_drawing_mode", m ..
               );
    drawlater

    // Setting the axes
    b = 0.82;
    plot2d([],[],0,"051"," ",[-1 -1 1 1]*b)
    plot2d([-1 1]*b,[0 0])
    a = gca();
    a.isoview = "on";
    a.tight_limits = "on";
    title(m,"fontsize",4)

    // Drawing 3 overlaying colored disks
    xfarc(-0.7, 0.8, 1, 1, 0, 360*64)
    e = gce();
    e.background = color("red");
    e.fill_mode = "on";

    xfarc(-0.2, 0.5, 1, 1, 0, 360*64)
    e = gce();
    e.background = color("blue");
    e.fill_mode = "on";

    xfarc(-0.7,  0.2, 1, 1, 0, 360*64)
    e = gce();
    e.background = color("green");
    e.fill_mode = "on";

    drawnow
end
// Removing all figures
b = messagebox(_("Press OK to close all figures"),_("End of demo"), "question", "modal");
w = winsid();
xdel(w($-15:$));

See also

  • Figure properties — description of the graphics figure entity properties
  • colordef — Set default color values to display different color schemes
  • lighting — Lighting overview
  • Matplot — 2D plot of a matrix using colors
Report an issue
<< gdf figure_operations scf >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:02:51 CET 2017