class Texture |
Parent: Entity |
|
Methods:average_color, filename, height, image_height, image_width, size=, valid?, width |
|
Sample Code: texturetests.rb |
|
Instance Methods |
average_color |
The average_color method retrieves a color object with the average color found in the texture. |
Syntax: |
color = texture.average_color |
Arguments: |
|
Return Value: |
color – a color object (if successful), nil if unsuccessful. |
Comments: |
|
Example: |
model = Sketchup.active_model # Adds a material to the “in-use” material
browser tab begin texture = m.texture if (color) |
filename |
The filename method retrieves the entire path, including the file, for a texture object. |
Syntax: |
filename = texture.filename |
Arguments: |
|
Return Value: |
filename – a string representation of the path and filename used for the texture. |
Comments: |
|
Example: |
model = Sketchup.active_model # Adds a material to the “in-use” material
browser tab begin texture = m.texture if (filename) |
height |
The height method is used to get the height of a repeatable texture image, in inches. |
Syntax: |
height = texture.height |
Arguments: |
|
Return Value: |
height – the height, in inches, of the texture pattern |
Comments: |
|
Example: |
model = Sketchup.active_model # Adds a material to the “in-use” material
browser tab begin texture = m.texture if (height) |
image_height |
The image_height method retrieves the height of the repeatable texture image, in pixels. |
Syntax: |
imageheight = texture.image_height |
Arguments: |
|
Return Value: |
imageheight – the height, in pixels, of the texture pattern |
Comments: |
|
Example: |
imageheight = texture.height if (imageheight) |
image_width |
The image_width method retrieves the width of the repeatable texture image, in pixels. |
Syntax: |
imagewidth = texture.image_width |
Arguments: |
|
Return Value: |
imagewidth – the width, in pixels, of the texture pattern |
Comments: |
|
Example: |
imagewidth = texture.width if (imagewidth) |
size= |
The size= method allows you to set the size of the repeatable texture image, in inches |
Syntax: |
size = texture.size=size |
Arguments: |
size – the size, in inches, of the texture. This number will apply to height and width to keep aspect ratio. |
Return Value: |
size – the size, in inches, of the texture. This number will apply to height and width to keep aspect ratio. |
Comments: |
|
Example: |
size = texture.size=60 if (size) |
valid? |
The valid? method ensures that a texture is valid. |
Syntax: |
status = texture.valid? |
Arguments: |
|
Return Value: |
status – true if valid, false if invalid. |
Comments: |
|
Example: |
status = texture.valid? if (valid) |
width |
The width method is used to get the width of a repeatable texture image, in inches. |
Syntax: |
width = texture.width |
Arguments: |
|
Return Value: |
width – the width, in inches, of the texture pattern |
Comments: |
|
Example: |
model = Sketchup.active_model # Adds a material to the “in-use” material
browser tab begin texture = m.texture if (width) |