Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

image

ブロック マスク アイコンにイメージを表示する

    説明

    image(maskImage) は、ブロック マスク アイコンにイメージ maskImage を表示します。

    image(maskImage,positionAndSize) は、ブロック マスク アイコン内のイメージの位置とサイズを指定します。

    image(maskImage,positionAndSize,rotation) は、イメージをアイコンと共に回転させるか静止したままにするかを指定します。

    すべて折りたたむ

    このマスク ブロックでは複数の image コマンドを使用してブロックの機能を示しています。

    ブロック マスク アイコンは次の 4 つの別個のイメージで構成されています。

    • ブロック マスク アイコンの中央にあるイメージ。block_icon_controller.png に格納されています。

    • 右下の会社ロゴ。company_logo.png に格納されています。

    • ブロックのコードをコンパイルおよびビルドできることを示す、左下にある 2 つのアイコン。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 の配列。ここで、"m""n" はピクセル単位でのイメージのサイズです。

    • イメージ ファイルの名前。string スカラーまたは文字ベクトルとして指定します。

    メモ

    .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 で導入