printing DXF with transparent background

2003-08-12
2013-04-25
  • Pawel Mrozicki

    Pawel Mrozicki - 2003-08-12

    I'm trying to render DXF with transparent background, but
    I can't do it. (saving later as GIF file)

    Can anyone give me some hints how to do it?

    I tried to do it with YxxfPrtViewHandler but it didn't give satisfied effects

     
    • Ed Karlo

      Ed Karlo - 2003-08-12

      I have done this with satisfactory results using the Acme.com gif routines.  You will need to set the background color to #00000000 to get a transparent background.  (The parameter is of the form: bgcolor=#aarrggbb where the "aa" is the transparency.)  I assume you have seen the file doc/Ycad_api_readme1_a.txt which shows how to render a drawing to an arbitrary Java Graphics object.  The document is not as complete and clear as it should be but it does have code fragments that show how to do this.  I have also used this technique to render a drawing to a pdf file using the iText library (also on SourceForge).

      Ed Karlo

       
    • Pawel Mrozicki

      Pawel Mrozicki - 2003-08-13

      Thank's a lot Ed Karlo for help with transparent background

      ----

      I' ve made function which generates GIF file with
      one layer with transparent background
      It works fine for one layer.

      I have problems with memory while creating GIF for each
      layer in one loop because of using Threads by Ycad

      I wonder if it is possible to synchronize it somehow
      or stop using Thread without changing source files of
      ----

      This is the code of the method

      public void saveAsGIF(String l)
          {       
             
              BufferedImage big =  new BufferedImage(800, 600, BufferedImage.TYPE_INT_ARGB);
             
              Graphics2D g2 = big.createGraphics();
         
              this.layerOn(l); // making layer visible
             
             
              YxxfPrtViewHandler vhandler = new YxxfPrtViewHandler();
             
              vhandler = new YxxfPrtViewHandler();       
              this.initvh(vhandler);

                          vhandler.commandViewHandler_command_init(D,  g2);
                
                    vhandler.commandViewHandler_command_start();           
                    vhandler.waitDrawingViewReady();
                           
              vhandler.commandViewHandler_toolbar_redraw();
              vhandler.commandViewHandler_command_wait_for_complete();
             
              this.layerOff(l); // making layer invisible
             
              g2.dispose();
             
      Then using Acme.com gif routines I generate GIF file

       
    • Ed Karlo

      Ed Karlo - 2003-08-15

      Changing the drawing and/or shutting down the threads has never been implemented properly.  Kind of a holdover from when this was first written - as a simple Applet to display just one drawing in a web page.  This has been on my ToDo list and I have also had a request to look into this from someone else.  This would be a good change and I will take a look at it over the next couple of days.

      Ed Karlo

       
  • Danilo Tomasoni

    Danilo Tomasoni - 2012-11-15

    Hi Ekarlo,
    you said " I have also used this technique to render a drawing to a pdf file using the iText library (also on SourceForge)"

    Can you please help me doing the same thing?

    I readed the doc file but I've not understood howto fill a com.itext.Document object with a dwg using ycad..
    Thank you very much.

    Danilo

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks