Fast polyline drawing like for polygon...

I need to draw as fast as possible a lot of
polylines from arrays of points.
I tried several ways :
Way 1 ------------
GeneralPath polylineShape = new GeneralPath(GeneralPath.WIND_EVEN_ODD,1024);
polylineShape.moveTo(xpts[0],ypts[0]);
for (int i=1;i<num_pts;i++) {
polylineShape.lineTo(xpts,ypts[i]);
((Graphics2D)g).draw(polylineShape);
->>> TOO SLOW
Way 2 ------------
g.drawPolyline(xpts, ypts, num_pts);
->>> FASTER but not enough
Way 3 -----------
Polygon polygonShape = new Polygon();
polygonShape.xpoints = xpts;
polygonShape.ypoints = ypts;
polygonShape.npoints = num_pts;
((Graphics2D)g).draw(polygonShape);
->>> 30% faster than Way 2 : but it draws a closed
polygon, not a polyline
-> How to draw a polyline as fast as way 3 ?
(I definitely don't want a polygon, but a polyline)

You could do the method (3), then just draw the last segment as a line in background color...

Similar Messages

  • Is fast boot not working for you? This is how you get it working correctly...

    Ok so after two days of trying to register on this site, the 50th activation email finally worked...
    Anyway I was trying to figure out why fast boot wasn't making much of a difference it seemed like once it booted quick but may have just been random. My setup is Z77a GD65 with two Samsung 830 128GB in RAID 0.
    It was taking about 30 seconds from pushing the power button to getting into windows and that was with fast boot enabled. That did not seem right. After messing around for a while and researching I came across many mixed reviews about doing this or doing that. Windows 8 Feature... The windows 8 feature is from my understanding and research for secure boot...
    If your just wanting the faster boot times using fast boot. Just enable MSI Fast Boot, and install the Fast Boot utility so you can get back into the bios. When you enable fast boot, this disables usb devices etc so you can't get into the bios when booting. This little utility is really useful as it will boot you from windows right into your bios etc. KEEP READING STILL NEED TO DO MORE!!!!!
    Now for fast boot to work correctly you need to make sure you installed windows 8 in uefi mode. I read a couple people ask this question but I don't think they got the right answer or people just said yea I have a uefi motherboard and windows 8. That is not what people have been asking you.
    To get this working correctly format a flash drive using rufus while choosing your win 8 iso.
    You can get that here and it explains it and the settings to choose. I had to break up the link as the forum would not let me post the link. Maybe a mod can fix the links.
    eightforums .com/tutorials/15458-uefi-bootable-usb-flash-drive-create-windows.html
    After that is done you should then see in the bios a boot option for a UEFI usb flash drive. Make sure your boot mode is using UEFI. Otherwise it will be using legacy mode and not show uefi devices. I selected UEFI only just to make sure. Then choose this uefi flash drive as your first boot device and save and reboot to install windows from this uefi flash drive.
    It should look like this
    Once your at the install screen delete your partititons from the drive you are going to install windows on. So that it is unallocated. Then select new and apply. This will create 4 partitions. Here is a nice quide for doing that and explains it all. eightforums .com/tutorials/2328-uefi-unified-extensible-firmware-interface-install-windows-8-a.html
    Basically your partitions should look like this.
    Once you have installed windows you will then know if you installed in uefi as your splash screen will be different. Instead of just the MSI splash screen you will then see the windows loading square/circle as well on this same splash screen. You will now have a boot option called UEFI Windows Boot Manager. Select that one as your first boot device and then enable MSI Fast Boot.
    Sorry if this post is cluttered I will add some more pics and clean it up in a bit. It's really early.

    Quote from: RemusM on 22-February-14, 01:41:27
    If one SSD fails, you lose the data on both SSDs.
    In your case, you lose 128 GB.
    Period.
    You continue to argue on silly things and you miss the main point:
    RAID 0 on SSDs does not make any sense.
    RAID 0 (striped volume) has been designed for spinners.
    It's a workaround to reduce the access time (a few miliseconds) caused by the mechanical parts of the HDD.
    For a SSD (with a few microseconds access time) does not bring any boost.
    http://www.tomshardware.com/reviews/ssd-raid-benchmark,3485-10.html
    On contrary: shorter lifetime for both SSDs
    So (for the last time) the best solution in your case is:
    Put the OS on the first SSD (drive C) and the other programs/games on the second one (drive D).
    There is no need to kill both SSDs at the same time (for nothing).
    And finally, talking about this silly "fast boot" of yours:
    5,10,20, or 30 seconds is something irrelevant.
    Simply because you get the max speed on an "empty" OS only.
    With every installed app (most of them come with bloatware anyway), your boot time is getting longer and longer.
    On the other hand, who cares if it takes 10 or 20 seconds?
    Only someone with mental problems needs to boot up the computer all day long.
    99.99% of the users boot up the computer once or twice per day.
    From my point of view, this topic is closed.
    You're free to think and do anything you like.
    I take it you are extremely hard headed and only view this from your opinion. Even with your logic of "If a drive fails you lose 128GB of data is wrong." If a drive fails I would lose 256GB of data if the RAID was full...
    The way you originally worded it made it sound like you thought RAID 0 only uses the capacity of one drive... I was trying to clear that up by saying it uses the capacity of both drives and ends up being 256GB capacity but I guess you couldn't wrap your head around what I was trying to say.
    Think what you want... but everyone I know on all of the tech forums I have been on for years, "EVGA, HARD, etc" 99% of users prefer running OS in RAID 0 on SSD's. Anyone with half a brain does not store important files on a RAID 0 array. I even created a new thread on EVGA asking how members prefer installing Windows with two identical SSD's. Most of them said they always run a RAID 0 for OS on SSD's. A couple others said they prefer running Windows/Programs on one SSD, and Games on the other. Usually that is because when they reformat they can simply re initialize the steam directory on the second SSD and then you don't have to reinstall all of your games.
    I respect your opinion but saying RAID 0 on SSDs does not make any sense is crazy talk. And that fast boot is only for people with mental problems lol... you sir have issues. Why do you think they made this feature? Why do people OC? A lot of people do it because it is fun, they are enthusiast, and they like to push a system. Why do people buy SSDs if its only a few seconds faster when you only turn on your computer once twice a day? When you only open an app or launch a game a couple times a day.

  • How can I create a drawing like the one pictured from a photo?

    How can I create a drawing like the one pictured from a photo?

    OK, you are getting closer. Now, use your result, and place a Layer above that. Use the Pen Tool to create the "pen strokes" basically tracing over your background image. Then, when you have created each Path (or Sub-Path), choose Stroke Path, with probably the Pencil Tool and a Brush size that is small enough.
    Not sure which versions of PS these are good for, but here are some plug-ins, that might be helpful.
    AKVIS Sketch
    EdgeLine
    Sketch Effects
    Sketch Master
    I see that one of my old favorites, Flaming Pear's India Ink is not around any more.
    Good luck,
    Hunt

  • I would like for Firefox 4 Beta to save my session like it did in the previous version, how do I set this up?

    Normally when I would close Firefox 3 I would be asked if I wanted to save my session, now in 4 Beta it simply warns me about closing multiple tabs, but I want to save my session.

    I have an easy fix for you guys ... more faster.
    The solution of mark2 ALWAYS save your session, this one is asking you, like for firefox 3.6
    Go to 'about:config', then search for 'browser.showQuitWarning' and set it to 'true'.
    Have fun.

  • How to render string in graphics2d by draw pixels for each string....

    How do you draw a text of graphics2d onto screen? BUT without using the drawstring method which just prints the text out.
    What i basically want is to render the text, one pixel of the text string at a time.
    for e.g. say i want to draw the word "hello", what i want is that it starts at letter "H" by drawing pixel of top to bottom at a speed which i can control (latter stuff)

    This would be a good starting point:
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    public class PerPixelStringRenderDemo extends JFrame {
         private PerPixelStringRenderPanel cp;
         public PerPixelStringRenderDemo() {
              Font font = new Font("Sans Serif", Font.ITALIC, 48);
              cp = new PerPixelStringRenderPanel(font, "Hello, World!", false);
              cp.setDelay(0, 100);
              setContentPane(cp);
              setTitle("Per-Pixel String Rendering");
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              pack();
         public void setVisible(boolean visible) {
              super.setVisible(visible);
              if (visible) {
                   cp.start(true);
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        new PerPixelStringRenderDemo().setVisible(true);
         private class PerPixelStringRenderPanel extends JPanel implements Runnable {
              private BufferedImage bi;
              private Thread timerThread;
              private int pixelCount, maxPixelCount;
              private int delayMillis, delayNanos;
              private boolean lineOriented;
              public PerPixelStringRenderPanel(Font font, String text,
                                                      boolean lineOriented) {
                   this.lineOriented = lineOriented;
                   bi = createImage(font, text);
                   setDelay(1, 0);
              private BufferedImage createImage(Font font, String text) {
                   FontMetrics fm = getFontMetrics(font);
                   int width = fm.stringWidth(text);
                   int height = fm.getHeight();
                   maxPixelCount = width * height;
                   BufferedImage bi = new BufferedImage(width, height,
                                                      BufferedImage.TYPE_INT_ARGB);
                   setPreferredSize(new Dimension(width, height));
                   int y = fm.getAscent();
                   Graphics2D g2d = (Graphics2D)bi.createGraphics();
                   g2d.setFont(font);
                   g2d.setColor(Color.BLACK);
                   g2d.drawString(text, 0,y);
                   g2d.dispose();
                   return bi;
              protected void paintComponent(Graphics g) {
                   super.paintComponent(g);
                   int w = bi.getWidth();
                   int drawnRowCount = pixelCount/w;
                   g.drawImage(bi, 0,0,w+1,drawnRowCount+1, 0,0,w+1,drawnRowCount+1,null);
                   int remaining = pixelCount%w;
                   g.drawImage(bi, 0,drawnRowCount+1, remaining+1,drawnRowCount+2,
                                       0,drawnRowCount+1, remaining+1,drawnRowCount+2,
                                       null);
              public void run() {
                   pixelCount = 0;
                   while (pixelCount<maxPixelCount) {
                        try {
                             Thread.sleep(delayMillis, delayNanos);
                        } catch (InterruptedException ie) {
                             break; // Thread stopped via interrupt()
                        repaint();
                        pixelCount += lineOriented ? bi.getWidth() : 1;
              public void setDelay(int millis, int nanos) {
                   delayMillis = millis;
                   delayNanos = nanos;
              public void start(boolean reset) {
                   stop();
                   if (reset) {
                        pixelCount = 0;
                   timerThread = new Thread(this);
                   timerThread.start();
              public void stop() {
                   if (timerThread!=null) {
                        timerThread.interrupt();
                        try {
                             timerThread.join();
                        } catch (InterruptedException ie) {}
                        timerThread = null;
    }It allows you to toggle between drawing one pixel at a time and one row of pixels at a time. If you do the former (what you asked for in this post), you'll have to set the delay pretty low, as it takes longer than you think to draw each pixel individually. If you do the latter, you'll want to set the delay much higher (in the milliseconds), because it's very fast to draw 1 line at a time.

  • A fast automatic tag fixer for owners of Zen and other tag based players

    Fast automatic tag fixer for owners of Zen and other tag based players.
    I've written a simple freeware utility for fixing mp3 tag discrepancies. It is intended for use before uploading a bunch of albums to a tag-only media player. There's like a million of such programs out there, but this one is based on my exprience with the Creative Zen player, so it could be useful for fellow owners of the device.
    First, the utility scans mp3 album folder tree looking for tag inconsistencies and suggesting corrections. After that you can review (and cancel/modify if needed) the corrections and apply the changes.
    The detected tag errors can be corrected either manually or semi-automatically with the integrated Discogs search. There's a tuneable compilation processing feature, which helps keep compilation albums in one piece on your player.
    You can check the utility out here http://taghycardia.narod.ru/english.html
    Feature suggestions, bug reports welcomed.

    The free program has been vastly updated since the last post.
    Now, it can find and embed cover art for mp3 albums automatically, or it can do the opposite, remove cover images from mp3 files if you need to save space on your player or mobile device. In addition, there is an ability to correct wrong track order automatically and get exact tracklists from Discogs.
    The URL is updated, too: http://taghycardia.info

  • Any good fast food calorie calculators for the iphone yet?

    i know the blackberry had something similar
    but so far i have seen calorie calculators for the iphone but none that will pull up fast food items like subway etc..

    A quick search in the app store found this: http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=285180322&mt=8

  • Undefined Constructor for Polygon

    Hello,
    I have a undefined constructor error message for polygon in Eclipse and I cannot figure out why.
    Initially I have this method and everything worked fine; public void drawing (Graphics g, List <int []> x_Points, List <int []>y_Points) {
              Graphics2D g2d = (Graphics2D) g;
              g2d.setColor(Color.blue);
              g2d.setStroke(new BasicStroke(1F));
              ArrayList<Polygon> list = new ArrayList<Polygon>();
               for( int p = 0; p < x_Points.size(); p++) {
                   list.add(new Polygon(x_Points.get(p),y_Points.get(p),x_Points.get(p).length));
                    }During the course of writing other methods, I found out that using List<List<Integer>> will be better than List<int []>, so I decided to modify the code above to:public void drawings(Graphics g, List <List<Integer>> x_Points, List <List<Integer>>y_Points) {
              Graphics2D g2d = (Graphics2D) g;
              g2d.setColor(Color.blue);
              g2d.setStroke(new BasicStroke(IF));
              ArrayList<Polygon> list = new ArrayList<Polygon>();
               for( int p = 0; p < x_Points.size(); p++) {
                   list.add(new Polygon(x_Points.get(p),y_Points.get(p),x_Points.get(p).size()));
                    } But I got this Error; The constructor Polygon(List<Integer>, List<Integer>, int) is undefined
    Thanks,
    Jona_T

    The polygon constructor you are using accepts arrays of ints, not Lists. I think it will work if you change it to:
    list.add(new Polygon(x_Points.get(p).toArray(new Integer[0]),y_Points.get(p).toArray(new Integer[0]),x_Points.get(p).size()));toArray converts the list to an array, which is what the Polygon constructor accepts, and the argument of an Integer array tells it to make an array of Integers instead of an array of Objects.

  • Trying to draw artwork for a letterpress invite.

    Hello, i am trying to draw art for a letterpress invite... I am trying to get what i have seen being called - a engraved look, also has been called antique etch look....
    It is the style that is very popular right now and it is on letterpress invites....
    any help trying to achieve this look would be very appreciated....
    Thanks

    Hi -
    Thanks for responding
    i am trying to draw this image for a wedding... The exact image is slightly different (different placement of a few petals)
    I am having trouble trying to get that engraved look... like a letterpress invite... the lines - is there some kind of filter or something or are all those lines just manually put down... or is there an easier way  to go....
    specifically it is the broken lines and the white lines with in the pink filled in areas...
    Here is the link
    http://www.williamarthur.com/products/Vera-Wang-Engraved-Peony-Wedding-Invitations_69-6802 7_2851/image

  • Drawing like ball shapes

    hi all,
    it is possible to draw Like ball shapes using java2D(it looks like ball)?plz help me.
    thanks in advance
    bye
    kishore naidu

    (it looks like ball)?for a flat circle you can usepublic void paintComponent(Graphics g) {
       g.setColor(Color.red);
       g.fillOval(x,y,r,r);
    }is this what you mean?
    asjf

  • Paint/drawing program for Mac

    Is there a (freeware) painting/drawing program for the Mac, such as MS Paint on wintel machines? My youngest used MS Paint for a number of school projects and I'd like to find a counterpart for use on the Mac. Thanks
    iMac-Intel   Mac OS X (10.4.5)  

    There is always The Gimp, but that might be a little complicated for a young person, of couse my 9 year old uses Photoshop, so if they aren't too young you might try it. You will need to first install X11, that comes on your system DVD that came with your mac.
    Have you looked at http://www.chocoflop.com/ ? I've never used it but I saw someone else recommend it.
    Alfredo

  • We have 4 iphones in our family and an Ipad.  When we purchase music I would like for the entire family to be able to use it.  Should each of us use a different apple account or should we use the same one.

    We have 4 iphones and an Ipad in our family. When we purchase music, I would like for the entire family to be able to use it and then back it up to Icloud. What is the best and cheapest way for this to happen.  Should we all have a different apple id or should we use the same one.

    You will all need to be on the same itunes account ID.
    You can however all have seperate icloud accounts aswel.

  • I am trying to print a PDF file to a legal size paper and I would like for it to fill up the page. How do I do this? I went into the settings and changed it from letter to legal, but it's still printing out the same size. Can someone help me, please?

    I am trying to print a PDF file to a legal size paper and I would like for it to fill up the page. How do I do this? I went into the settings and changed it from letter to legal, but it's still printing out the same size. Can someone help me, please?

    Are you trying to Print to PDF or are you trying to Print a PDF file to a physical printer?

  • TS1702 how do you stop itunes from downloading apps over and over again and again like for ever it wont stop  help.

    how do you stop itunes from downloading apps over and over again and again like for ever it wont stop  help.
    i tryed everything i  can in the setting and so on , i even clicked on the downloads arrow to pause it and delete them but like i said it will now stop.
    theres apps i just dont want. theres a list of them but theres not a place were i can get rid of them. it also says some stuff about icloud yeah right like i have ios 5 or 7 ha . pod touch 2 is what i have lol . plz help thanks.

    to the right by search library theres an arrow there click on it : it will show you what it is downloading , from there you can pause and select all and delete them but still will continue to download them if you tell itunes to check for downloads. that download engien is crazy i tell yeah.
    no matter what we do it will still download them trust me i tryed everything and i also went to icloud to see if it was there but to what i see is that there is no apps there this is some crazy itune program that needs to remade.

  • I have a new iPad Air. Can I use plug in USB camera reader to have a load of movies etc on an external hard drive and then plug and play so to speak. I'm off on holiday and haven't got the capacity to have everything on that I'd like for the kids

    Can I use a plug in USB camera reader to have a load of movies etc on an external hard drive and then plug and play so to speak? I'm off on holiday and haven't got the capacity on the iPad to have everything on that I'd like for the kids.
    So basically I want a hard drive with X amount of films etc on. Can I then watch them on my iPad?
    Hope this makes sense.

    External HDD won't work.
    You need something like this:
    http://www.seagate.com/goflexsatellite/

Maybe you are looking for

  • "212 - Rejeicao: Data de emissao NF-e posterior a data de recebimento"

    Bom dia, Estou com o seguinte cenário. Usuário está tentando emitir nota e está ocorrendo o erro "212 - Rejeição: Data de emissão NF-e posterior a data de recebimento". Usuário está em Porto Velho - Rondônia que é uma hora a menos em relação a Brasíl

  • Leopard Clients take a Long Time to Login (roughly 1~2 minutes)

    Hello all, I've spent the last few weeks scouring these groups and then net and searching and searching for someone with a similar problem to my own, but have come up pretty much empty handed and so now turn to here to see if any else has had this is

  • .Mac Alternatives for Free

    I am a cheap person and I was wondering what are some great .Mac alternatives. So far I have run into NotMac (Leapord not support) which makes your Mac the server and gives you all the feature of .Mac and how ever much space you have on the computer.

  • Selection of people based on Roles

    Hi Experts, This is related to Appraisals. How to select people based on Roles in 360 degree Appraisals. For eg: If sales employee has to be appriased by external customers, vendors..how to select those people as part appraisers. Please advice.. Than

  • Processing Back Dated Element

    Hi, I am applying Unpaid Leave absence for previous month in this current month. The element entry for this absence is getting created in previous month for which the payroll is already processed. How to process this element in current payroll period