Draw the circle with color gradient

Hi all

Someone knows how to use graphics to draw a circle with color gradient?

Thanks for help

Here is a very simple code that should work.

//xc = x center
//yc = y center
//
//  Circle diagram
//           (xc-r),(yc-r){col2}  xc,(yc-r){col3) (xc+r),(yc-r){col4}
//           (xc-r), yc   {col1}  [xc, yc]        (xc+r),yc    {col5}
//           (xc-r),(yc+r){col8}  xc,(yc+r){col7} (xc+r),(yc+r){col6} 

int [] xpts = { (xc-r), (xc-r), xc, (xc+r), (xc+r), (xc+r), xc, (xc-r) };
int [] ypts = { yc, (yc-r), (yc-r), (yc-r), yc, (yc+r), (yc+r), (yc+r) };
byte [] types = { Graphics.CURVEDPATH_END_POINT,
                  Graphics.CURVEDPATH_QUADRATIC_BEZIER_CONTROL_POINT,
                  Graphics.CURVEDPATH_END_POINT,
                  Graphics.CURVEDPATH_QUADRATIC_BEZIER_CONTROL_POINT,
                  Graphics.CURVEDPATH_END_POINT,
                  Graphics.CURVEDPATH_QUADRATIC_BEZIER_CONTROL_POINT,
                  Graphics.CURVEDPATH_END_POINT,
                  Graphics.CURVEDPATH_QUADRATIC_BEZIER_CONTROL_POINT };
int [] colors = { col1, col2, col3, col4, col5, col6, col7, col8 };

graphics.drawShadedPath(xpts,ypts,types,colors,null);

Tags: BlackBerry Developers

