Adobe® Flash® Platform 用 ActionScript® 3.0 リファレンスガイド
ホーム  |  パッケージおよびクラスリストの非表示 |  パッケージ  |  クラス  |  新機能  |  索引  |  付録  |  英語で表示される理由
フィルター: AIR 30.0 以前, Flash Player 30.0 以前, Flash Lite 4
Flex 4.6 以前, Flash Pro CS6 以前
フィルターを非表示
flash.display 

Graphics  - AS3

パッケージx

トップレベル
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

言語エレメント

グローバル定数
グローバル関数
演算子
ステートメント、キーワード、ディレクティブ
特殊な型

付録

新機能
コンパイルエラー
コンパイラー警告
ランタイムエラー
ActionScript 3 への移行
サポートされている文字セット
MXML のみのタグ
モーション XML エレメント
Timed Text タグ
使用されなくなったエレメントのリスト
Accessibility Implementation 定数
ActionScript の例の使用方法
法律上の注意
パッケージflash.display
クラスpublic final class Graphics
継承Graphics Inheritance Object

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

Graphics クラスには、ベクターシェイプの作成に使用できる一連のメソッドがあります。描画をサポートする表示オブジェクトには、Sprite および Shape オブジェクトがあります。これらの各クラスには、Graphics オブジェクトである graphics プロパティがあります。以下は、簡単に使用できるように用意されているヘルパー関数の一例です。drawRect()drawRoundRect()drawCircle()、および drawEllipse()

ActionScript コードから直接 Graphics オブジェクトを作成することはできません。new Graphics() を呼び出すと、例外がスローされます。

Graphics クラスは final クラスであるため、サブクラス化することはできません。

例を表示



パブリックプロパティ
 プロパティ定義元
 Inheritedconstructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクター関数への参照です。
Object
パブリックメソッド
 メソッド定義元
  
