当前位置: 首页>>代码示例>>Java>>正文


Java TileMode.REPEAT属性代码示例

本文整理汇总了Java中android.graphics.Shader.TileMode.REPEAT属性的典型用法代码示例。如果您正苦于以下问题:Java TileMode.REPEAT属性的具体用法?Java TileMode.REPEAT怎么用?Java TileMode.REPEAT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.graphics.Shader.TileMode的用法示例。


在下文中一共展示了TileMode.REPEAT属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LinearGradientView

public LinearGradientView(Context context) {
	super(context);
	// ��һ�ڶ���������ʾ������㣬���������ڶԽǵ�����λ�ã��������ĸ�������ʾ�����յ㣻�����������ʾ������ɫ��
	// ��������������Ϊ�գ���ʾ����ֵΪ0-1 new float[] {0.25f, 0.5f, 0.75f, 1 }  ���Ϊ�գ���ɫ���ȷֲ������ݶ��ߡ�
	mLinearGradient11 = new LinearGradient(0, 0, 0, 200, new int[] { Color.RED, Color.GREEN, Color.BLUE, Color.BLACK }, null, TileMode.CLAMP);
	mLinearGradient12 = new LinearGradient(0, 0, 0, 300, new int[] { Color.RED, Color.GREEN, Color.BLUE, Color.BLACK }, new float[] { 0, 0.1f, 0.5f, 0.5f }, TileMode.CLAMP);
	mLinearGradient13 = new LinearGradient(0, 0, 0, 400, new int[] { Color.RED, Color.GREEN, Color.BLUE }, null, TileMode.CLAMP);

	mLinearGradient21 = new LinearGradient(0, 320, 0, 320 + 200, new int[] { Color.RED, Color.GREEN, Color.BLUE, Color.BLACK }, null, TileMode.MIRROR);
	mLinearGradient22 = new LinearGradient(0, 320, 0, 320 + 100, new int[] { Color.RED, Color.GREEN, Color.BLUE }, null, TileMode.MIRROR);
	mLinearGradient23 = new LinearGradient(0, 320, 0, 320 + 100, new int[] { Color.RED, Color.GREEN, Color.BLUE }, new float[] { 0, 0.1f, 0.5f }, TileMode.MIRROR);

	mLinearGradient31 = new LinearGradient(0, 640, 0, 640 + 200, new int[] { Color.RED, Color.GREEN, Color.BLUE, Color.BLACK }, null, TileMode.REPEAT);
	mLinearGradient32 = new LinearGradient(0, 640, 0, 640 + 100, new int[] { Color.RED, Color.GREEN, Color.BLUE }, null, TileMode.REPEAT);
	mLinearGradient33 = new LinearGradient(0, 640, 0, 640 + 100, new int[] { Color.RED, Color.GREEN, Color.BLUE }, new float[] { 0, 0.1f, 0.5f }, TileMode.REPEAT);
	mPaint = new Paint();
}
 
开发者ID:baiqiantao,项目名称:MyViews,代码行数:17,代码来源:LinearGradientView.java

示例2: getDefaultOuterRimPaint

/**
 * Set default outer rim paint
 *
 * @return paint
 *          Paint for outer rim
 */
private Paint getDefaultOuterRimPaint() {
	/** Linear gradient to create the 3D effect */
	final LinearGradient verticalGradient = new LinearGradient(mOuterRimRect.left, mOuterRimRect.top, mOuterRimRect.left,
			mOuterRimRect.bottom, Color.rgb(255, 255, 255), Color.rgb(84, 90, 100), TileMode.REPEAT);

	/** Bitmap for outer rim */
	final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.darkwood);
	/** Bitmap shader for the metallic style */
	final BitmapShader outerRimTile = new BitmapShader(bitmap, TileMode.REPEAT, TileMode.REPEAT);
	/** Matrix for outer rim */
	final Matrix matrix = new Matrix();
	matrix.setScale(1.0f / bitmap.getWidth(), 1.0f / bitmap.getHeight());
	outerRimTile.setLocalMatrix(matrix);

	/** Paint for outer rim */
	final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
	paint.setShader(new ComposeShader(verticalGradient, outerRimTile, PorterDuff.Mode.MULTIPLY));
	paint.setFilterBitmap(true);
	return paint;
}
 
开发者ID:beegee-tokyo,项目名称:WeatherStation,代码行数:26,代码来源:GaugeView.java

示例3: getDefaultInnerRimPaint

/**
 * Set default inner rim paint
 *
 * @return paint
 *          Paint for inner rim
 */
