ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

Android Gallery 3DЧ¹û
2014-11-24 07:34:57 À´Ô´: ×÷Õß: ¡¾´ó ÖРС¡¿ ä¯ÀÀ:1´Î
Tags£ºAndroid Gallery Ч¹û

DemoÏÂÔØ£ºGalleryFlow


¾ßÌåÏÂÔØÄ¿Â¼ÔÚ /2013Äê×ÊÁÏ/4ÔÂ/22ÈÕ/Android Gallery 3DЧ¹û



ÆäʵʵÏÖÕâ¸öЧ¹ûºÜ¼òµ¥£¬ÏÂÃæ×÷Ò»¸ö¼òµ¥µÄ½éÉÜ


Ò»£¬´´½¨µ¹Ó°Ð§¹û


Õâ¸ö»ù±¾Ë¼Â·ÊÇ£º


1£¬´´½¨Ò»¸öԴͼһÑùµÄͼ£¬ÀûÓÃmartrix½«Í¼Æ¬Ðýת180¶È¡£Õâ¸öµ¹Ó°Í¼µÄ¸ßÊÇԴͼµÄÒ»°ë¡£


Matrix matrix = new Matrix();


// 1±íʾ·Å´ó±ÈÀý£¬²»·Å´óÒ²²»ËõС¡£
// -1±íʾÔÚyÖáÉÏÏà·´£¬¼´Ðýת180¶È¡£
matrix.preScale(1, -1);


Bitmap reflectionBitmap = Bitmap.createBitmap(
srcBitmap,
0,
srcBitmap.getHeight() / 2, // topΪԴͼµÄÒ»°ë
srcBitmap.getWidth(), // ¿í¶ÈÓëԴͼһÑù
srcBitmap.getHeight() / 2, // ¸ß¶ÈÓëԴͼµÄÒ»°ë
matrix,
false);



2£¬´´½¨Ò»¸ö×îÖÕЧ¹ûµÄͼ£¬¼´Ô´Í¼ + ¼ä϶ + µ¹Ó°¡£


final int REFLECTION_GAP = 5;


Bitmap bitmapWithReflection = Bitmap.createBitmap(
reflectionWidth,
srcHeight + reflectionHeight + REFLECTION_GAP,
Config.ARGB_8888);


3£¬ÒÀ´Î½«Ô´Í¼¡¢µ¹Ó°Í¼»æÖÆÔÚ×îÖÕµÄbitmapÉÏÃæ¡£


// Prepare the canvas to draw stuff.
Canvas canvas = new Canvas(bitmapWithReflection);

// Draw the original bitmap.
canvas.drawBitmap(srcBitmap, 0, 0, null);

// Draw the reflection bitmap.
canvas.drawBitmap(reflectionBitmap, 0, srcHeight + REFLECTION_GAP, null);


4£¬´´½¨LinearGradient£¬´Ó¶ø¸ø¶¨Ò»¸öÓÉÉϵ½ÏµĽ¥±äÉ«¡£


Paint paint = new Paint();
paint.setAntiAlias(true);
LinearGradient shader = new LinearGradient(
0,
srcHeight,
0,
bitmapWithReflection.getHeight() + REFLECTION_GAP,
0x70FFFFFF,
0x00FFFFFF,
TileMode.MIRROR);
paint.setShader(shader);
paint.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.DST_IN));


// Draw the linear shader.
canvas.drawRect(
0,
srcHeight,
srcWidth,
bitmapWithReflection.getHeight() + REFLECTION_GAP,
paint);


¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
·ÖÏíµ½: 
ÉÏһƪ£ºAndroidÇý¶¯Ê¹ÓÃJNIµ÷Óà ÏÂһƪ£ºAndroidϵͳHAL²ã¿ª·¢,±àÒë¹ý³Ì(h..

ÆÀÂÛ

ÕÊ¡¡¡¡ºÅ: ÃÜÂë: (ÐÂÓû§×¢²á)
Ñé Ö¤ Âë:
±í¡¡¡¡Çé:
ÄÚ¡¡¡¡ÈÝ:

¡¤Linuxϵͳ¼ò½é (2025-12-25 21:55:25)
¡¤Linux°²×°MySQL¹ý³Ì (2025-12-25 21:55:22)
¡¤Linuxϵͳ°²×°½Ì³Ì£¨ (2025-12-25 21:55:20)
¡¤HTTP Åc HTTPS µÄ²î„ (2025-12-25 21:19:45)
¡¤ÍøÕ¾°²È«±ØÐ޿ΣºÍ¼ (2025-12-25 21:19:42)