Similar Questions

  • Draw curved line with color gradient

    How to draw the curved line (using the pencil tool) with color gradient (example: blue, yellow or white to gray)?

    Can not change the color of color gradient stroke?

    Here's a way to kind of work.

    Use the lag effect (CS3) and fill with a gradient.

    Note that the gradient is not actually 'follow' but where it is located (in this case) horizontally.

  • Follow the circle with overlay

    Hello

    I have a few messy data a camera. It's a pattern of concentric circles that changes with the times - each ring splits into two, each of these components of movement away form between them. I want to set up a set of these rings.

    Someone could point me in the right direction or have any advice for a strategy game start? I thought I could use the superposition of the ring the user select a set of rings, and then somehow have the overlay 'follow' the data he was moving (easy or hard?).

    I removed the components of acquisition IMAQ and took a series of images, load them into a loop to try to show the effect as an animation (vi and associated data).

    Any help would be appreciated.

    I watched this example: http://forums.ni.com/t5/LabVIEW/Fit-2D-data-in-to-Circle/td-p/668858/page/2?view=by_date_ascending
    who can be of some use if I manipulate data, but is it the right way to go?

    And have tried to use machine vision-> analytic geometry-> control 'IMAQ made circle 2', but there is no example vi or tutorial for this control (or most of the other tools of analytic geometry).

    so not sure exactly how it works.

    Thank you

    I'd probably watch the line profile.  If it is noisy or has spots, you might on average several radial lines (up, down, left, right) to get more consistent data.

    Ridge detection would probably find the part the clearest of each circle and could find maximums the.  You could treat these to find what you are looking for.  Two very close circles would probably be identified as a single peak.  Looking at the data would be the first step.

    You can use overlays draw the circles located on the original image.  This would help you to know if you followed them correctly.

    Bruce

  • How to draw a circle with tabs around it

    Hey, I need to draw a circle with tabs around it as follows:

    circle.png

    I got tired of drawing of a rooster, but I need the inside edges as State not tilted. These look like rectangles with curved roofs. No idea how I can do this? If possible to create an individual tab first and then get the right angle adjust the circle? Pointers on this would be really appreciated! Thank you

    Just do a single tab with the corners that intertwine with the circle. Turn on benchmarks commented to the corners align with the edge of the circle. Make sure that the two forms are horizontally centered.

    Then select the tool rotation and option-click on the center point of the circle. Smart Guides will break the pointer to the center of the circle. Enter your angle of 60 °, and then click "copy".

    With the shape of the tab selected, select transform again four times.

    Select all tabs and make a shape composed of them (command-8). Make a copy (command-C). Send the tabs on the front of the stack (Command - Shift)]-. Click on less prominent in the Pathfinder palette. That should leave you with this:

    Finally, paste a copy of the tabs in place (command-F) to get this:

  • I can't create a shortcut to the site on my desktop, when I click on the url bar I can drag on the browser to open a new, but as I drag him on my desktop I get the circle with the line through it, one that looks like a no entry sign. Help?

    I can't create a shortcut to the site on my desktop, when I click on the url bar I can drag on the browser to open a new, but as I drag him on my desktop I get the circle with the line through it, one that looks like a no entry sign. Help

    Try to drag the image to id web site (favicon) on the left side of the address bar, instead of the URL.

  • I have problems, adding comments using Adobe reader DC on my pro 3 surface. I can select the circle for example, but when I try to draw the circle nothing happens and the screen just scrolls in the direction I move the pointer?

    I have problems, adding comments using Adobe reader DC on my pro 3 surface. I can select the circle for example, but when I try to draw the circle nothing happens and the screen just scrolls in the direction I move the pointer?

    Hey paulc6148125,

    Please try the mode settings different button in Adobe Acrobat Reader DC-> leModifiermenu-> preferences-> general categories.

    Kind regards

    Nicos

  • Draw the circle on MapView

    Hi all.

    I am quite new to the development of the Cascades.

    I would like to know if it is possible to trace a circle on a plan, given a Point and a RADIUS.

    I searched a bit on the doc, but I not only found ways to draw polygons from a set of coordinates.

    IIRC the fact maps app exactly that, show GPS accuracy of the signal (IE put a circle around you on the map to show the accuracy of the coordinates).

    Thank you very much, greetings

    Thanks BBSJdev, but I need an overlay following cards (and with a dynamic dimension) and not static.

    In any case, I found a nice way to draw a circle-layer on the mapview. Here is the code:

    It is an improved version of the solution that someone else posted on this forum some time ago (which did not perfectly, as she draws an elypse and not a circle). I can't find this post now, in any case I would like to thank the user who wrote this snippet.

    Here is the code:

    void ApplicationUI::drawCircle(double lon, double lat, double radius) {    MapView *mv = root->findChild("mapView");    DataProvider *dp = mv->mapData()->defaultProvider();
    
        // convert radius meters to latitude width    double latr = radius / 111412.84; // this is the number of meters per degree
    
        // with longitude it's a bit more complicated, since a degree of longitude 's length    // is not constant (unfortunately the earth is not flat)    int a = 6371000; // earth radius in meters    double rad_lat = 0.0174532925 * lat; // convert latitude from degrees to radiants    double _lr = ((M_PI / 180) * a * cosf(rad_lat)); // length of a degree of longitude in meters    double lonr = radius / _lr;    qDebug() << "lonr = " << lonr << " ; _lr = " << _lr << " ; latr = " << latr << " ; lat = " << lat;
    
        GeoPolygon* result = new GeoPolygon;    Polyline line;    const int numOfSeg = 36;    for ( int i = 0; i < numOfSeg; i++ ) {        double theta = 2.0f * 3.1415926f * float( i ) / float( numOfSeg );        double x = lonr * cosf( theta );        double y = latr * sinf( theta );        line.append( Coordinate( y + lat, x + lon ) );    }
    
        result->setOuterBoundary( line );    result->setId("id-circle");    mv->mapData()->defaultProvider()->add(result);
    
    }
    
  • MacBook Air screen stuck on the circle with bar oblique?

    I bought a MacBook Air on Friday last and just received in the mail today. I started up and followed all the prompts that he gave me. He then went to a screen that says "set up your Mac", and it was on this screen for hours then I looked at how to fix it. I found an article that said hold down the CTRL + SHIFT + option, press the power button, then release all buttons. I did this and then restarted my laptop. It made the normal chime, then shows the apple with a loading bar logo under it (as when you update software), then it goes to a screen with a circle that has a slash through it. The cursor does not appear and it does nothing. I don't know what I've done for her, but no matter who else has experienced this problem and found a resolution?

    Screen of Mac OS X - grey or prohibitory sign appears during startup

  • Turn the circle with the slider will not stop in one account.

    Spinning circle with the cursor keeps turning into a single account.  Administrative accounts and others are very good.  It started after the recent release of Windows 7.  I'd appreciate any help.

    Thanks for the follow-up of Ramesh.  My idea of authorization has failed.  Since I knew what program is doing, I did uninstall it and reinstalled.  Who did the trick.

    As always, thanks for the help guys.

  • How to draw a circle with filling

    It is probably the easiest question you have today, so enjoy!

    I am trying to create a simple circle with filling (Yes, I know. Easy). So, I used the Ellipse tool and set the fill to blue. (below). The problem is the filling doesn't fill all the way up to the border and there is a grey border around it.

    I really, really want just a beautiful blue circle... is - too much to ask...? (* sniff *)

    Thanks in advance!

    circle.png

    Hello

    It looks like to your see the path of the ellipse.

    If you go to the Trace Panel, you can click under the path in the Panel to hide the path.

    What version of photoshop are you using?

    Visible path

    hidden path

  • animate the outline of the circle with rounded end...

    Hi-bit basic queries Im guessing, but does anyone know to animate a circular contour while keeping its circular end?

    for example. as if it was a circular loading bar fill.  The closest ive come to achieve this is by using the circular primitive tool in flash and keyframing its RADIUS over several periods, but he drives very well at the end

    any help much appreciated!

    Nick

    Create the circle as a mask on a solid. Then apply effect > generate > stroke.

    Anime at the beginning or the end point and adjust the width. Select paint on transparent. That should do it.

  • The transition between two objects with color gradient

    Oh no! I want to make a smooth transition between objects of gradient color, but you can see a line. How can I make a smooth transition? It is not a transparant-gum... Please help me!

    probleem2.PNGprobleem.PNG

    try to use a gradient instead of the net?

    You can use the path search tool to convert forms in one section, then gradient to create the dark lines where are the current limits.

    Or you can use "pen" one of them, to blend the overlap, but you may need to add the pen to a slightly larger copy of the object and your current border point to create a mask in order to keep the edges you want to stay strong and just leave an edge of more than in the other form.

  • Any ideas what to try?  The difficulty in tracing a logo .png with color gradient.

    farmers union logo .pngI'm having a lot of trouble to get this logo up nicely.  I tried all the presets and spent a lot of time trying various advanced options.  It appears blurry or lines are very irregular.  Any ideas?  Thank you in advance!

    Use the pen tool and the ellipse tool. Brushes can help with the grain

  • How to blend the edges of the Image with a gradient

    Hi all

    I've created a transparent gradient on an image. The problem I have is that the edges of the image are visible under the gradient. I know how to fix this in Photoshop, but I'm having trouble in Illustrator.

    How can I create a smooth gradient on the image smoothing without seeing the edges of the image?

    Thank you

    George

    The gradient is transparent, so you can see the edges of the image through the slope, especially since the image is cut off on the edges.

    Try to move the brown color on your gradient slider further to the right as it mix better with the image, you may need to add more mixes not so. Soften the edges of the image as much as the edges are not so difficult.

  • List and container with color gradient

    Hello

    I want to display a list with gradient filled background individual list items.

    While this was possible in Qt QML, but in the Cascades QML - gradients do not appear.

    Anyone able to get the gradients in the list or the bottom of their containers?

    Would apprevicate all the help I can get on it.

    Thank you!

    Created issue:
    https://www.BlackBerry.com/jira/browse/BBTEN-171

    Is it possible to know the roadmap on this issue.

Maybe you are looking for

  • Why cani not access yahoo in firefox, but in IE, I can't

    I have been search cela and looked at all of the town of "fix" I tried to start in safe mode ran scans no item found and deleted my cookies cleared my cache etc nothing works permanently a few minutes at most. I can travel without any problem in IE b

  • My time will not be updated, causing various problems on all kinds of things on my computer.

    It began with my time do not update automatically. When I go to the tab "internet time" to connect and update, he needs an administrator to fix it and even though I am the administrator, it won't let me, but that's another issue all together. I have

  • Removed USB mass storage?

    Dear Sony, Is there a reason that you have removed the USB Mass Storage of the Z5 and whatever it is running the latest firmware? No no no MSC makes very difficult synchronization and backup of the phone using 3rd party applications.  I wouldn't mind

  • bluescreen stop: 0x000000D1

    original title: blue screen Stop: 0x000000D1 What should I do?

  • BlackBerry Smartphones Gmail 'sent' messages send to my BB, etc...

    Anyone having problems with the copies of the sent messages is sent to their BB? Whenever I send a message from my Gmail account, a copy is sent to my BB. I also get a read receipt and "delivered" confirmation with Gmail and my Hotmail account. What