How to use drawFilledPath() to draw several paths

Hello

I am able to draw several paths using the drawPathOutline(), but the same code for the drawFilledPath() throws the exception with invalid arguments. My code below.

Bitmap img1 = new Bitmap (500,500);
Graphics gt = Graphics.create (img1);
            
int [] xpts = new int [10];
int [] ypts = new int [10];
Ptypes = new ubyte [] byte [10];
int offset [] = new int [4];
            
xpts [0] = 50;
ypts [0] = 100;
xpts [1] = 150;
ypts [1] = 100;
xpts [2] = 150;
ypts [2] = 200;
xpts [3] = 50;
ypts [3] = 200;
xpts [4] = 0;
ypts [4] = 0;
            
xpts [5] = 70;
ypts [5] = 130;
xpts [6] = 120;
ypts [6] = 130;
xpts [7] = 120;
ypts [7] = 170;
xpts [8] = 70;
ypts [8] = 170;
xpts [9] = 0;
ypts [9] = 0;
    
position [0] = 0;
Offset [1] = 4;
by offset [2] = 5;
offset [3] = 9;
            
gt.setColor (net.rim.device.api.ui.Color.BLACK);
            
gt.drawPathOutline (xpts ypts, null, offset, true);
gt.drawFilledPath (xpts, ypts, null, offset);
            
gt.drawRect (5, 5, 190, 190);
gt.drawRect (5, 5, 10, 10);
gt.drawRect (20, 20, 40, 40);
            
PNGEncodedImage pngEncImg = PNGEncodedImage.encode (img1);

If you see the commented drawPathOutline draws the i.e two channels, 0 to 3 & 5 to 8 are drawn correctly. However, when it comes to drawFilledPath(), it throws exception saying invalid arguments. I tried different ways to define the offset, but of no use. It works fine when I used the null value for offset, but what attracts as a single path which is not what I want.

Some how the Blackberry SDK document gives the impressino which he must start and end offset for each path in the case of multi path scenario. However, we need only three shifts for two channels

That is to say

shift at the beginning of the first path

lag at the end & beginning of second road

offset to end second path

In the above example we don't need (0,0) coordinate between the paths, so points can be

int [] xpts = new int [8];
int [] ypts = new int [8];
Ptypes = new ubyte [] byte [8];
int offset [] = new int [3];

Path 1
xpts [0] = 50;
ypts [0] = 100;
xpts [1] = 150;
ypts [1] = 100;
xpts [2] = 150;
ypts [2] = 200;
xpts [3] = 50;
ypts [3] = 200;

Path 2

xpts [4] = 70;
ypts [4] = 130;
xpts [5] = 120;
ypts [5] = 130;
xpts [6] = 120;
ypts [6] = 170;
xpts [7] = 70;
ypts [7] = 170;

offsets
position [0] = 0;
Offset [1] = 4;
by offset [2] = 8;

gt.setColor (net.rim.device.api.ui.Color.BLACK);
            
gt.drawPathOutline (xpts ypts, null, offset, true);
gt.drawFilledPath (xpts, ypts, null, offset);

This time drawPathOutline & drawFilledPath works very well.

Tags: BlackBerry Developers