private Paint getDefaultInnerRimPaint() {
	/** Linear gradient to create the 3D effect */
	final LinearGradient verticalGradient = new LinearGradient(mOuterRimRect.left, mOuterRimRect.top, mOuterRimRect.left,
			mOuterRimRect.bottom, Color.rgb(255, 255, 255), Color.rgb(84, 90, 100), TileMode.REPEAT);

	/** Bitmap for inner rim */
	final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.darkerwood);
	/** Bitmap shader for the metallic style */
	final BitmapShader innerRimTile = new BitmapShader(bitmap, TileMode.REPEAT, TileMode.REPEAT);
	/** Matrix for inner rim */
	final Matrix matrix = new Matrix();
	matrix.setScale(1.0f / bitmap.getWidth(), 1.0f / bitmap.getHeight());
	innerRimTile.setLocalMatrix(matrix);

	/** Paint for outer rim */
	final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
	paint.setShader(new ComposeShader(verticalGradient, innerRimTile, PorterDuff.Mode.MULTIPLY));
	paint.setFilterBitmap(true);
	return paint;
}
 
开发者ID:beegee-tokyo,项目名称:WeatherStation,代码行数:26,代码来源:GaugeView.java

示例4: loadSystemAreas

private void loadSystemAreas( Resources res )
{
  // Log.v( TopoDroidApp.TAG, "load system areas");
  if ( size() > 0 ) return;

  SymbolArea symbol = new SymbolArea( res.getString( R.string.tha_user ),  "u:user", "user", 0x67cccccc, null, TileMode.REPEAT, TileMode.REPEAT, false );
  symbol.mCsxLayer = 2;
  symbol.mCsxType  = 3;   
  symbol.mCsxCategory = 46;
  symbol.mCsxPen   = 1;
  symbol.mCsxBrush = 2;
  addSymbol( symbol );

  symbol = new SymbolArea( res.getString( R.string.tha_water ),  "water", "water", 0x663366ff, null, TileMode.REPEAT, TileMode.REPEAT, true );
  symbol.mCsxLayer = 2;
  symbol.mCsxType  = 3;   
  symbol.mCsxCategory = 46;
  symbol.mCsxPen   = 1;
  symbol.mCsxBrush = 2;
  addSymbol( symbol );
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:21,代码来源:SymbolAreaLibrary.java

示例5: getDefaultOuterRimPaint

public Paint getDefaultOuterRimPaint() {
    // Use a linear gradient to create the 3D effect
    final LinearGradient verticalGradient = new LinearGradient(mOuterRimRect.left, mOuterRimRect.top, mOuterRimRect.left,
            mOuterRimRect.bottom, Color.rgb(255, 255, 255), Color.rgb(84, 90, 100), TileMode.REPEAT);

    // Use a Bitmap shader for the metallic style
    final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.light_alu);
    final BitmapShader aluminiumTile = new BitmapShader(bitmap, TileMode.REPEAT, TileMode.REPEAT);
    final Matrix matrix = new Matrix();
    matrix.setScale(1.0f / bitmap.getWidth(), 1.0f / bitmap.getHeight());
    aluminiumTile.setLocalMatrix(matrix);

    final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setShader(new ComposeShader(verticalGradient, aluminiumTile, PorterDuff.Mode.MULTIPLY));
    paint.setFilterBitmap(true);
    return paint;
}
 
开发者ID:sygi1982,项目名称:bmw-dash,代码行数:17,代码来源:GaugeView.java

示例6: parseTileMode

