1 /* 2 * License Applicability. Except to the extent portions of this file are 3 * made subject to an alternative license as permitted in the SGI Free 4 * Software License B, Version 2.0 (the "License"), the contents of this 5 * file are subject only to the provisions of the License. You may not use 6 * this file except in compliance with the License. You may obtain a copy 7 * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 8 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: 9 * 10 * http://oss.sgi.com/projects/FreeB 11 * 12 * Note that, as provided in the License, the Software is distributed on an 13 * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS 14 * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND 15 * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A 16 * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. 17 * 18 * NOTE: The Original Code (as defined below) has been licensed to Sun 19 * Microsystems, Inc. ("Sun") under the SGI Free Software License B 20 * (Version 1.1), shown above ("SGI License"). Pursuant to Section 21 * 3.2(3) of the SGI License, Sun is distributing the Covered Code to 22 * you under an alternative license ("Alternative License"). This 23 * Alternative License includes all of the provisions of the SGI License 24 * except that Section 2.2 and 11 are omitted. Any differences between 25 * the Alternative License and the SGI License are offered solely by Sun 26 * and not by SGI. 27 * 28 * Original Code. The Original Code is: OpenGL Sample Implementation, 29 * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, 30 * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. 31 * Copyright in any portions created by third parties is as indicated 32 * elsewhere herein. All Rights Reserved. 33 * 34 * Additional Notice Provisions: The application programming interfaces 35 * established by SGI in conjunction with the Original Code are The 36 * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released 37 * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version 38 * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X 39 * Window System(R) (Version 1.3), released October 19, 1998. This software 40 * was created using the OpenGL(R) version 1.2.1 Sample Implementation 41 * published by SGI, but has not been independently verified as being 42 * compliant with the OpenGL(R) version 1.2.1 Specification. 43 */ 44 45 package jogamp.opengl.glu.mipmap; 46 47 import java.nio.ByteBuffer; 48 49 /** 50 * 51 * @author Administrator 52 */ 53 public class ExtractUByte implements ExtractPrimitive { 54 55 /** Creates a new instance of ExtractUByte */ ExtractUByte()56 public ExtractUByte() { 57 } 58 59 @Override extract( final boolean isSwap, final ByteBuffer ubyte )60 public double extract( final boolean isSwap, final ByteBuffer ubyte ) { 61 final int i = 0x000000FF & ubyte.get(); 62 assert( i <= 255 ); 63 return( i ); 64 } 65 66 @Override shove( final double value, final int index, final ByteBuffer data )67 public void shove( final double value, final int index, final ByteBuffer data ) { 68 assert(0.0 <= value && value < 256.0); 69 data.position( index ); 70 data.put( (byte)value ); 71 } 72 } 73