Showing posts with label wallpaper. Show all posts
Showing posts with label wallpaper. Show all posts

Wednesday, 12 July 2017

Créer un Live Wallpaper sous Android

Créer un Live Wallpaper sous Android



  • Un live wallpaper a un contenu dynamique, ce qui permet d�avoir des animations. C�est donc � vous de g�rer les diff�rentes �tapes de dessin sur le wallpaper. Pour cela, on utilise les deux classes Runnable et Handler.

    Le handler envoi le runnable (ici drawer) dans le messageQueue associ� � l�UI Thread afin qu�il soit ex�cut�. Ce runnable se charge de dessiner sur le wallpaper gr�ce � la m�thode draw() qu�on expliquera plus tard. R�p�ter plusieurs fois ce m�canisme nous permet d�avoir une animation.

    Quand le wallpaper doit s�arr�ter, la variable visible (qui stocke la visibilit� actuelle du wallpaper) passe � false dans les m�thodes onSurfaceDestroyed()et onVisibilityChanged() ce qui stoppera l�animation (m�thode handler.removeCallbacks(drawer).)

    Quand le wallpaper devient visible, la variable visible passe � true dans la m�thode onVisibilityChanged() , ce qui relance l�animation du wallpaper (m�thode handler.post(drawer).)

    Voyons maintenant comment on dessine sur le wallpaper, la m�thode facilitant cette op�ration est la m�thode draw() :

    private void draw() {
    SurfaceHolder holder = getSurfaceHolder();
    Canvas canvas = null;
    try {
    canvas = holder.lockCanvas();
    if (canvas != null) {
    float x = (width * random.nextFloat());
    float y = (height * random.nextFloat());
    drawImage(canvas, x, y);
    }
    } finally {
    if (canvas != null)
    holder.unlockCanvasAndPost(canvas);
    }
    handler.removeCallbacks(drawer);
    if (visible) {
    //On re-poste le runnable apr�s un petit laps de temps
    handler.postDelayed(drawer, 4000);
    }
    }


    La m�thode qui permet de dessiner l�image dans le canvas est d�crite ci-dessous�:

    private void drawImage(Canvas canvas, float x, float y) {
    canvas.drawColor(Color.WHITE);
    canvas.drawBitmap(androidPic, x-(androidPic.getWidth()/2), y-(androidPic.getHeight()/2), null);
    }


    Sans oublier de d�clarer la variable qui repr�sente l�image qu�on veut dessiner�:

    Bitmap androidPic = BitmapFactory.decodeResource(getResources(), R.drawable.android);


    Explications :

    Nous avons utilis� un Canvas, ce qui nous permet de dessiner de mani�re r�p�titive sur la Surface du wallpaper. Cette surface est fournie par la classe ��SurfaceView��.

    Afin de manipuler cette surface on utilise l�interface SurfaceHolder. On obtient le canvas grace � la m�thode lockCanvas(), puis on dessine sur un point du canvas avec la m�thode drawImage().Ce point est obtenu al�atoirement gr�ce � ses coordonn�s (x,y).

    Enfin la m�thode unlockCanvasAndPost(canvas) est appel� pour que le canvas soit d�ssin� sur la surface du wallpaper.

    Gestion des �v�nements tactiles�:


    Cela se fait gr�ce � la m�thode onTouchEvent(MotioEvent event), cette m�thode poss�de le m�me comportement que la m�thode draw(), sauf que cette fois les coordonn�es du point o� s�effectue le dessin sont obtenus � l�endroit ou l�interaction utilisateur est effectu�e.

    @Override
    public void onTouchEvent(MotionEvent event) {
    float X = event.getX();
    float Y = event.getY();
    SurfaceHolder holder = getSurfaceHolder();
    Canvas canvas = null;
    try {
    canvas = holder.lockCanvas();
    if (canvas != null) {
    canvas.drawColor(Color.WHITE);
    drawImage(canvas, X, Y);
    }
    } finally {
    if (canvas != null)
    holder.unlockCanvasAndPost(canvas);
    }
    handler.removeCallbacks(drawer);
    if (visible) {
    handler.postDelayed(drawer, 4000);
    }
    super.onTouchEvent(event);
    }

    Ce qui donnera :
    import java.util.Random;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.Canvas;
    import android.graphics.Color;
    import android.os.Handler;
    import android.service.wallpaper.WallpaperService;
    import android.view.MotionEvent;
    import android.view.SurfaceHolder;

    public class MyLiveWallpaper extends WallpaperService {

    private static Random random = new Random() ;

    @Override
    public Engine onCreateEngine() {
    return new LiveWallpaperEngine();
    }

    private class LiveWallpaperEngine extends Engine {

    private final Handler handler = new Handler();
    private final Runnable drawer = new Runnable() {
    @Override
    public void run() {
    draw();
    }
    };

    private boolean visible = true;
    private int width;
    private int height;
    Bitmap androidPic = BitmapFactory.decodeResource(getResources(), R.drawable.android);

    public LiveWallpaperEngine() {
    handler.post(drawer);
    }

    @Override
    public void onCreate(SurfaceHolder surfaceHolder) {
    super.onCreate(surfaceHolder);
    setTouchEventsEnabled(true);
    }

    @Override
    public void onDestroy() {
    super.onDestroy();
    handler.removeCallbacks(drawer);
    }

    @Override
    public void onSurfaceCreated(SurfaceHolder holder) {
    super.onSurfaceCreated(holder);
    }

    @Override
    public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    this.width = width;
    this.height = height;
    super.onSurfaceChanged(holder, format, width, height);
    }

    @Override
    public void onSurfaceDestroyed(SurfaceHolder holder) {
    super.onSurfaceDestroyed(holder);
    this.visible = false;
    handler.removeCallbacks(drawer);
    }

    @Override
    public void onVisibilityChanged(boolean visible) {
    this.visible = visible;
    if (visible) {
    handler.post(drawer);
    } else {
    handler.removeCallbacks(drawer);
    }
    }

    @Override
    public void onTouchEvent(MotionEvent event) {
    float X = event.getX();
    float Y = event.getY();
    SurfaceHolder holder = getSurfaceHolder();
    Canvas canvas = null;
    try {
    canvas = holder.lockCanvas();
    if (canvas != null) {
    canvas.drawColor(Color.WHITE);
    drawImage(canvas, X, Y);
    }
    } finally {
    if (canvas != null)
    holder.unlockCanvasAndPost(canvas);
    }
    handler.removeCallbacks(drawer);
    if (visible) {
    handler.postDelayed(drawer, 4000);
    }
    super.onTouchEvent(event);
    }

    private void draw() {
    SurfaceHolder holder = getSurfaceHolder();
    Canvas canvas = null;
    try {
    canvas = holder.lockCanvas();
    if (canvas != null) {
    float x = (width * random.nextFloat());
    float y = (height * random.nextFloat());
    drawImage(canvas, x, y);
    }
    } finally {
    if (canvas != null)
    holder.unlockCanvasAndPost(canvas);
    }
    handler.removeCallbacks(drawer);
    if (visible) {
    //On re-poste le runnable apr�s un petit laps de temps
    handler.postDelayed(drawer, 4000);
    }
    }

    // Permet de dessiner limage dans le canvas
    private void drawImage(Canvas canvas, float x, float y) {
    canvas.drawColor(Color.WHITE);
    canvas.drawBitmap(androidPic, x-(androidPic.getWidth()/2), y-(androidPic.getHeight()/2), null);
    }
    }
    }


    Derni�re �tape, on d�clare notre service dans l�AndroidManifest.xml avec l�action ��android.service.wallpaper.WallpaperService�� et la permission ��android.permission.BIND_WALLPAPER�� qui autorise l�utilisation du Live Wallpaper.
    Notons aussi l�ajout de la balise uses-feature , qui indique � Google Play que votre application contient un Live Wallpaper, pour que celle�ci soit visible qu�aux utilisateurs ayant un device supportant les live wallpapers.

    ?xml version="1.0" encoding="utf-8"?
    manifest
    package="com.tuto.android"
    android_versionCode="1"
    android_versionName="1.0"

    uses-sdk android_minSdkVersion="10" /
    uses-feature android_name="android.software.live_wallpaper"/uses-feature

    application
    android_label="@string/app_name"
    android_icon="@drawable/ic_launcher"

    service
    android_label="@string/my_live_wallpaper"
    android_name=".MyLiveWallpaper"
    android_permission="android.permission.BIND_WALLPAPER"
    intent-filter
    action android_name="android.service.wallpaper.WallpaperService"/action
    /intent-filter
    meta-data android_name="android.service.wallpaper"
    android_resource="@xml/mywallpaper"/meta-data
    /service
    /application

    /manifest

    Sans oublier le String.xml�:
    ?xml version="1.0" encoding="UTF-8"?
    resources

    string name="app_name"Live Wallpaper/string
    string name="my_live_wallpaper"My Live Wallpaper/string
    string name="wallpaper_description"My first live wallpaper/string

    /resources


    Remarque�:


    Pour g�rer les pr�f�rences de votre wallepaper, cr�ez une Pr�f�renceActivity qui permettra de d�finir les configurations de votre fond d��cran. La r�cup�ration des valeurs de vos pr�f�rences s�effectue � l�aide des SharedPreference. Pour cela, ajoutez les lignes suivantes � votre ��wallpaper.xml��:

    android:settingsActivity="MyPreferenceActivity"/


    sans oublier de d�clarer votre activit� dans l�AndroidManifest.xml.

    Lancez maintenant votre application, s�lectionnez le Live Wallpaper que vous avez cr�� afin d�obtenir le r�sultat suivant�:



  • Cr�er un Live Wallpaper sous Android


    Conclusion


    Voila, j�esp�re que cet article vous � permis de mieux comprendre comment fonctionnent les live wallpapers,le code du projet est disponible ici.
    Maintenant place � votre imagination pour cr�er vos propre fond d��cran anim�s.