beginBitmapFill(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void
描画領域をビットマップイメージで塗りつぶします。
Graphics
  
beginFill(color:uint, alpha:Number = 1.0):void
描画のときに他の Graphics メソッド(lineTo() や drawCircle() など)に対する今後の呼び出しに使用する単純な一色塗りを指定します。
Graphics
  
beginGradientFill(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void
Graphics の他のメソッド(lineTo()、drawCircle() など)に対する、オブジェクトの後続の呼び出しに使用するグラデーション塗りを指定します。
Graphics
  
beginShaderFill(shader:Shader, matrix:Matrix = null):void
Graphics の他のメソッド(lineTo()、drawCircle() など)に対する、オブジェクトの後続の呼び出しに使用するシェーダー塗りを指定します。
Graphics
  
この Graphics オブジェクトに描画されているグラフィックをクリアし、塗りと線のスタイルの設定をリセットします。
Graphics
  
copyFrom(sourceGraphics:Graphics):void
すべての描画コマンドをソース Graphics オブジェクトから、呼び出し Graphics オブジェクトにコピーします。
Graphics
  
cubicCurveTo(controlX1:Number, controlY1:Number, controlX2:Number, controlY2:Number, anchorX:Number, anchorY:Number):void
現在の描画位置から指定されたアンカーポイントに 3 次ベジェ曲線を描画します。
Graphics
  
curveTo(controlX:Number, controlY:Number, anchorX:Number, anchorY:Number):void
(controlX, controlY) で指定されたコントロールポイントを使用し、現在の描画位置から (anchorX, anchorY) まで、現在の線のスタイルで 2 次ベジェ曲線を描画します。
Graphics
  
円を描画します。
Graphics
  
drawEllipse(x:Number, y:Number, width:Number, height:Number):void
楕円を描画します。
Graphics
  
描画用の一連の IGraphicsData インスタンスを送信します。
Graphics
  
drawPath(commands:Vector.<int>, data:Vector.<Number>, winding:String = "evenOdd"):void
描画用の一連のコマンドを送信します。
Graphics
  
drawRect(x:Number, y:Number, width:Number, height:Number):void
矩形を描画します。
Graphics
  
drawRoundRect(x:Number, y:Number, width:Number, height:Number, ellipseWidth:Number, ellipseHeight:Number = NaN):void
角丸矩形を描画します。
Graphics
  
drawTriangles(vertices:Vector.<Number>, indices:Vector.<int> = null, uvtData:Vector.<Number> = null, culling:String = "none"):void
一連の三角形をレンダリングします。通常は、ビットマップを歪曲させて、3 次元の外観にします。
Graphics
  
beginFill()、beginGradientFill()、または beginBitmapFill() メソッドへの最後の呼び出し以降に追加された線と曲線に塗りを適用します。
Graphics
 Inherited
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
Object
 Inherited
Object クラスのインスタンスが、パラメーターとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
Object
  
lineBitmapStyle(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void
線の描画で、線として使用するビットマップを指定します。
Graphics
  
lineGradientStyle(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void
線の描画で使用するグラデーションを指定します。
Graphics
  
lineShaderStyle(shader:Shader, matrix:Matrix = null):void
線の描画で、線として使用するシェーダーを指定します。
Graphics
  
lineStyle(thickness:Number = NaN, color:uint = 0, alpha:Number = 1.0, pixelHinting:Boolean = false, scaleMode:String = "normal", caps:String = null, joints:String = null, miterLimit:Number = 3):void
lineTo() メソッドや drawCircle() メソッドなど、Graphics のメソッドの後続の呼び出しに使用する線スタイルを指定します。
Graphics
  
現在の描画位置から (x, y) まで、現在の線のスタイルを使用して線を描画します。その後で、現在の描画位置は (x, y) に設定されます。
Graphics
  
現在の描画位置を (x, y) に移動します。
Graphics
 Inherited
指定されたプロパティが存在し、列挙できるかどうかを示します。
Object
  
Sprite または Shape オブジェクト(およびオプションでその子)のベクターグラフィックコンテンツを検索するクエリを実行します。
Graphics
 Inherited
ループ処理に対するダイナミックプロパティの可用性を設定します。
Object
 Inherited
ロケール固有の規則に従って書式設定された、このオブジェクトのストリング表現を返します。
Object
 Inherited
指定されたオブジェクトのストリング表現を返します。
Object
 Inherited
指定されたオブジェクトのプリミティブな値を返します。
Object
メソッドの詳細

beginBitmapFill

()メソッド
public function beginBitmapFill(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

描画領域をビットマップイメージで塗りつぶします。ビットマップを繰り返すか、タイリング表示して、領域を塗りつぶすことができます。beginFill()beginBitmapFill()beginGradientFill()、または beginShaderFill() メソッドを呼び出すまで、塗りは有効です。clear() メソッドを呼び出すと、塗りがクリアされます。

アプリケーションでは、3 つ以上の点が描画されたとき、または endFill() メソッドが呼び出されたときに、塗りをレンダリングします。

パラメーター

bitmap:BitmapData — 表示されるビットを含む透明または不透明ビットマップイメージです。
 
matrix:Matrix (default = null) — flash.geom.Matrix クラスのマトリックスオブジェクトです。これを使用してビットマップ上に変形を定義できます。例えば、次のマトリックスを使用すると、ビットマップを 45 度(π/4 ラジアン)回転できます。
     matrix = new flash.geom.Matrix(); 
     matrix.rotate(Math.PI / 4);
     
 
repeat:Boolean (default = true)true の場合、ビットマップイメージが一定のパターンでタイル状に表示されます。false の場合、ビットマップイメージは繰り返されません。ビットマップからはみ出す塗り領域にはビットマップのエッジが使用されます。

例えば、次のビットマップ(20 x 20 ピクセルのチェッカーボードのパターン)を考えます。

20 x 20 ピクセルの格子縞模様

次の例のように repeattrue に設定されている場合、ビットマップの塗りでビットマップが繰り返されます。

60 x 60 ピクセルの格子縞模様

repeatfalse に設定されている場合、エッジのピクセルがビットマップの外側の塗り領域に使用されます。

繰り返しのない 60 x 60 ピクセルイメージ

 
smooth:Boolean (default = false)false の場合、拡大ビットマップイメージは最近傍アルゴリズムを使用してレンダリングされ、ピクセル化されたように見えます。true の場合、拡大ビットマップイメージは双線形アルゴリズムを使用してレンダリングされます。最近傍アルゴリズムを使用したレンダリングの方が高速です。

関連する API エレメント


例  ( この例の使用方法 )

次の例では、イメージ(image1.jpg)を使用し、回転させながら繰り返して矩形を塗りつぶします。
  1. イメージファイル(image1.jpg)は、Loader オブジェクトおよび URLRequest オブジェクトを使用してロードされます。ここでは、ファイルは SWF ファイルと同じディレクトリにあります。SWF ファイルは、「ローカルでの再生に関するセキュリティ」を「ローカルファイルにのみアクセスする」に設定してコンパイルする必要があります。
  2. イメージをロード(イベントが完了)すると、drawImage() メソッドが呼び出されます。イメージが適切にロードされなかった場合、ioErrorHandler() メソッドがトレースコメントを書き出します。
  3. drawImage() メソッドで、BitmapData オブジェクトがインスタンス化され、その幅と高さがイメージ(image1.jpg)に設定されます。その後、ソースイメージが BitmapData オブジェクトに描画されます。次に、矩形が mySprite Sprite オブジェクトに描画され、BitmapData オブジェクトを使用して塗りつぶされます。Matrix オブジェクトを使用して、beginBitmapFill() メソッドがイメージを 45 度回転し、イメージによる矩形の塗りつぶしを開始し、完全に塗りつぶします。
package {
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.geom.Matrix;

    public class Graphics_beginBitmapFillExample extends Sprite {
 
        private var url:String = "image1.jpg";
        private var loader:Loader = new Loader();

        public function Graphics_beginBitmapFillExample() {

            var request:URLRequest = new URLRequest(url);
            
            loader.load(request);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, drawImage);
            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        }

        private function drawImage(event:Event):void {

            var mySprite:Sprite = new Sprite();
            var myBitmap:BitmapData = new BitmapData(loader.width, loader.height, false);
  
            myBitmap.draw(loader, new Matrix());
            
            var matrix:Matrix = new Matrix();
            matrix.rotate(Math.PI/4);
            
            mySprite.graphics.beginBitmapFill(myBitmap, matrix, true);
            mySprite.graphics.drawRect(100, 50, 200, 90);
            mySprite.graphics.endFill();
            
            addChild(mySprite);
        }
 
         private function ioErrorHandler(event:IOErrorEvent):void {
            trace("Unable to load image: " + url);
        }
    }   
}

beginFill

()メソッド 
public function beginFill(color:uint, alpha:Number = 1.0):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

描画のときに他の Graphics メソッド(lineTo()drawCircle() など)に対する今後の呼び出しに使用する単純な一色塗りを指定します。 beginFill()beginBitmapFill()beginGradientFill()、または beginShaderFill() メソッドを呼び出すまで、塗りは有効です。clear() メソッドを呼び出すと、塗りがクリアされます。

アプリケーションでは、3 つ以上の点が描画されたとき、または endFill() メソッドが呼び出されたときに、塗りをレンダリングします。

パラメーター

color:uint — 塗りのカラーです(0xRRGGBB)。
 
alpha:Number (default = 1.0) — 塗りのアルファ値です(0.0 ~ 1.0)。

関連する API エレメント



この例の使用方法
このメソッドの使用方法の詳細については、このクラスの末尾のを参照してください。

beginGradientFill

()メソッド 
public function beginGradientFill(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

そのオブジェクトに対して以後実行する他の Graphics メソッド呼び出し(lineTo()drawCircle() など)で使用するグラデーション塗りを指定します。beginFill()beginBitmapFill()beginGradientFill()、または beginShaderFill() メソッドを呼び出すまで、塗りは有効です。clear() メソッドを呼び出すと、塗りがクリアされます。

アプリケーションでは、3 つ以上の点が描画されたとき、または endFill() メソッドが呼び出されたときに、塗りをレンダリングします。

パラメーター

type:String — 使用するグラデーションのタイプを指定する GradientType クラスの値は、次のとおりです。GradientType.LINEAR または GradientType.RADIAL
 
colors:Array — グラデーションで使用する RGB 16 進カラー値の配列(赤 0xFF0000、青 0x0000FF など)。最大 15 色まで指定できます。 各色について、alphas パラメーターと ratios パラメーターで対応する値を指定してください。
 
alphas:Array — colors 配列内の各色に対応するアルファ値の配列。有効な値は 0 ~ 1 です。 0 未満の値を指定した場合、デフォルトで 0 が適用されます。1 より大きい値を指定した場合、デフォルトで 1 が適用されます。
 
ratios:Array — 色分布比率の配列です。0 ~ 255 の範囲の値を指定できます。この値は、100%でサンプリングされる色の幅の割合をパーセントで定義します。 値 0 はグラデーションボックスの左の位置を表し、255 はグラデーションボックスの右の位置を表します。

注意:この値は、グラデーションボックス内の位置を表すもので、最終グラデーションの座標空間を表すものではありません。最終グラデーションは、グラデーションボックスより広くなったり狭くなったりする場合があります。colors パラメーターの値ごとに、値を指定してください。

例えば、青と緑の 2 色を含む線状グラデーションの場合、次の例は、ratios 配列のさまざまな値に基づいて配置される色を示します。

ratiosグラデーション
[0, 127]青から緑への線状グラデーション(比率 0 と 127)
[0, 255]青から緑への線状グラデーション(比率 0 と 255)
[127, 255]青から緑への線状グラデーション(比率 127 と 255)

配列内の値は、[0, 63, 127, 190, 255] のように順に増やしていく必要があります。

 
matrix:Matrix (default = null) — flash.geom.Matrix クラスで定義される変換マトリックスです。flash.geom.Matrix クラスには、createGradientBox() メソッドがあります。このメソッドを使用すると、beginGradientFill() メソッドで使用できるマトリックスを容易に設定できます。
 
spreadMethod:String (default = "pad") — 使用する spread メソッドを指定する SpreadMethod クラスの値は、次のいずれかです。SpreadMethod.PADSpreadMethod.REFLECT、または SpreadMethod.REPEAT

例えば、2 つの色の間にシンプルな線状グラデーションがあるとします。

     import flash.geom.*
     import flash.display.*
     var fillType:String = GradientType.LINEAR;
     var colors:Array = [0xFF0000, 0x0000FF];
     var alphas:Array = [1, 1];
     var ratios:Array = [0x00, 0xFF];
     var matr:Matrix = new Matrix();
     matr.createGradientBox(20, 20, 0, 0, 0);
     var spreadMethod:String = SpreadMethod.PAD;
     this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);        
     this.graphics.drawRect(0,0,100,100);
     

この例では spread メソッドに SpreadMethod.PAD を使用しているため、グラデーションの塗りは次のようになります。

SpreadMethod.PAD での線状グラデーション

spread メソッドに SpreadMethod.REFLECT を使用する場合、グラデーションの塗りは次のようになります。

SpreadMethod.REFLECT での線状グラデーション

spread メソッドに SpreadMethod.REPEAT を使用する場合、グラデーションの塗りは次のようになります。

SpreadMethod.REPEAT での線状グラデーション

 
interpolationMethod:String (default = "rgb") — 使用する値を指定する InterpolationMethod クラスの値は、InterpolationMethod.LINEAR_RGB または InterpolationMethod.RGB です。

例えば、2 つの色の間に、spreadMethod パラメーターが SpreadMethod.REFLECT に設定されたシンプルな線状グラデーションがあるとします。それぞれの補間方法で、外観に次のような影響があります。

InterpolationMethod.LINEAR_RGB での線状グラデーション InterpolationMethod.RGB での線状グラデーション
InterpolationMethod.LINEAR_RGBInterpolationMethod.RGB
 
focalPointRatio:Number (default = 0) — グラデーションの焦点の位置を制御する数値です。0 は焦点が中央にあること、1 は焦点がグラデーション円のいずれかの境界にあること、-1 は焦点がグラデーション円のもう一方の境界にあることを示します。-1 未満または 1 より大きい値は、-1 または 1 に丸められます。例えば、次の例では、focalPointRatio が 0.75 に設定されています。

focalPointRatio が 0.75 に設定された放射状グラデーション


例外
ArgumentError type パラメーターが有効でない場合

関連する API エレメント

beginShaderFill

()メソッド 
public function beginShaderFill(shader:Shader, matrix:Matrix = null):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

そのオブジェクトに対して以後実行する他の Graphics メソッド呼び出し(lineTo()drawCircle() など)で使用するシェーダー塗りを指定します。beginFill()beginBitmapFill()beginGradientFill()、または beginShaderFill() メソッドを呼び出すまで、塗りは有効です。clear() メソッドを呼び出すと、塗りがクリアされます。

アプリケーションでは、3 つ以上の点が描画されたとき、または endFill() メソッドが呼び出されたときに、塗りをレンダリングします。

シェーダー塗りは、GPU レンダリングではサポートされません。塗られる領域はシアン色になります。

パラメーター

shader:Shader — 塗りに使用するシェーダーです。この Shader インスタンスはイメージ入力の指定には必要ありません。ただし、シェーダーでイメージ入力が指定されている場合は、手動で入力を指定する必要があります。入力を指定するには、Shader.data プロパティについて、対応する ShaderInput プロパティの input プロパティを設定します。

Shader インスタンスを引数として渡すと、シェーダーが内部的にコピーされます。描画塗り操作は、元のシェーダーを参照するのではなく、その内部コピーを使用します。パラメーター値、入力、バイトコードの変更などの変更をシェーダーに加えたとしても、塗りつぶしに使用したコピーシェーダーにはその変更は適用されません。

 
matrix:Matrix (default = null) — flash.geom.Matrix クラスのマトリックスオブジェクトです。これを使用してシェーダー上に変形を定義できます。例えば、次のマトリックスを使用すると、シェーダーを 45 度(π/4 ラジアン)回転できます。
     matrix = new flash.geom.Matrix(); 
     matrix.rotate(Math.PI / 4);
     

シェーダーで受け取る座標は、matrix パラメーターに対して指定したマトリックスに基づきます。デフォルトの(null)のマトリックスの場合、シェーダーの座標は入力のサンプリングが可能なローカルピクセル座標になります。


例外
ArgumentError — シェーダー出力タイプがこの操作に対応しない場合(シェーダーは pixel3 または pixel4 出力を指定する必要があります)。
 
ArgumentError — シェーダーが指定したイメージ入力が存在しない場合。
 
ArgumentError — ByteArray または Vector の場合。<Number> インスタンスが入力として使用され、ShaderInput の width および height プロパティが指定されていない、または指定された値が入力オブジェクトのデータ量と一致しない場合。詳しくは、ShaderInput.input プロパティを参照してください。

関連する API エレメント

clear

()メソッド 
public function clear():void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

この Graphics オブジェクトに描画されているグラフィックをクリアし、塗りと線のスタイルの設定をリセットします。

copyFrom

()メソッド 
public function copyFrom(sourceGraphics:Graphics):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5, Flash Lite 4

すべての描画コマンドをソース Graphics オブジェクトから、呼び出し Graphics オブジェクトにコピーします。

パラメーター

sourceGraphics:Graphics — 描画コマンドのコピー元の Graphics オブジェクトです。

cubicCurveTo

()メソッド 
public function cubicCurveTo(controlX1:Number, controlY1:Number, controlX2:Number, controlY2:Number, anchorX:Number, anchorY:Number):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 11, AIR 3

現在の描画位置から指定されたアンカーポイントに 3 次ベジェ曲線を描画します。3 次ベジェ曲線は、2 つのアンカーポイントと 2 つのコントロールポイントで構成されています。曲線は、2 つのアンカーポイントを補間し、2 つのコントロールポイントに向かいます。

3 次ベジェ

cubicCurveTo() メソッドで 3 次ベジェ曲線を描画するために使用する 4 つのポイントは次のとおりです。

  • 現在の描画位置が最初のアンカーポイントです。
  • anchorX および anchorY パラメーターで 2 番目のアンカーポイントを指定します。
  • controlX1 および controlY1 パラメーターで 最初のコントロールポイントを指定します。
  • controlX2 および controlY2 パラメーターで 2 番目のコントロールポイントを指定します。

moveTo() メソッドを呼び出す前に cubicCurveTo() メソッドを呼び出すと、曲線は位置 (0, 0) で始まります。

cubicCurveTo() メソッドが成功すると、Flash ランタイムは現在の描画位置を (anchorX, anchorY) に設定します。cubicCurveTo() メソッドが失敗すると、現在の描画位置は変更されません。

ムービークリップに Flash の描画ツールで作成したコンテンツが含まれている場合は、cubicCurveTo() メソッドの呼び出しの結果はそのコンテンツの下に描画されます。

パラメーター

controlX1:Number — 親表示オブジェクトの基準点からの相対的な位置にある、最初のコントロールポイントの水平位置を指定します。
 
controlY1:Number — 親表示オブジェクトの基準点からの相対的な位置にある、最初のコントロールポイントの垂直位置を指定します。
 
controlX2:Number — 親表示オブジェクトの基準点からの相対的な位置にある、2 番目のコントロールポイントの水平位置を指定します。
 
controlY2:Number — 親表示オブジェクトの基準点からの相対的な位置にある、2 番目のコントロールポイントの垂直位置を指定します。
 
anchorX:Number — 親表示オブジェクトの基準点からの相対的な位置にある、アンカーポイントの水平位置を指定します。
 
anchorY:Number — 親表示オブジェクトの基準点からの相対的な位置にある、アンカーポイントの垂直位置を指定します。


例  ( この例の使用方法 )

次の例では、幅と高さが 100 ピクセルで、Sprite 表示オブジェクトの基準点 (0, 0) から右に 250 ピクセルの青の丸いオブジェクトを描画します。

4 本の曲線を描いて円を作成し、青で塗りつぶします。

3 次ベジェ方程式の性質上、これは完全な円ではありません。円を描画する最善の方法は、Graphics クラスの drawCircle() メソッドを使用することです。

package {
    import flash.display.Sprite;
    import flash.display.Shape;
    
    public class Graphics_cubicCurveToExample extends Sprite
    {
        public function Graphics_cubicCurveToExample():void
        {
            var rounderObject:Shape = new Shape();

            rounderObject.graphics.beginFill(0x0000FF);
            rounderObject.graphics.moveTo(250, 0);
            rounderObject.graphics.cubicCurveTo(275, 0, 300, 25, 300, 50);
            rounderObject.graphics.cubicCurveTo(300, 75, 275, 100, 250, 100);
            rounderObject.graphics.cubicCurveTo(225, 100, 200, 75, 200, 50);
            rounderObject.graphics.cubicCurveTo(200, 25, 225, 0, 250, 0);
            rounderObject.graphics.endFill();
            
            this.addChild(rounderObject);
        }
    }
}

curveTo

()メソッド 
public function curveTo(controlX:Number, controlY:Number, anchorX:Number, anchorY:Number):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

(controlX, controlY) で指定されたコントロールポイントを使用し、現在の描画位置から (anchorX, anchorY) まで、現在の線のスタイルで 2 次ベジェ曲線を描画します。その後、現在の描画位置は (anchorX, anchorY) に設定されます。描画先のムービークリップに Flash の描画ツールで作成したコンテンツが含まれている場合は、curveTo() メソッドへの呼び出しの結果はこのコンテンツの下に描画されます。curveTo() メソッドを呼び出してから moveTo() メソッドを呼び出すと、現在の描画位置はデフォルトで (0,0) になります。いずれかのパラメーターを省略すると、このメソッドは失敗し、現在の描画位置は変更されません。

描画される曲線は、2 次ベジェ曲線です。2 次ベジェ曲線は、2 つのアンカーポイントと 1 つのコントロールポイントで構成されています。曲線は、2 つのアンカーポイントを補間し、コントロールポイントに向かいます。

2 次ベジェ

パラメーター

controlX:Number — 親表示オブジェクトの基準点からの相対的なコントロールポイントの水平座標を指定する数値。
 
controlY:Number — 親表示オブジェクトの基準点からの相対的なコントロールポイントの垂直座標を指定する数値。
 
anchorX:Number — 親表示オブジェクトの基準点からの相対的な次のアンカーポイントの水平座標を指定する数値。
 
anchorY:Number — 親表示オブジェクトの基準点からの相対的な次のアンカーポイントの垂直座標を指定する数値。


例  ( この例の使用方法 )

次の例では、幅と高さが 100 ピクセル、Sprite 表示オブジェクトの基準点 (0, 0) から右に 250 ピクセルの緑の丸いオブジェクトを描画します。

4 本の曲線を描いて円を作成し、緑で塗りつぶします。

2 次ベジェ方程式の性質上、これは完全な円ではありません。円を描画する最善の方法は、Graphics クラスの drawCircle() メソッドを使用することです。

package {
    import flash.display.Sprite;
    import flash.display.Shape;
    
    public class Graphics_curveToExample1 extends Sprite
    {
        public function Graphics_curveToExample1():void
        {
            var roundObject:Shape = new Shape();

            roundObject.graphics.beginFill(0x00FF00);
            roundObject.graphics.moveTo(250, 0);
            roundObject.graphics.curveTo(300, 0, 300, 50);
            roundObject.graphics.curveTo(300, 100, 250, 100);
            roundObject.graphics.curveTo(200, 100, 200, 50);
            roundObject.graphics.curveTo(200, 0, 250, 0);
            roundObject.graphics.endFill();
            
            this.addChild(roundObject);
        }
    }
}

次の例では、curveTo() メソッドを使用して新月を描画します。

1 ピクセルの 2 本の曲線を描画し、その曲線の間のスペースを白で塗りつぶします。moveTo() メソッドを使用して、現在の描画位置を座標 (100, 100) に配置します。最初の曲線の描画位置がターゲットポイント (100, 200) に移動します。2 番目の曲線の描画位置がターゲットポイントである開始位置 (100, 100) に戻ります。水平方向のコントロールポイントで、異なる曲線サイズが指定されています。

package {
    import flash.display.Sprite;
    import flash.display.Shape;

    public class Graphics_curveToExample2 extends Sprite
    {
        public function Graphics_curveToExample2() {
            var newMoon:Shape = new Shape();
            
            newMoon.graphics.lineStyle(1, 0);
            newMoon.graphics.beginFill(0xFFFFFF);
            newMoon.graphics.moveTo(100, 100); 
            newMoon.graphics.curveTo(30, 150, 100, 200);    
            newMoon.graphics.curveTo(50, 150, 100, 100);
            graphics.endFill();
            
            this.addChild(newMoon);
        }
    }
}

drawCircle

()メソッド 
public function drawCircle(x:Number, y:Number, radius:Number):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

円を描画します。drawCircle() メソッドを呼び出す前に、線のスタイルまたは塗り、あるいはその両方を設定します。そのためには、linestyle()lineGradientStyle()beginFill()beginGradientFill()、または beginBitmapFill() メソッドを呼び出します。

パラメーター

x:Number — 親表示オブジェクトの基準点からの円の中心の相対 x 座標(ピクセル単位)。
 
y:Number — 親表示オブジェクトの基準点からの円の中心の相対 y 座標(ピクセル単位)。
 
radius:Number — 円の半径(ピクセル単位)。

関連する API エレメント



この例の使用方法
このメソッドの使用方法の詳細については、このクラスの末尾のを参照してください。

drawEllipse

()メソッド 
public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

楕円を描画します。drawEllipse() メソッドを呼び出す前に、線のスタイルまたは塗り、あるいはその両方を設定します。そのためには、linestyle()lineGradientStyle()beginFill()beginGradientFill()、または beginBitmapFill() メソッドを呼び出します。

パラメーター

x:Number — 親表示オブジェクトの基準点からの楕円の境界ボックスの左上の相対 x 座標(ピクセル単位)です。
 
y:Number — 親表示オブジェクトの基準点に対して相対的な、楕円の境界ボックスの左上の y 座標(ピクセル単位)です。
 
width:Number — 楕円の幅(ピクセル単位)。
 
height:Number — 楕円の高さ(ピクセル単位)。

関連する API エレメント


例  ( この例の使用方法 )

次の例では、drawEgg() 関数を使用し、eggSize パラメーターに応じて 3 つの異なるサイズの卵(3 種類のサイズの楕円)を描画します。
  1. コンストラクターが drawEgg() 関数を呼び出し、卵を描画する領域に対する水平方向および垂直方向のパラメーターと卵の種類(eggSize)を渡します。卵(楕円)の高さと幅は、描画する領域を決定するために使用できます。
  2. drawEgg() 関数が、それぞれのサイズの楕円を描画し、beginFill() メソッドを使用して白く塗りつぶします。この関数に対して事前に記述されたエラー処理はありません。
package {
    import flash.display.Sprite;
    import flash.display.Shape;

    public class Graphics_drawEllipseExample extends Sprite
    {
        public static const SMALL:uint = 0;
        public static const MEDIUM:uint = 1;
        public static const LARGE:uint = 2;

        public function Graphics_drawEllipseExample()
        {
            drawEgg(SMALL, 0, 100);
            drawEgg(MEDIUM, 100, 60);
            drawEgg(LARGE, 250, 35);    
        }

        public function drawEgg(eggSize:uint, x:Number, y:Number):void  {
            
            var myEgg:Shape = new Shape();
            
            myEgg.graphics.beginFill(0xFFFFFF);
            myEgg.graphics.lineStyle(1);

            switch(eggSize) {
                case SMALL:
                    myEgg.graphics.drawEllipse(x, y, 60, 70);
                    break;
                case MEDIUM:
                    myEgg.graphics.drawEllipse(x, y, 120, 150);    
                    break;
                case LARGE:
                    myEgg.graphics.drawEllipse(x, y, 150, 200);
                    break;
                default:
                    trace ("Wrong size! There is no egg.");
                break;            
            }
            
            myEgg.graphics.endFill();
    
            this.addChild(myEgg);
        }
    }
}

drawGraphicsData

()メソッド 
public function drawGraphicsData(graphicsData:Vector.<IGraphicsData>):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

描画用の一連の IGraphicsData インスタンスを送信します。このメソッドでは、IGraphicsData インターフェイスを実装する、パス、塗り、線などのオブジェクトを含む Vector を使用できます。IGraphicsData インスタンスの Vector は、図形の一部を表す場合と、図形全体を描画するための複雑な定義済みデータセットを表す場合があります。

グラフィックパスには別のグラフィックパスを含めることができます。 この操作では、graphicsData Vector にパスが含まれる場合、そのパスとサブパスがすべてレンダリングされます。

パラメーター

graphicsData:Vector.<IGraphicsData> — グラフィックオブジェクトを含む Vector です。IGraphicsData インターフェイスを実装します。

関連する API エレメント


例  ( この例の使用方法 )

以下の例では、GraphicsGradientFill オブジェクトを作成して、四角形の塗りプロパティを設定します。次に、GraphicsStroke オブジェクト(線の太さ用)と GraphicsSolidFill オブジェクト(線のカラー用)を作成して、四角形の境界線のプロパティを設定します。その後、GraphicsPath オブジェクトを作成して、図形描画用の値を含めます。これらのオブジェクトはすべて 1 つの IGraphicsData オブジェクトに格納され、図形をレンダリングする drawGraphicsData() コマンドに渡されます。
package
{
    import flash.display.*;
    import flash.geom.*;

    public class DrawGraphicsDataExample extends Sprite
    {
        public function DrawGraphicsDataExample()
        {
            // establish the fill properties
            var myFill:GraphicsGradientFill = new GraphicsGradientFill();
            myFill.colors = [0xEEFFEE, 0x0000FF];
            myFill.matrix = new Matrix();
            myFill.matrix.createGradientBox(100, 100, 0);
            
            // establish the stroke properties
            var myStroke:GraphicsStroke = new GraphicsStroke(2);
            myStroke.fill = new GraphicsSolidFill(0x000000);
            
            // establish the path properties
            var pathCommands = new Vector.<int>(5, true);
            pathCommands[0] = GraphicsPathCommand.MOVE_TO;
            pathCommands[1] = GraphicsPathCommand.LINE_TO;
            pathCommands[2] = GraphicsPathCommand.LINE_TO;
            pathCommands[3] = GraphicsPathCommand.LINE_TO;
            pathCommands[4] = GraphicsPathCommand.LINE_TO;
            
            var pathCoordinates:Vector.<Number> = new Vector.<Number>(10, true);
            pathCoordinates.push(10,10, 10,100, 100,100, 100,10, 10,10);
            
            var myPath:GraphicsPath = new GraphicsPath(pathCommands, pathCoordinates);
            
            // populate the IGraphicsData Vector array
            var myDrawing:Vector.<IGraphicsData> = new Vector.<IGraphicsData>(3, true);
            myDrawing[0] = myFill;
            myDrawing[1] = myStroke;
            myDrawing[2] = myPath;
            
            // render the drawing
            graphics.drawGraphicsData(myDrawing);
        }
    }
}

drawPath

()メソッド 
public function drawPath(commands:Vector.<int>, data:Vector.<Number>, winding:String = "evenOdd"):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

描画用の一連のコマンドを送信します。 drawPath() メソッドは、個別の moveTo()lineTo() および curveTo() 描画コマンドの Vector を受け入れ、それらを結合して 1 つの呼び出しを作成します。drawPath() メソッドのパラメーターは、描画コマンドと、x 座標と y 座標の値のペアおよび描画方向の組み合わせです。描画コマンドは整数であり、各整数は GraphicsPathCommand クラスで定義された定数で表されます。x 座標と y 座標の値のペアは配列の Number であり、各ペアによって座標位置が定義されます。描画方向は、GraphicsPathWinding クラスの値です。

一般に、描画では、drawPath() を使用する方が、個別の lineTo() メソッドと curveTo() メソッドを連続して呼び出すよりもレンダリングが高速です。

drawPath() メソッドでは、浮動小数点の計算を使用するため、シェイプの回転と拡大 / 縮小がより正確で、よりよい結果が得られます。ただし、drawPath() メソッドを使用して送信された曲線は、lineTo() メソッドおよび curveTo() メソッドと組み合わせて使用された場合、小さなサブピクセルの配置誤差が発生することがあります。

drawPath() メソッドは、線の塗りおよび描画に少し異なる規則も使用します。異なる規則を以下に示します。

  • 塗りがパスをレンダリングするのに適用される場合:
    • 3 ポイント未満のサブパスはレンダリングされません(ただし、線のレンダリングは発生し、線に対する規則は以下と同じになります)。
    • 閉じていないサブパス(始まりと終わりの端点が同じでない)は、暗黙的に閉じられます。
  • 線がパスをレンダリングするのに適用される場合:
    • サブパスは、任意の数のポイントで構成できます。
    • サブパスが暗黙的に閉じられることはありません。

パラメーター

commands:Vector.<int> — 描画コマンドを表す整数の Vector です。有効な値のセットは、GraphicsPathCommand クラスの定数で定義されます。
 
data:Vector.<Number> — Number インスタンスの Vector で、数値の各ペアは座標位置(x と y のペア)として扱われます。x 座標と y 座標の値のペアは Point オブジェクトではありません。data ベクターは一連の数値であり、2 つの数値からなる各グループは 1 つの座標位置を表します。
 
winding:String (default = "evenOdd") — GraphicsPathWinding クラスで定義されている値を使用して、湾曲規則を指定します。

関連する API エレメント


例  ( この例の使用方法 )

次の例では、2 つの Vector オブジェクトを作成し、これを drawPath() メソッドに渡して青い星をレンダリングします。1 つ目の Vector である star_commands には、GraphicsPathCommand クラスの描画コマンドを表す一連の定数が含まれます。2 つ目の Vector である star_coord には、x 座標と y 座標のペアが 5 組格納されています。drawPath() メソッドは、これらのコマンドを位置と対応させて、星を描画します。
package
{
    import flash.display.*;
        
    public class DrawPathExample extends Sprite
    {
        public function DrawPathExample()
        {
            var star_commands:Vector.<int> = new Vector.<int>(5, true);
            
            star_commands[0] = GraphicsPathCommand.MOVE_TO;
            star_commands[1] = GraphicsPathCommand.LINE_TO;
            star_commands[2] = GraphicsPathCommand.LINE_TO;
            star_commands[3] = GraphicsPathCommand.LINE_TO;
            star_commands[4] = GraphicsPathCommand.LINE_TO;
            
            var star_coord:Vector.<Number> = new Vector.<Number>(10, true);
            star_coord[0] = 66; //x
            star_coord[1] = 10; //y 
            star_coord[2] = 23; 
            star_coord[3] = 127; 
            star_coord[4] = 122; 
            star_coord[5] = 50; 
            star_coord[6] = 10; 
            star_coord[7] = 49; 
            star_coord[8] = 109; 
            star_coord[9] = 127;
            
            graphics.beginFill(0x003366);
            graphics.drawPath(star_commands, star_coord);
        }
    }
}

注意:デフォルトでは、drawPath() メソッドは奇数 / 偶数の湾曲タイプを使用します。このため、星の中心は塗りつぶされません。次のように、3 つ目のパラメーターにゼロ以外の湾曲タイプを指定すると、星の中心が塗りつぶされます。
 graphics.drawPath(star_commands, star_coord, GraphicsPathWinding.NON_ZERO);
 

drawRect

()メソッド 
public function drawRect(x:Number, y:Number, width:Number, height:Number):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

矩形を描画します。drawRect() メソッドを呼び出す前に、線のスタイルまたは塗り、あるいはその両方を設定します。そのためには、linestyle()lineGradientStyle()beginFill()beginGradientFill()、または beginBitmapFill() メソッドを呼び出します。

パラメーター

x:Number — 親表示オブジェクトの基準点からの相対的な水平座標を示す数値(ピクセル単位)。
 
y:Number — 親表示オブジェクトの基準点からの相対的な垂直座標を示す数値(ピクセル単位)。
 
width:Number — 矩形の幅(ピクセル単位)。
 
height:Number — 矩形の高さ(ピクセル単位)。


例外
ArgumentError width または height パラメーターが数値(Number.NaN)でない場合

関連する API エレメント


例  ( この例の使用方法 )

次の例では、ActionScript 3.0 でシェイプを描画する方法を示します。この例は ActionScriptExamples.com で提供されています。
var movieClip:MovieClip = new MovieClip();
movieClip.graphics.beginFill(0xFF0000);
movieClip.graphics.drawRect(0, 0, 100, 80);
movieClip.graphics.endFill();
movieClip.x = 10;
movieClip.y = 10;
addChild(movieClip);

drawRoundRect

()メソッド 
public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, ellipseWidth:Number, ellipseHeight:Number = NaN):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

角丸矩形を描画します。drawRoundRect() メソッドを呼び出す前に、線のスタイルまたは塗り、あるいはその両方を設定します。そのためには、linestyle()lineGradientStyle()beginFill()beginGradientFill()、または beginBitmapFill() メソッドを呼び出します。

パラメーター

x:Number — 親表示オブジェクトの基準点からの相対的な水平座標を示す数値(ピクセル単位)。
 
y:Number — 親表示オブジェクトの基準点からの相対的な垂直座標を示す数値(ピクセル単位)。
 
width:Number — 角丸矩形の幅(ピクセル単位)。
 
height:Number — 角丸矩形の高さ(ピクセル単位)。
 
ellipseWidth:Number — 丸角の描画に使用される楕円の幅(ピクセル単位)。
 
ellipseHeight:Number (default = NaN) — 丸角の描画に使用される楕円の高さ(ピクセル単位)。(オプション)値を指定しない場合は、ellipseWidth パラメーターに指定された値がデフォルトで適用されます。


例外
ArgumentError widthheightellipseWidth、または ellipseHeight パラメーターが数値(Number.NaN)でない場合

関連する API エレメント



この例の使用方法
このメソッドの使用方法の詳細については、このクラスの末尾のを参照してください。

drawTriangles

()メソッド 
public function drawTriangles(vertices:Vector.<Number>, indices:Vector.<int> = null, uvtData:Vector.<Number> = null, culling:String = "none"):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

一連の三角形をレンダリングします。通常は、ビットマップを歪曲させて、3 次元の外観にします。drawTriangles() メソッドは、(u,v) 座標を使用して現在の塗りまたはビットマップ塗りを三角形の各面にマッピングします。

どのタイプの塗りでも使用できます。ただし、その塗りに変換マトリックスがある場合でも、その変換マトリックスは無視されます。

ビットマップ塗りを使用する場合、uvtData パラメーターを使用すると、テクスチャマッピングを改善できます。

パラメーター

vertices:Vector.<Number> — Number の Vector で、数値の各ペアは座標位置(x と y のペア)として扱われます。vertices パラメーターを指定する必要があります。
 
indices:Vector.<int> (default = null) — 整数またはインデックスの Vector です。3 つのインデックスごとに三角形が定義されます。indexes パラメーターが null の場合、3 つの頂点(vertices Vector 内の 6 つの x、y ペア)ごとに三角形が定義されます。null でない場合、各インデックスは頂点(vertices Vector 内の数値のペア)を参照します。例えば、indexes[1] は(vertices[2], vertices[3])を参照します。indexes パラメーターはオプションですが、インデックスを使用すると、通常、送信されるデータ量と計算されるデータ量が減少します。
 
uvtData:Vector.<Number> (default = null) — テクスチャマッピングを適用するために使用される正規化座標の Vector です。各座標は、塗りに使用されるビットマップ上のポイントを参照します。頂点ごとに 1 つの UV 座標または 1 つの UVT 座標が必要です。UV 座標では、(0,0)はビットマップの左上隅で、(1,1)はビットマップの右下隅です。

このベクターの長さが vertices ベクターの 2 倍である場合、外見上の修正を行うことなく、正規化座標が使用されます。

このベクターの長さが vertices ベクターの 3 倍である場合、3 番目の座標は、「t」(視点空間における視点からテクスチャまでの距離)として解釈されます。これにより、3D でテクスチャをマッピングする場合に、レンダリングエンジンが外観を正しく適用できるようになります。

uvtData パラメーターが null の場合、通常の塗り規則(およびいずれかの塗りタイプ)が適用されます。

 
culling:String (default = "none") — 特定の方向に面する三角形をレンダリングするかどうかを指定します。このパラメーターは、現在のビューで見えない三角形のレンダリングを避けるのに使用します。このパラメーターは、TriangleCulling クラスで定義された任意の値に設定できます。

関連する API エレメント

endFill

()メソッド 
public function endFill():void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

beginFill()beginGradientFill()、または beginBitmapFill() メソッドへの最後の呼び出し以降に追加された線と曲線に塗りを適用します。適用される塗りは、beginFill()beginGradientFill()、または beginBitmapFill() メソッドの前回の呼び出しで指定されたものです。現在の描画位置が moveTo() メソッドの直前の呼び出しで指定された座標と等しくない場合、塗りが定義されていれば、パスが線で閉じられた後、塗りが適用されます。

関連する API エレメント

lineBitmapStyle

()メソッド 
public function lineBitmapStyle(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

線の描画で、線として使用するビットマップを指定します。

ビットマップ線スタイルは、lineTo() メソッドや drawCircle() メソッドなど、Graphics のメソッドの後続の呼び出しに使用されます。線のスタイルは、lineStyle() メソッド、lineGradientStyle() メソッド、または lineBitmapStyle() メソッドを再度異なるパラメーターで呼び出すまで有効です。

パスの描画中に lineBitmapStyle() メソッドを呼び出し、パス内の線のセグメントごとに異なるスタイルを指定できます。

線を有効にするには、先に lineStyle() メソッドを呼び出してから lineBitmapStyle() メソッドを呼び出します。そうでないと、線スタイルの値は undefined になります。

clear() メソッドを呼び出すと、線スタイルの設定が undefined に戻ります。

パラメーター

bitmap:BitmapData — 線を描画するときに使用するビットマップです。
 
matrix:Matrix (default = null) — flash.geom.Matrix クラスで定義されるオプションの変換マトリックスです。マトリックスを使用して拡大 / 縮小できます。または、線スタイルに適用する前にビットマップを操作します。
 
repeat:Boolean (default = true) — ビットマップをタイル状に繰り返すかどうか。
 
smooth:Boolean (default = false) — ビットマップにスムージングを適用するかどうか。

関連する API エレメント

lineGradientStyle

()メソッド 
public function lineGradientStyle(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9

線の描画で使用するグラデーションを指定します。

lineTo() メソッドや drawCircle() メソッドなど、Graphics のメソッドの後続の呼び出しにはグラデーション線スタイルが使用されます。線のスタイルは、lineStyle() メソッド、lineBitmapStyle() メソッド、または lineGradientStyle() メソッドを再度別のパラメーターで呼び出すまで有効のままです。

パスの描画中に lineGradientStyle() メソッドを呼び出し、パス内の線のセグメントごとに異なるスタイルを指定できます。

線を有効にするには、先に lineStyle() メソッドを呼び出してから lineGradientStyle() メソッドを呼び出します。そうでないと、線スタイルの値は undefined になります。

clear() メソッドを呼び出すと、線スタイルの設定が undefined に戻ります。

パラメーター

type:String — 使用するグラデーションのタイプを指定する GradientType クラスの値は、GradientType.LINEAR または GradientType.RADIAL のいずれかです。
 
colors:Array — グラデーションで使用する RGB 16 進カラー値の配列(赤 0xFF0000、青 0x0000FF など)。
 
alphas:Array — colors 配列内の各色に対応するアルファ値の配列。有効な値は 0 ~ 1 です。0 未満の値の場合は、デフォルトで 0 が適用されます。1 より大きい値の場合は、デフォルトで 1 が適用されます。
 
ratios:Array — 色分布比率の配列です。0 ~ 255 の範囲の値を指定できます。この値は、100% でサンプリングされる色の幅の割合をパーセントで定義します。値 0 はグラデーションボックスの左の位置を表し、255 はグラデーションボックスの右の位置を表します。この値は、グラデーションボックス内の位置を表すもので、最終グラデーションの座標空間を表すものではありません。最終グラデーションは、グラデーションボックスより広くなったり狭くなったりする場合があります。colors パラメーターの値ごとに、値を指定してください。

例えば、青と緑の 2 色を含む線状グラデーションの場合、次の図は、ratios 配列のさまざまな値に基づいて配置される色を示します。

ratiosグラデーション
[0, 127]青から緑への線状グラデーション(比率 0 と 127)
[0, 255]青から緑への線状グラデーション(比率 0 と 255)
[127, 255]青から緑への線状グラデーション(比率 127 と 255)

配列内の値は、[0, 63, 127, 190, 255] のように順に増やしていく必要があります。

 
matrix:Matrix (default = null) — flash.geom.Matrix クラスで定義される変換マトリックスです。flash.geom.Matrix クラスには、createGradientBox() メソッドがあります。このメソッドを使用すると、lineGradientStyle() メソッドで使用できるマトリックスを容易に設定できます。
 
spreadMethod:String (default = "pad") — 使用する spread メソッドを指定する SpreadMethod クラスの値は、次のとおりです。

SpreadMethod.PAD での線状グラデーションSpreadMethod.REFLECT での線状グラデーションSpreadMethod.REPEAT での線状グラデーション
SpreadMethod.PADSpreadMethod.REFLECTSpreadMethod.REPEAT

 
interpolationMethod:String (default = "rgb") — 使用する値を指定する InterpolationMethod クラスの値です。 例えば、2 つの色の間に、spreadMethod パラメーターが SpreadMethod.REFLECT に設定されたシンプルな線状グラデーションがあるとします。それぞれの補間方法で、外観に次のような影響があります。

InterpolationMethod.LINEAR_RGB での線状グラデーションInterpolationMethod.RGB での線状グラデーション
InterpolationMethod.LINEAR_RGBInterpolationMethod.RGB

 
focalPointRatio:Number (default = 0) — グラデーションの焦点の位置を制御する数値です。0 は焦点が中央にあること、1 は焦点がグラデーション円のいずれかの境界にあること、-1 は焦点がグラデーション円のもう一方の境界にあることを示します。-1 未満の値は -1 に、1 より大きい値は 1 に丸められます。次のイメージは、focalPointRatio を -0.75 に設定したグラデーションを示しています。

focalPointRatio が 0.75 に設定された放射状グラデーション

関連する API エレメント


例  ( この例の使用方法 )

次の例では、赤から緑、青へのグラデーションの境界線を使用する矩形と円を描画します。

Matrix クラスの createGradientBox() メソッドを使用して、グラデーションボックスが幅 200、高さ 40 に定義されます。線の太さは 5 ピクセルに設定されます。境界線の太さを、lineGradientStyle() メソッドに対して定義する必要があります。グラデーションは線状に設定されます。グラデーションの色は赤、緑、および青に設定されます。色の透明度(アルファ値)は 1(不透明)に設定されます。グラデーションの分布は均等です。つまり、値 0(グラデーションボックスの左の位置)、128(ボックスの中央の位置)、255(ボックスの右の位置)の各位置で 100% で色がサンプリングされます。矩形の幅はグラデーションのすべての領域を包含します。一方、円は領域の中央から 50% を包含します。

package {
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.geom.Matrix; 
    import flash.display.GradientType;
    
    public class Graphics_lineGradientStyleExample extends Sprite
    {
        public function Graphics_lineGradientStyleExample()
        {
            var myShape:Shape = new Shape();
            var gradientBoxMatrix:Matrix = new Matrix();
  
            gradientBoxMatrix.createGradientBox(200, 40, 0, 0, 0);  
            
            myShape.graphics.lineStyle(5);
  
            myShape.graphics.lineGradientStyle(GradientType.LINEAR, [0xFF0000,
            0x00FF00, 0x0000FF], [1, 1, 1], [0, 128, 255], gradientBoxMatrix);
            
            myShape.graphics.drawRect(0, 0, 200, 40);
            myShape.graphics.drawCircle(100, 120, 50);  
             
            this.addChild(myShape);
    
        }
    }
}

lineShaderStyle

()メソッド 
public function lineShaderStyle(shader:Shader, matrix:Matrix = null):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

線の描画で、線として使用するシェーダーを指定します。

ビットマップ線スタイルは、lineTo() メソッドや drawCircle() メソッドなど、Graphics のメソッドの後続の呼び出しに使用されます。線のスタイルは、lineStyle() メソッド、lineGradientStyle() メソッド、または lineBitmapStyle() メソッドを再度異なるパラメーターで呼び出すまで有効です。

パスの描画中に lineShaderStyle() メソッドを呼び出し、パス内の線のセグメントごとに異なるスタイルを指定できます。

線を有効にするには、先に lineStyle() メソッドを呼び出してから lineShaderStyle() メソッドを呼び出します。そうでないと、線スタイルの値は undefined になります。

clear() メソッドを呼び出すと、線スタイルの設定が undefined に戻ります。

パラメーター

shader:Shader — 線を描画するときに使用するシェーダーです。
 
matrix:Matrix (default = null) — flash.geom.Matrix クラスで定義されるオプションの変換マトリックスです。マトリックスを使用して拡大 / 縮小できます。または、線スタイルに適用する前にビットマップを操作します。

関連する API エレメント

lineStyle

()メソッド 
public function lineStyle(thickness:Number = NaN, color:uint = 0, alpha:Number = 1.0, pixelHinting:Boolean = false, scaleMode:String = "normal", caps:String = null, joints:String = null, miterLimit:Number = 3):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

lineTo() メソッドや drawCircle() メソッドなど、Graphics のメソッドの後続の呼び出しに使用する線スタイルを指定します。線のスタイルは、lineGradientStyle() メソッド、lineBitmapStyle() メソッド、または lineStyle() メソッドを再度別のパラメーターで呼び出すまで有効のままです。

パスの描画中に lineStyle() メソッドを呼び出し、パス内の線のセグメントごとに異なるスタイルを指定できます。

注意:clear() メソッドを呼び出すと、線のスタイルが undefined に戻ります。

注意:Flash Lite 4 では、最初の 3 つのパラメーター(thicknesscolor および alpha)のみがサポートされます。

パラメーター

thickness:Number (default = NaN) — 線の太さをポイント単位で示す整数。有効な値は 0 ~ 255 です。パラメーターが undefined である場合は、線は描画されません。0 未満の値を指定した場合は、デフォルトで 0 が適用されます。0 は極細線です。最大の太さは 255 です。255 を超える値を指定した場合は、デフォルトで 255 が適用されます。
 
color:uint (default = 0) — 線の色を表す 16 進値。例えば、赤は 0xFF0000、青は 0x0000FF で表します。値を指定しない場合は、デフォルトで 0x000000(黒)が適用されます。オプションです。
 
alpha:Number (default = 1.0) — 線の色のアルファ値を示す数値。有効な値は 0 ~ 1 です。値を指定しない場合は、デフォルトで 1(ソリッド)が適用されます。0 未満の値を指定した場合、デフォルトで 0 が適用されます。1 より大きい値を指定した場合、デフォルトで 1 が適用されます。
 
pixelHinting:Boolean (default = false) — (Flash Lite 4 ではサポートされません)ピクセル全体に対して線をヒンティングするかどうかを指定するブール値です。この値は、曲線のアンカーの位置と線のサイズ自身の両方に影響を与えます。pixelHintingtrue に設定すると、線幅が全ピクセル幅に調整されます。 pixelHintingfalse に設定すると、曲線と直線で非連続が発生することがあります。例えば、次の図は、Flash Player または Adobe AIR で、pixelHinting パラメーター(lineStyle() メソッドで使用)の設定が異なるだけで他はまったく同じ 2 つの角丸矩形がどのようにレンダリングされるかを示したものです(違いが分かるようにイメージは 200% に拡大されています)。

pixelHinting false および pixelHinting true

値を指定しない場合、線でピクセルのヒンティングが使用されません。

 
scaleMode:String (default = "normal") — (Flash Lite 4 ではサポートされません)使用する拡大・縮小モードを指定する LineScaleMode クラスの値です。
  • LineScaleMode.NORMAL — オブジェクトが拡大 / 縮小される場合、常に線の太さが拡大 / 縮小されます(デフォルト)。
  • LineScaleMode.NONE — 線の太さを拡大 / 縮小しません。
  • LineScaleMode.VERTICAL — オブジェクトを垂直方向にのみ拡大 / 縮小する場合は、線の太さを拡大 / 縮小しません。例えば、次に示す各円は、1 ピクセルの線で描画され、それぞれ scaleMode パラメーターが LineScaleMode.VERTICAL に設定されているとします。左側の円は垂直方向にのみ拡大または縮小され、右側の円は垂直と水平の両方向に拡大または縮小されたものです。

    1 つの円は垂直方向に拡大または縮小され、もう 1 つの円は垂直と水平の両方向に拡大または縮小されています。

  • LineScaleMode.HORIZONTAL — オブジェクトを水平方向にのみ拡大 / 縮小する場合は、線の太さを拡大 / 縮小しません。例えば、次に示す各円は、1 ピクセルの線で描画され、それぞれ scaleMode パラメーターが LineScaleMode.HORIZONTAL に設定されているとします。左側の円は水平方向にのみ拡大または縮小され、右側の円は垂直と水平の両方向に拡大または縮小されたものです。

    1 つの円は水平方向に拡大または縮小され、もう 1 つの円は垂直と水平の両方向に拡大または縮小されています。

 
caps:String (default = null) — (Flash Lite 4 ではサポートされません)線の終端のキャップの種類を指定する CapsStyle クラスの値です。有効な値は次のとおりです。CapsStyle.NONECapsStyle.ROUND、および CapsStyle.SQUARE。この値を指定しない場合は、丸いキャップが使用されます。

例えば、次の図は capsStyle のさまざまな設定を示します。それぞれの設定で、図の青い線は太さ 30 で、capsStyle が適用されています。重ね合わせた黒い線は太さ 1 で、capsStyle は適用されていません。

NONE、ROUND、および SQUARE

 
joints:String (default = null) — (Flash Lite 4 ではサポートされません)角で使用する接合点の外観の種類を指定する JointStyle クラスの値です。有効な値は次のとおりです。JointStyle.BEVELJointStyle.MITER、および JointStyle.ROUND。この値を指定しないと、角丸("round")の接合点が使用されます。

例えば、次の図は joints のさまざまな設定を示します。それぞれの設定で、角のある青い線は太さ 30 で、jointStyle が適用されています。重ね合わせた黒い線は太さ 1 で、jointStyle は適用されていません。

MITER、ROUND、および BEVEL

注意:jointsJointStyle.MITER に設定すると、miterLimit パラメーターを使用して、マイターの長さを制限できます。

 
miterLimit:Number (default = 3) — (Flash Lite 4 ではサポートされません)マイターが切り取られる限度を示す数値です。有効な値の範囲は 1 ~ 255 で、この範囲を超えた値は 1 または 255 に丸められます。この値は、jointStyle"miter" に設定した場合にのみ有効です。miterLimit の値により、線の接合点を越えてマイターを延長できる長さが決定します。マイターを延長できる長さは、この値と線の thickness が乗算されたものです。例えば、miterLimit の値が 2.5 で、thickness が 10 ピクセルの場合、マイターは 25 ピクセルで切り取られます。

例として、次のような角のある線を考えます。どの線も thickness を 20 に設定して描画されていますが、miterLimit はそれぞれ 1、2、4 に設定されています。重ね合わされた黒の基準線は、接合点を示しています。

miterLimit が 1、2、および 4 に設定されている線

miterLimit のそれぞれの値には、マイターが切り取られる独自の最大角度があります。次の表に、いくつかの例を示します。

miterLimit の値:角度が以下より小さい場合は切り取られる
1.41490 度
260 度
430 度
815 度

関連する API エレメント



この例の使用方法
lineTo() または moveTo() メソッドの例を参照して、getStyle() メソッドの使用方法を確認してください。

lineTo

()メソッド 
public function lineTo(x:Number, y:Number):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

現在の描画位置から (x, y) まで、現在の線のスタイルを使用して線を描画します。その後で、現在の描画位置は (x , y) に設定されます。描画先の表示オブジェクトに Flash の描画ツールで作成したコンテンツが含まれている場合、lineTo() メソッドへの呼び出しの結果はこのコンテンツの下に描画されます。lineTo() を呼び出してから moveTo() メソッドを呼び出すと、現在の描画位置はデフォルトで (0,0) になります。いずれかのパラメーターを省略すると、このメソッドは失敗し、現在の描画位置は変更されません。

パラメーター

x:Number — 親表示オブジェクトの基準点からの相対的な水平座標を示す数値(ピクセル単位)。
 
y:Number — 親表示オブジェクトの基準点からの相対的な垂直座標を示す数値(ピクセル単位)。


例  ( この例の使用方法 )

次の例では、lineTo() メソッドを使用して、ピクセル (100, 100) で始まる台形を描画します。

線の太さが 10 ピクセル、色が金色で不透明、線の先端のキャップがなし(すべての線が結合されるため)に設定され、線の継ぎ目はマイター限度が 10、尖った鋭角の MITER に設定されます。

package {
    import flash.display.Sprite;
    import flash.display.LineScaleMode;
    import flash.display.CapsStyle;
    import flash.display.JointStyle;
    import flash.display.Shape;


    public class Graphics_lineToExample extends Sprite {

        public function Graphics_lineToExample() {

            var trapezoid:Shape = new Shape();    

            trapezoid.graphics.lineStyle(10, 0xFFD700, 1, false, LineScaleMode.VERTICAL,
                               CapsStyle.NONE, JointStyle.MITER, 10);

            trapezoid.graphics.moveTo(100, 100);
 
            trapezoid.graphics.lineTo(120, 50);
            trapezoid.graphics.lineTo(200, 50);
            trapezoid.graphics.lineTo(220, 100);
            trapezoid.graphics.lineTo(100, 100); 

            this.addChild(trapezoid);
        }
    }
}

moveTo

()メソッド 
public function moveTo(x:Number, y:Number):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9, Flash Lite 4

現在の描画位置を (x, y) に移動します。いずれかのパラメーターを省略すると、このメソッドは失敗し、現在の描画位置は変更されません。

パラメーター

x:Number — 親表示オブジェクトの基準点からの相対的な水平座標を示す数値(ピクセル単位)。
 
y:Number — 親表示オブジェクトの基準点からの相対的な垂直座標を示す数値(ピクセル単位)。


例  ( この例の使用方法 )

次の例では、moveTo() メソッドおよび lineTo() メソッドを使用して、3 ピクセルの太さの破線を描画します。

lineStyle() メソッドを使用して、線の太さが 3 ピクセルに設定されます。また、拡大 / 縮小しないよう設定されます。透明度が 25% の赤に色が設定されます。CapsStyle プロパティは四角形に設定されます(デフォルトは円形)。

Graphics_moveToExampleSprite クラスのインスタンスであるため、すべての Graphics クラスのメソッドへのアクセス権があります。Graphics クラスのメソッドを使用して、Graphic_moveToExample Sprite オブジェクト上に直接描画できます。ただし、Shape にベクター描画オブジェクトを配置しないと、管理、移動、または変更できる方法が制限されます。

package {
    import flash.display.Sprite;
    import flash.display.CapsStyle;
    import flash.display.LineScaleMode;

    public class Graphics_moveToExample extends Sprite
    {
        public function Graphics_moveToExample() {
            
            graphics.lineStyle(3, 0x990000, 0.25, false, 
                            LineScaleMode.NONE, CapsStyle.SQUARE);

            graphics.moveTo(10, 20);
            graphics.lineTo(20, 20);
            graphics.moveTo(30, 20);
            graphics.lineTo(50, 20);
            graphics.moveTo(60, 20);
            graphics.lineTo(80, 20);
            graphics.moveTo(90, 20);
            graphics.lineTo(110, 20);            
            graphics.moveTo(120, 20);
            graphics.lineTo(130, 20);           
        }
    }
}

readGraphicsData

()メソッド 
public function readGraphicsData(recurse:Boolean = true):Vector.<IGraphicsData>

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 11.6, AIR 3.6

Sprite または Shape オブジェクト(およびオプションでその子)のベクターグラフィックコンテンツを検索するクエリを実行します。この結果は IGraphicsData オブジェクトの Vector です。クエリの前に表示オブジェクトに対する変形が適用されるので、返されるパスはすべて同じ座標空間内にあります。結果データセット内の座標は、サンプリングされる表示オブジェクトではなくステージを基準とした座標です。

この結果には、以下の種類のオブジェクトが含まれており、それぞれ指定の制約が適用されます。

  • GraphicsSolidFill
  • GraphicsGradientFill
    • グラデーションの塗りに関するすべてのプロパティは readGraphicsData() によって返されます。
    • 返されるマトリックスは入力マトリックスに近いですが、全く同じではありません。
  • GraphicsEndFill
  • GraphicsBitmapFill
    • 返されるマトリックスは入力マトリックスに近いですが、全く同じではありません。
    • repeat は常に true です。
    • smooth は常に false です。
  • GraphicsStroke
    • thickness がサポートされます。
    • 前述の通り、fill では GraphicsSolidFill、GraphicsGradientFill および GraphicsBitmapFill がサポートされます。
    • その他のすべてのプロパティにはデフォルト値が設定されます。
  • GraphicsPath
    • MOVE_TO、CURVE_TO および LINE_TO コマンドのみがサポートされます。

以下のビジュアルエレメントおよび変形は表現できず、この結果には含まれません。

  • マスク
  • テキスト(ただし、「アニメーション向けアンチエイリアス」のアンチエイリアスタイプによって定義された静的テキストは除きます。このような静的テキストはベクターシェイプとしてレンダリングされるので、この結果に含まれます)。
  • シェーダー塗り
  • 混合モード
  • 9 スライスの拡大/縮小
  • 三角形(drawTriangles() メソッドで作成)
  • 不透明な背景
  • scrollrect 設定
  • 2.5D 変形
  • 非表示オブジェクト(visible プロパティが false のオブジェクト)

パラメーター

recurse:Boolean (default = true) — ランタイムで現在の表示オブジェクトの子の表示オブジェクトに対してもクエリを実行するかどうかを指定します。再帰的クエリの実行には時間がかかり、多くのメモリを消費する場合があります。この結果は、統合された 1 つの結果セットとして返されます(表示オブジェクトごとに区切られていません)。

戻り値
Vector.<IGraphicsData> — 関連する表示オブジェクトのベクターグラフィックコンテンツを表す IGraphicsData オブジェクトの Vector です。

関連する API エレメント


例  ( この例の使用方法 )

以下の例では、readGraphicsData() メソッドを使用して表示オブジェクトのベクターグラフィックコンテンツを取得します。さらに、ユーザーがマウスでステージをクリックしたときに、そのコンテンツを再描画して、ステージ上に別のオブジェクトを作成します。

元のベクターコンテンツは drawGraphicsData() メソッドを使用して描画していますが、readGraphicsData() メソッドによって取得されたベクターデータオブジェクトは、drawGraphicsData() メソッドに渡されたオブジェクトとは完全には一致しません。例えば、結果データには GraphicsSolidFill コマンドと GraphicsEndFill コマンドが含まれますが、この両方とも元のグラフィックデータにあることが示唆されていても実際には存在しません。

package
{
    import flash.display.GraphicsPathCommand;
    import flash.display.IGraphicsData;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    
    public class ReadGraphicsDataExample extends Sprite
    {
        private var original:Shape;
        private var copy:Shape;
        
        public function ReadGraphicsDataExample()
        {
            original = new Shape();
            original.x = 50;
            original.y = 100;
            addChild(original);
            
            drawSquare();
            
            copy = new Shape();
            copy.x = 250;
            copy.y = 100;
            addChild(copy);
            
            stage.addEventListener(MouseEvent.CLICK, drawCopyOnClick);
        }
        
        private function drawCopyOnClick(event:MouseEvent):void
        {
            // reset
            copy.graphics.clear();
            
            // Sample the vector data. Move the original to 0,0
            // before sampling so that the coordinates match the 
            // relative coordinates of the original.
            var xPos:Number = original.x;
            var yPos:Number = original.y;
            original.x = 0;
            original.y = 0;
            var result:Vector.<IGraphicsData> = original.graphics.readGraphicsData(false);
            original.x = xPos;
            original.y = yPos;
            
            // re-draw
            copy.graphics.drawGraphicsData(result);
        }
        
        private function drawSquare():void
        {
            var squareCommands:Vector.<int> = new Vector.<int>(5, true);
            
            squareCommands[0] = GraphicsPathCommand.MOVE_TO;
            squareCommands[1] = GraphicsPathCommand.LINE_TO;
            squareCommands[2] = GraphicsPathCommand.LINE_TO;
            squareCommands[3] = GraphicsPathCommand.LINE_TO;
            
            var squareCoordinates:Vector.<Number> = new Vector.<Number>(8, true);
            squareCoordinates[0] = 0;
            squareCoordinates[1] = 0; 
            squareCoordinates[2] = 50; 
            squareCoordinates[3] = 0; 
            squareCoordinates[4] = 50; 
            squareCoordinates[5] = 50; 
            squareCoordinates[6] = 0; 
            squareCoordinates[7] = 50; 
            
            original.graphics.beginFill(0x003366);
            original.graphics.drawPath(squareCommands, squareCoordinates);
        }
    }
}
GraphicsExample.as

次の例では、GraphicsExample クラスを使用して、円、角丸矩形、および四角形を描画します。これを行うには、以下の手順を実行します。
  1. 後で各シェイプのサイズを決定する際に使用する size プロパティを宣言します。
  2. 背景色をオレンジ色、境界線色を濃い灰色、境界線のサイズを 0 ピクセル、角丸の半径を 9 ピクセル、ステージの端と他のオブジェクトの間のスペースを 5 ピクセルに、それぞれ設定するプロパティを宣言します。
  3. 上記の手順で宣言したプロパティを Graphics クラスのビルトインメソッドと共に使用して、円、角丸矩形、および四角形を、座標 x = 0、y = 0 に描画します。
  4. ステージの一番上に配置された各シェイプを、x = 5、y = 5 から、シェイプ間のスペースを 5 ピクセルにして再描画します。
package {
    import flash.display.DisplayObject;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;

    public class GraphicsExample extends Sprite {
        private var size:uint         = 80;
        private var bgColor:uint      = 0xFFCC00;
        private var borderColor:uint  = 0x666666;
        private var borderSize:uint   = 0;
        private var cornerRadius:uint = 9;
        private var gutter:uint       = 5;

        public function GraphicsExample() {
            doDrawCircle();
            doDrawRoundRect();
            doDrawRect();
            refreshLayout();
        }

        private function refreshLayout():void {
            var ln:uint = numChildren;
            var child:DisplayObject;
            var lastChild:DisplayObject = getChildAt(0);
            lastChild.x = gutter;
            lastChild.y = gutter;
            for (var i:uint = 1; i < ln; i++) {
                child = getChildAt(i);
                child.x = gutter + lastChild.x + lastChild.width;
                child.y = gutter;
                lastChild = child;
            }
        }

        private function doDrawCircle():void {
            var child:Shape = new Shape();
            var halfSize:uint = Math.round(size / 2);
            child.graphics.beginFill(bgColor);
            child.graphics.lineStyle(borderSize, borderColor);
            child.graphics.drawCircle(halfSize, halfSize, halfSize);
            child.graphics.endFill();
            addChild(child);
        }

        private function doDrawRoundRect():void {
            var child:Shape = new Shape();
            child.graphics.beginFill(bgColor);
            child.graphics.lineStyle(borderSize, borderColor);
            child.graphics.drawRoundRect(0, 0, size, size, cornerRadius);
            child.graphics.endFill();
            addChild(child);
        }

        private function doDrawRect():void {
            var child:Shape = new Shape();
            child.graphics.beginFill(bgColor);
            child.graphics.lineStyle(borderSize, borderColor);
            child.graphics.drawRect(0, 0, size, size);
            child.graphics.endFill();
            addChild(child);
        }
    }
}




[ X ]英語で表示される理由
ActionScript 3.0 リファレンスガイドのコンテンツが英語で表示されます。

ActionScript 3.0 リファレンスガイドのすべての部分がすべての言語に翻訳されているわけではありません。言語エレメントが翻訳されていない場合、そのエレメントは英語で表示されます。例えば、ga.controls.HelpBox クラスはどの言語にも訳されていません。このため、リファレンスガイドの日本語バージョンでは、ga.controls.HelpBox クラスは英語で表示されます。