サムネイル作成

動作

簡単にサムネイル画像を作成することができます。

 

バージョン

Curl Advanced UI 0.5

API説明

create-thumbnailプロシージャ

  サムネイルを作成するプロシージャです。 

    引数1(v:Frame):サムネイルの対象となるフレーム
    戻り値:Pixmap  サムネイルのPixmap

パッケージ

  COM.CURLAP.ADVANCED-UI.UTILS

 

create-thumbnail-to-urlプロシージャ

  サムネイルを作成するプロシージャです。ファイルとして保存します。 

    引数1(v:Frame):サムネイルの対象となるフレーム
    引数2(save-url:Url):サムネイル画像の保存先
    キーワード引数(mime-type:String = “image/jpeg”):mime type
    戻り値:void 

パッケージ

  COM.CURLAP.ADVANCED-UI.UTILS

利用方法

create-thumbnailもしくはcreate-thumbnail-to-urlプロシージャを利用して、サムネイル画像を作成します。

{curl 6.0 applet}
{curl-file-attributes character-encoding = “shift-jis”}
{applet manifest = “manifest.mcurl”}

{import * from COM.CURLAP.ADVANCED-UI.UTILS}
{import * from COM.CURL.GUI.STYLED-CONTROLS}
{install-style-sheet {manifest-url “file”, “DEFAULT-STYLE-SHEET”}}

{value
    def v =
        {Frame
            valign = “top”,
            {spaced-vbox
                background = “pink”,
                {TextField width = 3cm},
                {ComboBox width = 3cm},
                {CommandButton label = “test”}
            }
        }

    def frame =
        {Frame width = 5cm, height = 5cm,
            {spaced-vbox
                v,
                {CommandButton
                    label = “pixmap”,
                    {on Action do
                        {create-thumbnail-to-url v,
                            {url “images/thumbnail.jpg”}}
                        def view =
                            {View {Frame width = 3cm, height = 2cm,
                                      background = {create-thumbnail v}}}
                        {view.show}
                    }
                }
            }
        }
   
    def tab-container =
        {TabContainer
            {TabPane
                {Frame valign = “top”,
                    {spaced-vbox
                        background = “pink”,
                        {TextField width = 3cm},
                        {text font-size = 28pt, 1}
                    }
                }
            },
            {TabPane
                {Frame valign = “top”,
                    {spaced-vbox
                        background = “yellow”,
                        {TextField width = 3cm},
                        {text font-size = 28pt, 2}
                    }
                }
            },
            {TabPane
                {Frame valign = “top”,
                    {spaced-vbox
                        background = “red”,
                        {TextField width = 3cm},
                        {text font-size = 28pt, 3}
                    }
                }
            }
        }

    {spaced-vbox
        {text test1},
        frame,
        {text test2},
        {spaced-vbox
            tab-container,
            {CommandButton
                label = “show thumbnails”,
                {on Action do
                    def thumbnails = {{Array-of Frame}}
                    {for tp in tab-container.tab-panes do
                        {thumbnails.append
                            {Frame width = 5cm, height = 2cm,
                                border-width = 2pt, border-style = BorderStyle.double,
                                background = {create-thumbnail (tp.content asa Frame)}}
                        }
                    }
                    def view =
                        {View width = 10cm, height = 10cm,
                            {spaced-vbox {splice thumbnails}}}
                    {view.show}
                }
            }
        }
    }
}

 

RadioFrame(rf)の値が変わったら、TextField(tf1)とTextField(tf2)のNotifyEventが実行されます。また、TextField2の値を変化させた場合、TextField1のNotifyEventが実行されます。