{ Read More }


Sunday, 9 July 2017

Cool Dota 2 Wallpaper

Cool Dota 2 Wallpaper


Dota 2 wallpaper.
Character in this post : Bloodseeker Dota 2, Traxex Dota 2 , Lina Dota 2 , Morphling Dota 2, Yurnero Dota 2, Kunkka vs Bloodseeker Dota 2
Okay,  If youre a fans of Dota 2, check out this cool stuff

 bloodseeker Dota 2


blood, traxex,lina,morpling

Juggernaut

Kunka and Bloodseeker
{ Read More }


Monday, 12 June 2017

Cool Dota Wallpaper Traxex

Cool Dota Wallpaper Traxex


This is another update from previous post, Cool Female Dota Wallpaper
And now i wanna share my wallpaper colection, I got it from various site.




Traxex by scary_panda





{ Read More }


Saturday, 10 June 2017

CREATIVE PHOTOSHOP WALLPAPER ART 2

CREATIVE PHOTOSHOP WALLPAPER ART 2


View 2x For Real Size Wallpaper / Open In New Tab








............................... Like -- Join Us and Help Us
Searching for
{ Read More }


Monday, 15 May 2017

Create A Glowing Extreme Wallpaper in Photoshop

Create A Glowing Extreme Wallpaper in Photoshop


