×

Discussion Board

Results 1 to 5 of 5

Thread: Gradient

  1. #1
    Registered User
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    3

    Gradient

    Hello...
    I Have simple gradient, Canvas..

    FullGradient.getInstance().createGradient(g,0x003A78D3,0x00000000,5,5);

    but, need RADIAL GRADIENT create in Canvas, please...?

    []´s
    Roberto Teixeira

  2. #2
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    66

    Re: Gradient

    You could simply draw circles, from inside out, changing the colors, as much as you want.
    Something like:
    for (int i = 0; i < 0x100; i++){
    g.setColor(i);
    g.drawArc(x_position, y_position, i , i, 0, 360);
    }

  3. #3
    Registered User
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    3

    Re: Gradient

    Hi JacksonZih...
    Thanks for source. But, I Need example, this type:

    http://www.tinyline.com/svgt/samples...grad-11-b.html

    The problem, want does´t TinyLine, yes simple source for my Package...

    very thanks!
    Roberto Teixeira

  4. #4
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    66

    Re: Gradient

    I don't think i understood your question.
    You posted on the J2ME section, so I thought I could help with coding =)

  5. #5
    Registered User
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    3

    Re: Gradient

    Hi JacksonZih...good ?

    View, this is simple gradient...I use my project. But, I need by GRADIENT RADIAL...please, copy the source and compile.


    public class FullGradient extends Canvas {


    public void paint(Graphics g) {

    Image imgBack = null;
    Image imgEcra = null;

    try {
    imgBack = Image.createImage(10,10);
    } catch (IOException ioe) {
    System.err.println(ioe.getMessage());
    }

    int imgDados[] = new int[getHeight()*getWidth()];


    int cor = 0x00737BE1;

    int c;
    for (int i = 0; i < getHeight(); i++) {

    c = cor | ((i*255/getHeight())<<24);
    for (int j = 0; j < getWidth(); j++) {
    imgDados[i*getWidth() +j] = c;
    }
    }
    imgEcra = Image.createRGBImage(imgDados, getWidth(), getHeight(), true);

    g.fillRect(0, 0, getWidth(),getHeight());


    g.drawImage(imgBack, getWidth()/2, getHeight()/2, Graphics.HCENTER | Graphics.VCENTER);
    g.drawImage(imgEcra, 0, 0, Graphics.TOP|Graphics.LEFT);
    g.setColor(0x00000000);
    g.drawString("Este é um exemplo de Gradiente. YES ! But need Go RADIAL", getWidth()/2, getHeight()/2, Graphics.HCENTER | Graphics.VCENTER);
    }
    }

    Please All...

    And please... my Blog: http://joserobertoteixeira.blogspot.com/

    Thanks
    Last edited by j.teixeira; 2007-03-15 at 00:35.
    Roberto Teixeira

Similar Threads

  1. Gradient Colors
    By roopa_ckr in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-10-12, 13:37
  2. Gradient Fill Banding Problems
    By benc_1 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2005-09-14, 13:53
  3. create color gradient for rectangle - help
    By idrop in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2003-09-11, 11:07
  4. Doing a gradient fill
    By nkn_aikon in forum Symbian User Interface
    Replies: 1
    Last Post: 2001-11-28, 21:23
  5. Doing a gradient fill
    By nkn_aikon in forum Symbian
    Replies: 1
    Last Post: 2001-11-08, 18:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×