Similar Questions

  • How to use the variable in the path of the source of an image in flex

    Hello
    I just want to know that how to use the variable in the path of the source of an image in flex

    Hello
    I just want to know that how to use the variable in the path of the source of an image in flex

  • How to use as operator for several values

    Hi all

    I want to obtain the column values for the column - filed_name which ends by ('X 1', 'X 2' 'X 3' 'X 4' 'X 5' 'X 0' 'XA' 'XB' "XM" "XP" 'X' "CM" "MT") of the variable_info table


    I tried to use as shown below

    SELECT * FROM VARIABLE_INFO WHERE FieldName like (' %x 1 "," %X 0 ");

    but getting error
    ORA-00907: lack of right parenthesis

    can someone tell me how to use as operator for multiple values?

    Thank you/kumar

    You need not a subquery, just make sure that you use parentheses to group your GOLD requirements

    SELECT RELATION ,
    FIELD_NAME ,
    ATTRIBUTE ,
    FIELD_DESCRIPTION,
    SOURCE
    FROM VARIABLE_INFO
    WHERE RELATION NOT IN ( 'CHAI',  'ITAB', 'ITB2', 'ITB3', 'MINI', 'NOTE', 'MINC', 'FINI', 'FTIM', 'FWTG', 'FMLY', 'FMIS', 'FSUM', 'MEMB' ,'FINC', 'FASO')
    AND (SUBSTR(FIELD_NAME,-2) in ('X1', 'X2' ,'X3', 'X4', 'X5', 'X0', 'XA', 'XB', 'XM' ,'XP' ,'CM','MT')
      OR substr(FIELD_NAME,-1) in ('X')
      OR substr(FIELD_NAME,1) in ('J')
      )
    AND (ATTRIBUTE LIKE 'NUM%' OR ATTRIBUTE = '-') ;
    

    The error you are getting sounds like a problem with the definition of VARIABLE_INFO. It seems the synonym or something that it points to rear edge

    For example:

    CREATE SYNONYM X FOR DUAL;
    CREATE SYNONYM Y FOR X;
    CREATE OR REPLACE SYNONYM X FOR Y;
    SELECT * FROM Y;
    
    SQL Error: ORA-01775: looping chain of synonyms
    

    Kind regards
    Bob

  • How to use the same mask several times

    I want to create a simple oval to use as a mask for a bunch of graphics I want to integrate buttons.

    What is the best way to do it?

    I tried to create an oval shape with rectangular shape tool / oval/customized using this tool path option, and allows me to create the mask on the layer you want.   Is there a way to save this route to be reused on all layers so that each image is cut to the shape and size the same?

    I also tried to use an oval shape as a mask of clipping which was very effective, but could not find a way to maintain transparency in this field has been forcing me to have a background color.

    Thanks for any help.

    Apply the mask to a group and put all your other loose inside...

    Mylenium

  • How can I draw several plots by using the XY graph during execution?

    Hello

    I want to draw several plots in the graph XY to the means of execution user will select the number of plots that he wants to draw, depending on this value, I have to get these values and use table generation and then I give to graph XY.

    During execution, but how to do this?

    Please help me in this regard.

    Kind regards

    Herald

    Why start a new thread?

  • How to use the platform of character even in the same scene several backgrounds without looping the platform of character chronology

    How to use the platform of character even in the same scene several backgrounds without looping chronology of the platform of character? Is it still possible without having to do the scene with another background on another file? To better explain the situation, I have a flash file which has a background and a rig which passes to another context and drilling on another layer and keyframe, but when I go back to the previous background and chronology of this drilling rig repeats, rather than leave, you are doing a new time for this platform. Do I need more than one file?

    In order to reuse assets to animate, you need to duplicate each symbol in the scene who will be the new animation. So, copy and paste the stage on a new layer, right-click on it and select double symbol, then double-click inside the symbol and select each symbol that is going to change, so that the background and the rigging and also select symbol duplicated for those files as well. usually, when I animation I do not use the main platform in the scenes, duplicate as 'Guy1_sc 1', then place it in the scene so that the path I never uses the master file. 'Guy1_sc 2' is a different file. Also if you lipsync and stalled the head separately you will need to reproduce, so, for each scene, is also unique. I hope this makes sense.

  • How to use the path generated by a star to guide the robot to move?

    I now know how to use a star planning on Voronoi path and I can run this program successfully. \

    However, my problem now is how I can use the path data (generated by the planning algorithm * path) to guide the robot rolling along this path?   Well, I guess I can get a set of points (denoted by x and there contact information) of the path and use those points to guide the robot?

    can someone please help?

    Thank you very much

    Double Post

    You must only post the question once.

  • How to use several adf 12 shape and insert the form data in to table during the click on "submit" button

    How to use several adf 12 shape and insert the form data in to table during the click on "submit" button. Can we use several form from adf or not?

    Make sure that you dragged the VO based EO.

    Also make sure that the VO attributes based EO Updatable property.

    The query according to VO is used only to add LOV to the column of the original VO ModelId.

    See you soon

    AJ

  • How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    Ashley,

    What about window > show the rectangle enclosing (Ctrl / Cmd + Shift + B to toggle)?

  • How to use a brush to draw a 'C' shape without having the 2 curves "informed"?

    C.PNGC1.PNG

    How to use a brush to draw the shape C (above) without going through the 2 curves "informed"?

    flimpyo,

    It seems to be the Blob issue resolved by Kurt with the effect > Distort & Transform > Zig Zag (setting the size to ridges by Segment and from 0 to 100 (you can get away with less, but should not be)).

    In your version, it has probably been moved to the appearance (click on the announcement of the stroke) palette.

    See post #4 in this fairly old thread with a link:

    http://forums.Adobe.com/message/2619296#2619296

  • using annotations of drawing, line free hand; How can you apply a fill or shadow of the object/area?

    using annotations of drawing, line free hand; How can you apply a fill or shadow of the object/area?

    You can not. The fill color property applies only to the following observation

    types: circle, square, line, Polygon, PolyLine, FreeText

  • How to use SDexplorer on windows XP to several e-mail / and large photos as I can on my Windows machine?

    I have two machines to XP OS (32 bit) and only one machine Win 7.  I downloaded SDexplorer and I can see it in MY computer.   Don't quite understand the process of network card.  I can't send pictures large or more using Outlook Express.   I signed up for a Skydrive account now just need to know how to use it to email photos as I can with the Photo Album option 7 in Win Live Mail.

    Thank you

    Hi karday,

    Since the problem is related to Windows Live, I suggest you post your question on the Windows Live Solution Center.

    Portal - Messaging Windows Live Solution Center

  • How to select and deselect an existing path and how to make choices using?

    Hello

    I have created a path to the Master file.

    How to select and deselect this existing path and how to make the selection for the rest of the procedure?

    I talked about this script reference guide, I tried this: app.activeDocument.pathItems.getByName ("path of 1');

    But it does not work. Could you please help me on this?

    Thank you

    Rajiv.s

    I thank very you much for the help!

  • Can I use Illustrator to draw the outline of a photograph and get an outline of art beautiful line of items in the photo?

    Can I use Illustrator to draw the outline of a photograph and get an outline of art beautiful line of items in the photo? I tried to do this by using the Trace of the Image, but I can't select the paths that result and assign a stroke to path. How can I do this?

    Please see the photo

  • Strange blips when using Java2D library draw many ways GeneralPath

    I use GeneralPath of Graphics2D to draw the path with many points in the tracing software.  Very rarely I see strange blips, and a customer today highlighted the problem so I need to understand what is happening.  I'd like to think that there is a bug in the rendering code, as I re-read the documentation several times to see if something escapes me.  I have this down to a small enough code that demonstrates the problem, and which can be found here:

    http://www-PW.physics.uiowa.edu/~JBF/bug1215/Demo1215.Java

    (Screenshot: http://www-pw.physics.uiowa.edu/~jbf/bug1215/showBug1215.png()

    (or here in Jython, which might be more convenient for some):

    ( http://www-PW.Physics.uiowa.edu/~JBF/bug1215/showbug1215_sm.JY )

    All the points in the GeneralPath are collinear, as shown here:

    http://www-PW.physics.uiowa.edu/~JBF/bug1215/showBug.PNG

    Has anyone seen this bug before?

    It may be a bug, but I don't think it's interesting to go after him because he appears in an unusual scenario where you have lines as short as 0.004 point (1.4 micrometres) and you're stroking these (fill a box of 1 point width and 1.4 micrometres in length using anti-aliasing). If you zoom in by several factors in beaches where lines begin actually occupying pixels (e.g. 600 DPI) seeds will probably disappear.

    Perhaps a rule the advice not to flatten paths into shorter segments and more than one-tenth of a pixel size, the highest resolution in the course of which the design will be reproduced. I stop at a lot cheaper and you can also use curves if things are not enough dishes. Then the sanding will then be in the consciousness of the resolution itself.

    I don't know what the goal is supposed to look like, but it seems odd that what seems to be the point cloud is drawn by draw a polygon. If you draw points instead, the glitches disappear and the image looks like the picture, you provided showing the collinearity of points.

    You can try that if you replace 'GeneralPath lp = new GeneralPath()' in your program with 'lp Rectangulator = new Rectangulator()' and "g.draw (lp)" with "g.fill (lp.gp)" and the inner class below. On the other hand, if you want to draw a line through all collinear points then a line farthest two points should be enough or am I missing something?

    Kind regards

    Alex

    static class Rectangulator
        {
            public GeneralPath gp=new GeneralPath();
            void moveTo(double x,double y)
            {
            }
            void lineTo(double x,double y)
            {
    
                gp.moveTo(x-1,y-1);
                gp.lineTo(x+1,y-1);
                gp.lineTo(x+1,y+1);
                gp.lineTo(x-1,y+1);
                gp.closePath();
            }
        }
    

    Message geändert durch Alex Geller

Maybe you are looking for

  • How can I make my HTML email compatible?

    I can't see some incoming emails.  This takes place recently.  It comes either with the message to use a client HTML compatible e-mail or in a large amount of code.  What are the settings need to be changed to correctly display all emails.

  • Re: Question about dual OS and recovery

    I want to set up a dual boot option and not need to have all your hard drive reformatted when I use the recovery disc.My previous machine (a non-Toshiba) only reformatted the score required for the operating system is reinstalled. But this seems not

  • Is upgrade Ram 12 GB possible in warranty?

    Hello I baught my laptop (HP Pavilion G6 2004tx) on August 16, 2012. Configuration: OS: Windows 7 HB. CPU: i5 of 2nd generation. RAM: 4 GB of DDR3 memory GPU: 2 GB DDR3 - AMD Radeon HD M 7670 HARD drive: 500 GB My questions are, 1. is it possible to

  • XP Sata AHCI Driver/help for Pavilion dv6t-2100?

    I need to downgrade laptop my sister to Windows XP, due to some compatibility issues with his favorite game. It's a DV6t-2100, as I said in the title, and I looked everywhere for the driver! I found an AHCI driver here on the Intel site, but I don't

  • Messages find blackBerry 8350i Smartphones

    Someone know how to set up messages so that text messages are displayed in your message file or you can make a case for texts? now when I see a notification that I have to go to messages > menu > folders > annd then check each folder mms, sms ect to