Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

image

在模块封装图标上显示图像

    说明

    示例

    image(maskImage) 在模块封装图标上显示图像 maskImage

    image(maskImage,positionAndSize) 提供图像在模块封装图标内的位置和大小。

    image(maskImage,positionAndSize,rotation) 指定图像是随图标一起旋转还是保持静止。

    示例

    全部折叠

    在此封装模块中使用多个图像命令来指示模块功能。

    模块封装图标由四个单独的图像组成:

    • 模块封装图标中心的图像,存储在 block_icon_controller.png 中。

    • 右下角的公司徽标,存储在 company_logo.png 中。

    • 左下角的两个图标表示您可以编译和构造存储在 block_capability_compile.png block_capability_build.png 中的模块的代码。

    Block mask icon

    使用以下代码显示模块封装图标中的图像。

    % The second argument of the image command specifies
    % the location and size of the image on the block mask icon
    % in the format [x,y,w,h] where:
    %
    %   x is the horizontal displacement with respect to the bottom left corner.
    %   y is the vertical displacement with respect to the bottom left corner.
    %   w is the width of the image.
    %   h is the height of the image.
    %
    %  Compute the width and height relative to the total block mask icon size
    %  to make sure that images scale with block resizing.
    
    image('block_icon_controller.png',[10,10,85,40]);
    
    image('company_logo.png',[95,2,10,10]);
    
    image('block_capability_compile.png',[7,2,8,8]);
    
    image('block_capability_build.png',[18,2,10,10]);
    
    

    输入参数

    全部折叠

    在黑色封装图标上显示的图像,指定为以下选项之一:

    • 由 RGB 值组成的 m×n×3 数组。其中 mn 是图像的像素大小。

    • 图像文件的名称,指定为字符串标量或字符向量。

    注意

    .cur.hdf4.ico.pcx.ras.xwd 格式的图像不能用作模块封装图像。

    示例: image('icon.jpg')

    数据类型: matrix | string | char

    图像的位置和大小,指定为 [x, y, w, h] 形式的数值数组。

    • x - 图像从图标左下角开始的水平位移,以图标总宽度的百分比形式表示。

    • y - 图像从图标左下角开始的垂直位移,以图标总高度的百分比形式表示。

    • w - 图像宽度,以图标总宽度的百分比形式表示

    • h - 图像高度,以图标总高度的百分比形式表示

    如果使用这些值,则当调整模块大小时,图像的大小不会随模块封装图标的大小而缩放。您还可以指定 position,如下表所示。

    图像位置

    模块封装图标中的位置
    "center"居中
    "top-left"左上角
    "bottom-left"左下角
    "top-right"右上角
    "bottom-right"右下角

    示例: image('company_logo.png',[95,2,10,10])

    示例: image("block_icon_controller.png","center")

    数据类型: array | string | char

    用于指定图像是随图标的旋转而旋转还是保持静止的选项,指定为 'off''on'

    示例: image('company_logo.png',[95,2,10,10],'off')

    版本历史记录

    在 R2006a 中推出