JavaView© v3.95.000

jv.geom
Class PgTexture

java.lang.Object
  extended byjv.object.PsObject
      extended byjv.geom.PgTexture
All Implemented Interfaces:
java.lang.Cloneable, PsUpdateIf, java.io.Serializable

public class PgTexture
extends PsObject

Texture image associated to a geometry. The geometry must supply texture coordinates in [0,1]*[0,1], either at vertices or for elements.

See Also:
PgPointSet, Serialized Form

Field Summary
static int BLEND_MATERIAL
          Blends the surface color with texture color depending on texture alpha.
static int BLEND_REPLACE
          Replace surface color with texture color.
static int FILTER_DIRECT
          No filtering, for each pixel the texture image is sampled at a single point.
static int FILTER_LINEAR
          Bilinear filtering, for each pixel the texture image is sampled at a four points.
static int FILTER_QUADRATIC
          Biquadratic filtering, for each pixel the texture image is sampled at a nine points.
 
Fields inherited from class jv.object.PsObject
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 Summary
PgTexture()
           
 
Method Summary
 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.
 java.awt.Image getImage()
          Get image of texture.
 java.lang.String getImageName()
          Get file name of texture image.
 PdVector[] getTextureImageBnd()
          Get bounds of texture image in normalized texture coordinates.
 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.
 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 setTextureImageBnd(PdVector[] bnd)
          Set bounds of texture image in normalized texture coordinates.
 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.
 
Methods inherited from class jv.object.PsObject
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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILTER_DIRECT

public static final int FILTER_DIRECT
No filtering, for each pixel the texture image is sampled at a single point.

See Also:
Constant Field Values

FILTER_LINEAR

public static final int FILTER_LINEAR
Bilinear filtering, for each pixel the texture image is sampled at a four points.

See Also:
Constant Field Values

FILTER_QUADRATIC

public static final int FILTER_QUADRATIC
Biquadratic filtering, for each pixel the texture image is sampled at a nine points.

See Also:
Constant Field Values

BLEND_REPLACE

public static final int BLEND_REPLACE
Replace surface color with texture color.

See Also:
Constant Field Values

BLEND_MATERIAL

public static final int BLEND_MATERIAL
Blends the surface color with texture color depending on texture alpha.

See Also:
Constant Field Values
Constructor Detail

PgTexture

public PgTexture()
Method Detail

init

public void init()
Description copied from class: PsObject
If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.

Overrides:
init in class PsObject

clone

public java.lang.Object clone()
Duplicate texture by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes.

Link to image is copied. Image is not cloned and not nulled since class Image has no clone() method.

Overrides:
clone in class PsObject
See Also:
PsObject.copy(PsObject)

copy

public void copy(PgTexture tex)
Copy base instance variables and prepend "Copy of" to name if identical to original object name. In general, only geometry data is copied, no material properties and no external links.

See Also:
clone()

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PsObject
See Also:
PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(PsUpdateIf)

getImageName

public java.lang.String getImageName()
Get file name of texture image.


setImageName

public void setImageName(java.lang.String name)
Set file name of texture image including relative or full path or full url.

Parameters:
name - name of image file including a relative path.

setImage

public void setImage(java.lang.String name)
Deprecated. use #setImageName(String) instead.

Set file name of texture image including relative or full path or full url.


getImage

public java.awt.Image getImage()
Get image of texture.


setImage

public void setImage(java.awt.Image image)
Set image of texture. The cropping values are adjusted to cover the full image.


getTextureImageBnd

public PdVector[] getTextureImageBnd()
Get bounds of texture image in normalized texture coordinates.

Returns:
array of length two with position of lower left and upper right position of image.
Since:
JavaView 2.86.000

setTextureImageBnd

public void setTextureImageBnd(PdVector[] bnd)
Set bounds of texture image in normalized texture coordinates. Bounds are given by two vectors with the position of lower left and upper right corner of the texture image in normalized texture coordinates. The dimension of each vector must be equal to the dimension of the texture. For a two-dimensional texture the default is {(0,0),(1,1)}.

Parameters:
bnd - array with bounds of image.
Since:
JavaView 2.86.000

getUMin

public int getUMin()
Get lower width value of used region in texture image.

Returns:
value in pixel coordinates

setUMin

public void setUMin(int value)
Set lower width value of used region in texture image.

Parameters:
value - in pixel coordinates

getVMin

public int getVMin()
Get lower height value of used region in texture image.

Returns:
value in pixel coordinates

setVMin

public void setVMin(int value)
Set lower height value of used region in texture image.

Parameters:
value - in pixel coordinates

getUMax

public int getUMax()
Get upper width of used region in texture image.

Returns:
value in pixel coordinates

setUMax

public void setUMax(int value)
Set upper width of used region in texture image.

Parameters:
value - in pixel coordinates

getVMax

public int getVMax()
Get upper height of used region in texture image.

Returns:
value in pixel coordinates

setVMax

public void setVMax(int value)
Set upper height of used region in texture image.

Parameters:
value - in pixel coordinates

getWidth

public int getWidth()
Get width of used region in texture image.

Returns:
value in pixel coordinates

getHeight

public int getHeight()
Get height of used region in texture image.

Returns:
value in pixel coordinates

loadImage

public java.awt.Image loadImage()
Load image whose name was previously assigned to this class. The loaded image will become the image of this texture.

Method is a convenience and simply calls loadImage(PsConfig.getFrame()).

Returns:
the loaded image, or null if failure.

loadImage

public java.awt.Image loadImage(java.awt.Component comp)
Load image whose name was previously assigned to this class. The loaded image will become the image of this texture.

Parameters:
comp - component to draw image on.
Returns:
the loaded image, or null if failure.

getFilterType

public int getFilterType()
Get mode how texture image is sampled to compute color of pixel.

Returns:
filter type such as FILTER_DIRECT, FILTER_QUADRATIC ...

setFilterType

public void setFilterType(int filterType)
Set mode how texture image is sampled to compute color of pixel.

Parameters:
filterType - filter type such as FILTER_DIRECT, FILTER_QUADRATIC ...

getBlendingMode

public int getBlendingMode()
Get mode how texture color is applied to surface.

Returns:
blending type such as BLEND_REPLACE, BLEND_MATERIAL ...

setBlendingMode

public void setBlendingMode(int blendingMode)
Set mode how texture color is applied to surface.

Parameters:
blendingMode - blending type such as BLEND_REPLACE, BLEND_MATERIAL ...

isEnabledMove

public 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.

Returns:
determines if size sliders are used to move rather than rescale image.

setEnabledMove

public 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.

Parameters:
flag - determines if size sliders are used to move rather than rescale image.

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.