public class PgTexture extends PsObject
Repetition of texture image within the texture domain is possible in two ways: either texture coordinates of a geometry are scaled to rectangles [0,m]*[0,n], or alternatively by setting the repetition factors to m and n.
PgPointSet
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
BLEND_MATERIAL
Deprecated.
since 3.96.022, use same instance variables of PgGeometryIf instead.
|
static int |
BLEND_REPLACE
Deprecated.
since 3.96.022, use same instance variables of PgGeometryIf instead.
|
static int |
FILTER_DIRECT
Deprecated.
since 3.96.022, use same instance variables of PgGeometryIf instead.
|
static int |
FILTER_LINEAR
Deprecated.
since 3.96.022, use same instance variables of PgGeometryIf instead.
|
static int |
FILTER_QUADRATIC
Deprecated.
since 3.96.022, use same instance variables of PgGeometryIf instead.
|
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
Constructor and Description |
---|
PgTexture() |
Modifier and Type | Method and Description |
---|---|
boolean |
blend(double s,
PgTexture a,
double t,
PgTexture b)
Blend between two texture objects using
this = s*ag + t*bg . |
java.lang.Object |
clone()
Duplicate texture by recursively cloning all instance variables
except inspector panels and lists of registered listeners.
|
void |
copy(PgTexture tex)
Copy base instance variables and prepend "Copy of" to name
if identical to original object name.
|
int |
getBlendingMode()
Get mode how texture color is applied to surface.
|
int |
getFilterType()
Get mode how texture image is sampled to compute color of pixel.
|
int |
getHeight()
Get height of used region in texture image.
|
int |
getHeightTiling()
Get number of repetitions of texture image along height.
|
java.awt.Image |
getImage()
Get image of texture.
|
java.lang.String |
getImageName()
Get file name of texture image.
|
int |
getPeriodic()
Get type of periodic extension of texture outside the unit texture square.
|
PdVector[] |
getTextureImageBnd()
Get bounds of texture image in normalized texture coordinates.
|
int |
getTextureSide()
Determines whether texture is shown on front, back or both sides of a surface, if texture is shown at all.
|
java.awt.Dimension |
getTiling()
Get number of repetitions of texture image in both directions.
|
int |
getUMax()
Get upper width of used region in texture image.
|
int |
getUMin()
Get lower width value of used region in texture image.
|
int |
getVMax()
Get upper height of used region in texture image.
|
int |
getVMin()
Get lower height value of used region in texture image.
|
int |
getWidth()
Get width of used region in texture image.
|
int |
getWidthTiling()
Get number of repetitions of texture image along width.
|
void |
init()
If instance has missing name then assign default name 'Object_NUMBER' where
number is the total number of already created instances.
|
boolean |
isEnabledMove()
Get mode if size sliders are either used to resize the used sector of the texture
image or to move the shown sector over the image.
|
java.awt.Image |
loadImage()
Load image whose name was previously assigned to this class.
|
java.awt.Image |
loadImage(java.awt.Component comp)
Load image whose name was previously assigned to this class.
|
void |
setBlendingMode(int blendingMode)
Set mode how texture color is applied to surface.
|
void |
setEnabledMove(boolean flag)
Set mode that size sliders are either used to resize the used sector of the texture
image or to move the shown sector over the image.
|
void |
setFilterType(int filterType)
Set mode how texture image is sampled to compute color of pixel.
|
void |
setImage(java.awt.Image image)
Set image of texture.
|
void |
setImage(java.lang.String name)
Deprecated.
use #setImageName(String) instead.
|
void |
setImageName(java.lang.String name)
Set file name of texture image including relative or full path or full url.
|
void |
setPeriodic(int periodic)
Set number of repetitions of texture image in both directions.
|
void |
setTextureImageBnd(PdVector[] bnd)
Set bounds of texture image in normalized texture coordinates.
|
void |
setTextureSide(int side)
Set flag whether texture is shown on front, back or both sides of a surface, if texture is shown at all.
|
void |
setTiling(java.awt.Dimension repeat)
Set number of repetitions of texture image in both directions.
|
void |
setTiling(int width,
int height)
Set number of repetitions of texture image in both directions.
|
void |
setUMax(int value)
Set upper width of used region in texture image.
|
void |
setUMin(int value)
Set lower width value of used region in texture image.
|
void |
setVMax(int value)
Set upper height of used region in texture image.
|
void |
setVMin(int value)
Set lower height value of used region in texture image.
|
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
public static final int FILTER_DIRECT
public static final int FILTER_LINEAR
public static final int FILTER_QUADRATIC
public static final int BLEND_REPLACE
public static final int BLEND_MATERIAL
public void init()
PsObject
public java.lang.Object clone()
Link to image is copied. Image is not cloned and not nulled since class Image has no clone() method.
clone
in class PsObject
PsObject.copy(PsObject)
public void copy(PgTexture tex)
clone()
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PsObject
event
- carries a lot of informationPsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public java.lang.String getImageName()
public void setImageName(java.lang.String name)
name
- name of image file including a relative path.public void setImage(java.lang.String name)
public java.awt.Image getImage()
public void setImage(java.awt.Image image)
public PdVector[] getTextureImageBnd()
public void setTextureImageBnd(PdVector[] bnd)
bnd
- array with bounds of image.public int getUMin()
public void setUMin(int value)
value
- in pixel coordinatespublic int getVMin()
public void setVMin(int value)
value
- in pixel coordinatespublic int getUMax()
public void setUMax(int value)
value
- in pixel coordinatespublic int getVMax()
public void setVMax(int value)
value
- in pixel coordinatespublic int getWidth()
public int getHeight()
public java.awt.Image loadImage()
Method is a convenience and simply calls
loadImage(PsConfig.getFrame())
.
null
if failure.public java.awt.Image loadImage(java.awt.Component comp)
comp
- component to draw image on.null
if failure.public int getPeriodic()
public void setPeriodic(int periodic)
periodic
- Type of periodic extension such as m_periodic.public java.awt.Dimension getTiling()
public void setTiling(java.awt.Dimension repeat)
repeat
- Number of repetitions of texture image in both directions.public void setTiling(int width, int height)
width
- Number of repetitions of texture image along width.height
- Number of repetitions of texture image along height.public int getWidthTiling()
public int getHeightTiling()
public int getFilterType()
public void setFilterType(int filterType)
filterType
- Filter type such as PgGeometryIf.FILTER_DIRECT, PgGeometryIf.FILTER_QUADRATIC ...public int getBlendingMode()
public void setBlendingMode(int blendingMode)
blendingMode
- Blending type such as PgGeometryIf.BLEND_REPLACE, PgGeometryIf.BLEND_MATERIAL ...public int getTextureSide()
public void setTextureSide(int side)
public boolean isEnabledMove()
public void setEnabledMove(boolean flag)
flag
- Determines if size sliders are used to move rather than rescale image.public boolean blend(double s, PgTexture a, double t, PgTexture b)
this = s*ag + t*bg
.
Image class is neither blended nor assigned, instead pixel values are blended.
Images of both textures must have same dimensions. Otherwise an error is encountered and method returns.
s
- weight of first texturea
- first texture used for blendingt
- weight of second textureb
- second texture used for blending"