private static TileMode parseTileMode(int tileMode) {
    switch (tileMode) {
        case 0:
            return TileMode.CLAMP;
        case 1:
            return TileMode.REPEAT;
        case 2:
            return TileMode.MIRROR;
        default:
            return null;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:RoundedImageView.java

示例7: ColorPickerView

public ColorPickerView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
		super(context, attrs, defStyleAttr);
//		if (DEBUG) Log.v(TAG, "ColorPickerView:");
		DENSITY = context.getResources().getDisplayMetrics().density;
		RECTANGLE_TRACKER_OFFSET = RECTANGLE_TRACKER_OFFSET_DP * DENSITY;
		SELECTED_RADIUS = DEFAULT_SELECTED_RADIUS * DENSITY;

		mAlphaShader = new BitmapShader(BitmapHelper.makeCheckBitmap(), TileMode.REPEAT, TileMode.REPEAT);
		mAlphaDrawable = new ShaderDrawable(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG, 0);
		mAlphaDrawable.setShader(mAlphaShader);

		radius = 0;
		internalSetColor(mColor, false);

		// 色相円用
		setHueColorArray(mAlpha, COLORS);
		mPaint.setShader(new SweepGradient(0, 0, COLORS, null));
		mPaint.setStyle(Paint.Style.FILL);
		mPaint.setStrokeWidth(0);

		// 選択色用
		mSelectionPaint.setColor(mColor);
		mSelectionPaint.setStrokeWidth(5);

		// スライダーのトラッカー表示用
		mTrackerPaint.setColor(TRACKER_COLOR);
		mTrackerPaint.setStyle(Paint.Style.STROKE);
		mTrackerPaint.setStrokeWidth(2f * DENSITY);
		mTrackerPaint.setAntiAlias(true);
	}
 
开发者ID:saki4510t,项目名称:libcommon,代码行数:30,代码来源:ColorPickerView.java

示例8: renderSeekBar

private void renderSeekBar(int type) {
	switch (type) {
	case SeekBarType.COLORFUL:
		int angleCount = 12;
		int[] colorful = new int[angleCount];
		float hsv[] = new float[] { 0f, 1f, 1f };
           for (int i = 0; i < angleCount; i++) {
               // 根据HSV色盘,旋转的角度取色
               hsv[0] = 360 - i * 30;
               colorful[i] = Color.HSVToColor(hsv);
           }
		LinearGradient colorfulLG = new LinearGradient(0, 0, getWidth(), getHeight(), colorful, null, TileMode.REPEAT);
		mBackgroundPaint.setShader(colorfulLG);
		break;

	case SeekBarType.WHITE:
		LinearGradient whiteLG = new LinearGradient(0, 0, getWidth(), getHeight(), new int[]{Color.HSVToColor(new float[]{49, 1, 96}), Color.WHITE}, null, TileMode.REPEAT);
		mBackgroundPaint.setShader(whiteLG);
		break;
		
	case SeekBarType.BRIGHT:
		LinearGradient brightLG = new LinearGradient(0, 0, getWidth(), getHeight(), new int[]{Color.BLACK, Color.WHITE}, null, TileMode.REPEAT);
		mBackgroundPaint.setShader(brightLG);
		break;
		
	default:
		
		break;
	}
}
 
开发者ID:iOnesmile,项目名称:MyAndroidDemo,代码行数:30,代码来源:ColorSeekBarView.java

示例9: createPattern

@Override
public Pattern createPattern(Image img) {
  Asserts.checkArgument(img instanceof AndroidImage);
  Bitmap bitmap = ((AndroidImage) img).getBitmap();
  BitmapShader shader = new BitmapShader(bitmap, TileMode.REPEAT, TileMode.REPEAT);
  return new AndroidPattern(shader);
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:7,代码来源:AndroidGraphics.java

示例10: doGradient

private Gradient doGradient(boolean isLinear, Attributes atts)
{
	Gradient gradient = new Gradient();
	gradient.id = getStringAttr("id", atts);
	gradient.isLinear = isLinear;
	if (isLinear)
	{
		gradient.x1 = getFloatAttr("x1", atts, 0f);
		gradient.x2 = getFloatAttr("x2", atts, 1f);
		gradient.y1 = getFloatAttr("y1", atts, 0f);
		gradient.y2 = getFloatAttr("y2", atts, 0f);
	}
	else
	{
		gradient.x = getFloatAttr("cx", atts, 0f);
		gradient.y = getFloatAttr("cy", atts, 0f);
		gradient.radius = getFloatAttr("r", atts, 0f);
	}
	String transform = getStringAttr("gradientTransform", atts);
	if (transform != null)
	{
		gradient.matrix = parseTransform(transform);
	}
	String spreadMethod = getStringAttr("spreadMethod", atts);
	if (spreadMethod == null)
	{
		spreadMethod = "pad";
	}

	gradient.tilemode = (spreadMethod.equals("reflect")) ? TileMode.MIRROR : (spreadMethod.equals("repeat")) ? TileMode.REPEAT : TileMode.CLAMP;

	String unit = getStringAttr("gradientUnits", atts);
	if (unit == null)
	{
		unit = "objectBoundingBox";
	}
	gradient.boundingBox = !unit.equals("userSpaceOnUse");

	String xlink = getStringAttr("href", atts);
	if (xlink != null)
	{
		if (xlink.startsWith("#"))
		{
			xlink = xlink.substring(1);
		}
		gradient.xlink = xlink;
	}
	return gradient;
}
 
开发者ID:maxwell-nc,项目名称:ExhibitionCenter,代码行数:49,代码来源:SVGParser.java

示例11: getAreaXMode

TileMode getAreaXMode( int k ) 
{ 
  SymbolArea s = (SymbolArea)getSymbolByIndex(k);
  return ( s == null )? TileMode.REPEAT : s.mXMode;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:5,代码来源:SymbolAreaLibrary.java

示例12: getAreaYMode

TileMode getAreaYMode( int k )
{ 
  SymbolArea s = (SymbolArea)getSymbolByIndex(k);
  return ( s == null )? TileMode.REPEAT : s.mYMode;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:5,代码来源:SymbolAreaLibrary.java


注:本文中的android.graphics.Shader.TileMode.REPEAT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。