Interface ITexture

All Superinterfaces:
IDestroyable, IMaskerable
All Known Implementing Classes:
AngelCodeFont.CharDefTexture, CharacterSmartTexture, ItemSmartTexture, SmartTexture, Texture

public interface ITexture extends IDestroyable, IMaskerable
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bind the current texture in the VRAM
    void
    bind(int unit)
    bind the current texture object in the specified texture unit
    returns the texture's pixel in a ByteBuffer EXAMPLE:
    ByteBuffer bb = getData();
    byte r, g, b;
    bb.rewind(); //<-- IMPORTANT!!
    try {
    while (true) {
    bb.mark();
    r = bb.get();
    g = bb.get();
    b = bb.get();
    bb.reset();
    bb.put((byte)(r+red));
    bb.put((byte)(g+green));
    bb.put((byte)(b+blue));
    bb.get(); // alpha
    }
    } catch (Exception e) {
    }
    setData(bb);
    int
    returns the height of image
    int
    return the height hardware of image
    int
    returns the ID of image in the Vram
    int
    returns the width of image
    int
    return the width Hardware of image
    float
    returns the end X-coordinate
    float
    returns the start X-coordinate
    float
    returns the end Y-coordinate
    float
    returns the start Y-coordinate
    boolean
    indicates if the texture is solid or not.
    a non solid texture is a texture that containe an alpha channel
    void
    makeTransp(int red, int green, int blue)
    sets transparent each pixel that it's equal to the red, green blue value specified
    void
    setAlphaForeach(int red, int green, int blue, int alpha)
    sets the specified alpha for each pixel that it's equal to the red, green blue value specified
    void
    sets the texture's pixel from a ByteBuffer EXAMPLE:
    ByteBuffer bb = getData();
    byte r, g, b;
    bb.rewind(); //<-- IMPORTANT!!
    try {
    while (true) {
    bb.mark();
    r = bb.get();
    g = bb.get();
    b = bb.get();
    bb.reset();
    bb.put((byte)(r+red));
    bb.put((byte)(g+green));
    bb.put((byte)(b+blue));
    bb.get(); // alpha
    }
    } catch (Exception e) {
    }
    setData(bb);
    void
    setMask(Mask mask)
    Pixel collision mask of texture
    void
    setRegion(int x, int y, int width, int height)
    sets the region of the image

    Methods inherited from interface zombie.interfaces.IDestroyable

    destroy, isDestroyed

    Methods inherited from interface zombie.interfaces.IMaskerable

    getMask
  • Method Details

    • bind

      void bind()
      bind the current texture in the VRAM
    • bind

      void bind(int unit)
      bind the current texture object in the specified texture unit
      Parameters:
      unit - the texture unit in witch the current TextureObject will be binded
    • getData

      WrappedBuffer getData()
      returns the texture's pixel in a ByteBuffer EXAMPLE:
      ByteBuffer bb = getData();
      byte r, g, b;
      bb.rewind(); //<-- IMPORTANT!!
      try {
      while (true) {
      bb.mark();
      r = bb.get();
      g = bb.get();
      b = bb.get();
      bb.reset();
      bb.put((byte)(r+red));
      bb.put((byte)(g+green));
      bb.put((byte)(b+blue));
      bb.get(); // alpha
      }
      } catch (Exception e) {
      }
      setData(bb);
    • getHeight

      int getHeight()
      returns the height of image
      Returns:
      the height of image
    • getHeightHW

      int getHeightHW()
      return the height hardware of image
      Returns:
    • getID

      int getID()
      returns the ID of image in the Vram
      Returns:
      the ID of image in the Vram
    • getWidth

      int getWidth()
      returns the width of image
      Returns:
      the width of image
    • getWidthHW

      int getWidthHW()
      return the width Hardware of image
      Returns:
    • getXEnd

      float getXEnd()
      returns the end X-coordinate
      Returns:
      the end X-coordinate
    • getXStart

      float getXStart()
      returns the start X-coordinate
      Returns:
      the start X-coordinate
    • getYEnd

      float getYEnd()
      returns the end Y-coordinate
      Returns:
      the end Y-coordinate
    • getYStart

      float getYStart()
      returns the start Y-coordinate
      Returns:
      the start Y-coordinate
    • isSolid

      boolean isSolid()
      indicates if the texture is solid or not.
      a non solid texture is a texture that containe an alpha channel
      Returns:
      if the texture is solid or not.
    • makeTransp

      void makeTransp(int red, int green, int blue)
      sets transparent each pixel that it's equal to the red, green blue value specified
      Parameters:
      red - color used in the test
      green - color used in the test
      blue - color used in the test
    • setAlphaForeach

      void setAlphaForeach(int red, int green, int blue, int alpha)
      sets the specified alpha for each pixel that it's equal to the red, green blue value specified
      Parameters:
      red - color used in the test
      green - color used in the test
      blue - color used in the test
      alpha - the alpha color that will be setted to the pixel that pass the test
    • setData

      void setData(ByteBuffer data)
      sets the texture's pixel from a ByteBuffer EXAMPLE:
      ByteBuffer bb = getData();
      byte r, g, b;
      bb.rewind(); //<-- IMPORTANT!!
      try {
      while (true) {
      bb.mark();
      r = bb.get();
      g = bb.get();
      b = bb.get();
      bb.reset();
      bb.put((byte)(r+red));
      bb.put((byte)(g+green));
      bb.put((byte)(b+blue));
      bb.get(); // alpha
      }
      } catch (Exception e) {
      }
      setData(bb);
      Parameters:
      data - texture's pixel data
    • setMask

      void setMask(Mask mask)
      Pixel collision mask of texture
      Parameters:
      mask -
    • setRegion

      void setRegion(int x, int y, int width, int height)
      sets the region of the image
      Parameters:
      x - xstart position
      y - ystart position
      width - width of the region
      height - height of the region