當前位置: 首頁>>代碼示例>>Java>>正文


Java IndexColorModel.getRed方法代碼示例

本文整理匯總了Java中java.awt.image.IndexColorModel.getRed方法的典型用法代碼示例。如果您正苦於以下問題:Java IndexColorModel.getRed方法的具體用法?Java IndexColorModel.getRed怎麽用?Java IndexColorModel.getRed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.image.IndexColorModel的用法示例。


在下文中一共展示了IndexColorModel.getRed方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import java.awt.image.IndexColorModel; //導入方法依賴的package包/類
public static void main(String args[]) {
    IndexColorModel cm =
            new IndexColorModel(8, 1, new byte[]{(byte) 128}, new byte[]{(byte) 128}, new byte[]{(byte) 128});
    cm.getTransparency();
    cm.getComponentSize();
    cm.isAlphaPremultiplied();
    cm.hasAlpha();
    cm.isAlphaPremultiplied();
    cm.getTransferType();
    cm.getPixelSize();
    cm.getComponentSize();
    cm.getNumComponents();
    cm.getNumColorComponents();
    cm.getRed(20);
    cm.getGreen(20);
    cm.getBlue(20);
    cm.getAlpha(20);
    cm.getRGB(20);
    cm.isAlphaPremultiplied();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:HeadlessIndexColorModel.java

示例2: loadTexture

import java.awt.image.IndexColorModel; //導入方法依賴的package包/類
private void loadTexture(int js, int jt) {
  int ks = js*(_ls-1);
  int kt = jt*(_lt-1);
  int ls = min(_ls,_ns-ks);
  int lt = min(_lt,_nt-kt);
  if (_axis==Axis.X) {
    _f.get12(lt,ls,kt,ks,_kxmin,_floats);
  } else if (_axis==Axis.Y) {
    _f.get13(lt,ls,kt,_kymin,ks,_floats);
  } else if (_axis==Axis.Z) {
    _f.get23(lt,ls,_kzmin,kt,ks,_floats);
  }
  float fscale = 255.0f/(_clipMax-_clipMin);
  float fshift = _clipMin;
  IndexColorModel icm = _colorMap.getColorModel();
  for (int is=0; is<ls; ++is) {
    for (int it=0; it<lt; ++it) {
      float fi = (_floats[is][it]-fshift)*fscale;
      if (fi<0.0f)
        fi = 0.0f;
      if (fi>255.0f)
        fi = 255.0f;
      int i = (int)(fi+0.5f);
      int r = icm.getRed(i);
      int g = icm.getGreen(i);
      int b = icm.getBlue(i);
      int a = icm.getAlpha(i);
      int p = (r&0xff)|((g&0xff)<<8)|((b&0xff)<<16)|((a&0xff)<<24);
      _pixels.put(is+it*_ls,p);
    }
  }
  glPixelStorei(GL_UNPACK_ALIGNMENT,1);
  GlTextureName tn = _tn[jt][js];
  glBindTexture(GL_TEXTURE_2D,tn.name());
  glTexSubImage2D(
    GL_TEXTURE_2D,0,0,0,_ls,_lt,GL_RGBA,GL_UNSIGNED_BYTE,_pixels);
  glBindTexture(GL_TEXTURE_2D,0);
}
 
開發者ID:MinesJTK,項目名稱:jtk,代碼行數:39,代碼來源:ImagePanel.java

示例3: drawDIBImage

import java.awt.image.IndexColorModel; //導入方法依賴的package包/類
protected void drawDIBImage(byte[] image,
                            float destX, float destY,
                            float destWidth, float destHeight,
                            float srcX, float srcY,
                            float srcWidth, float srcHeight,
                            int sampleBitsPerPixel,
                            IndexColorModel icm) {
    int bitCount = 24;
    byte[] bmiColors = null;

    if (icm != null) {
        bitCount = sampleBitsPerPixel;
        bmiColors = new byte[(1<<icm.getPixelSize())*4];
        for (int i=0;i<icm.getMapSize(); i++) {
            bmiColors[i*4+0]=(byte)(icm.getBlue(i)&0xff);
            bmiColors[i*4+1]=(byte)(icm.getGreen(i)&0xff);
            bmiColors[i*4+2]=(byte)(icm.getRed(i)&0xff);
        }
    }

    drawDIBImage(getPrintDC(), image,
                 destX, destY,
                 destWidth, destHeight,
                 srcX, srcY,
                 srcWidth, srcHeight,
                 bitCount, bmiColors);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:28,代碼來源:WPrinterJob.java


注:本文中的java.awt.image.IndexColorModel.getRed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。