In this tutorial, we�ll create a complex glowing wallpaper using Photoshop.
We�ll be using custom brushes, several blending modes, lightning techniques, and blurs.
The tutorial was created using free resources, so you can easily recreate it by following step-by-step. To make it easy for everyone, we have included the PSD source file at the very end of the tutorial which should be great to use for quick reference.
Go ahead and try it out and post your examples in the comments area.
Here�s a preview of the final image�.


Step 1

Create a new Photoshop document RGB, 1400 x 900 px. Fill the background with black. Then create a new layer, name it �BG� or something like that and fill it with a Radial Gradient (#55015F � #000000). From the center to one of the sides, as it shows in the images below.

Step 2

Select �BG� layer, then go to Filter > Distort > Twirl and set the twirl value to 250�. Hit OK and see how it looks.

Step 3

Now paste the main image, you can use any picture. This time I�ll paste this image of a roller guy jumping. As I�m very creative the layer�s name will be �Roller guy�.

Step 4

Now extract the guy�s shape, go to Channels, hide everything except the Blue channel then using the magic wand select the white background. Click on RGB layer on the Channels palette, then go to the Layers view again. Feather (and expand) your selection a few pixels and delete it.

Step 5

Now rotate and move the guy just a little bit to the left. Then go to Images > Adjustments > Curves and set the values below to decrease the output levels. See the image below.

Step 6

Next, duplicate the �Roller guy� layer, place the copy above the original on the Layers palette. Apply to the copy a Color Overlay (#9D0DAD) and set the Blending Mode value to Hue.

Step 7

Merge the �Roller guy copy� layer with a new blank layer. Then go to Layer > Layer mask > Reveal all and using a soft black brush, paint on the layer mask to hide the face, hands and pants. You should have something that looks like the bottom of the image below.

Step 8

Merge the �Roller guy� and �Roller guy copy� layers and name it just �Guy� (I�m putting those layers in a folder, duplicate and merge the folder). Now Dodge and Burn some areas of the �Guy� layer.

Step 9

Duplicate the �Guy� layer, convert �Guy copy� into a Smart Object. Next select the Smart Object, go to Filter > Blur > Radial blur, set Zoom as blur method and Best Quality and apply the same filter three times (Hit Command � Control + F to re-apply the filter once again). Finally, change �Guy copy� Blending mode to Linear Dodge (Add).

Step 10

Duplicate the �Guy� layer one more time, convert the copy into a Smart Object and apply the Radial Blur filter, but this time, move the Blur center a little bit to the left. Re-apply the filter a few times, move the �Guy copy 2? layer above everything else on layers palette, then change its blending mode to Linear Dodge (Add).

Step 11

Now download this brush set. And paint one single shape into a new layer called �Brush1?. Use this color (#E700FF).

Step 12

Add to the �Brush1? layer a gradient overlay using the colors shown below. Then put the �Brush 1? layer above the �BG� layer on layers palette. Finally add an Outer Glow filter.

Step 13

Now add a new light above the guy, use the brush shown below and use this color (#E700FF). Also add an Outer glow and change layer�s Blending Mode to Screen.

Step 14

Add two more lightening brushes with the same layer effect of previous step.

Step 15

Following select �Guy�, �Guy copy� and �Guy copy 2? and put them into a folder named �Flying Guy�, merge the folder, duplicate the layer and put it behind the original. Select Flying Guy copy and go to Edit > Free Transform, then reduce and rotate the guy just a little bit. Repeat that step as many times as you want.

Step 16

Now hide for a while all the guys layers, show the smaller one and apply a Layer Mask and fill it with a Radial Gradient Black � White. Repeat this with every single copy of the flying guy.

Step 17

Now we�re going to add a complex diffuse glow to make our design brighter. Change the Blending Mode to Dissolve on each Flying guy�s copy. Then down the Opacity of the copies to 75%, 70%, 65%, 60% respectively. Finally merge all the copies into one layer named �Flying guy copy� and put it above the �Flying Guy� layer or folder.

Step 18

Next, apply to the �Flying Guy copy� layer a Layer mask > Reveal all, then using a soft black brush, paint on a layer mask to hide some areas of the diffused glow.

Step 19

Hide the Diffuse layer for the moment. Now as a quick fix, to improve the lighting sensation, adjust the Hue / Saturation of the background �Brush 1? layer. Also add a white light behind the Flying guy using one of these brushes.

Step 20

To finish the diffuse glow effect, show the �Flying Guy copy� layer, add an Outer Glow (use the values shown below). Then goto Filter > Blur > Gausian Blur, set 7,2 as blur radius and hit OK.

Step 21

Now type some text somewhere on your design, I�m using Kozuka Gothic Pro typeface (#F3B1FB), then add an Outer Glow effect to the text layer.

Step 22

Finally use this brush set to add some white sparkles.

Final result

And that�s it! a simple and quick way to create a glowing conceptual wallpaper!.

Download the .PSD source file
{ Read More }


Friday, 12 May 2017

Cool Female Hero Wallpaper Dota

Cool Female Hero Wallpaper Dota


Here is Cool Walpaper Female Hero from Dota character
Click image for actual size


mirana from deviantart

crystal maiden

night elf

mirana by jilley


mirana by jennielfi

lina inverse


Lina by h4nd
See you next update :)
{ Read More }