Serialization of Vector Graphics object

I'm writing a Vector base Graphics Software, all objects are stored into a Vector....
Originally, i wanna using XML for saving , but one kind of my objects contains BufferedImage which could not represented by XML , so i decide to save by "ObjectOutputStream".
i know that Vector implements Serializable, plus, i have implements Serializable in my custom objects too....
Unfortunely, it got error as follow:
java.io.WriteAbortedException: Writing aborted by exception; java.io.NotSerializ
ableException: java.awt.BasicStroke
i guess it is because my objects contain some attributes that do not support Serializable , such as BasicStroke, Paint, and some other alse....
Do anyone know how to solve it ??
Thanks very much ~~~

Here is the well functionning code I implemented to save a BasicStroke, where style is the attribut name for my BasicStroke instance.
Declare your BasicStroke attribut as transiant to avoid exception with defaultWrite() operation as explained in previous messages
private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
float width = this.style.getLineWidth();
int cap = this.style.getEndCap();
int join = this.style.getLineJoin();
float miterlimit = this.style.getMiterLimit();
float[] dash = this.style.getDashArray();
float dash_phase = this.style.getDashPhase();
s.writeFloat(width);
s.writeInt(cap);
s.writeInt(join);
s.writeFloat(miterlimit);
s.writeObject(dash);
s.writeFloat(dash_phase);
private void readObject(ObjectInputStream s) throws IOException {
try{
s.defaultReadObject();
float width = s.readFloat();
int cap = s.readInt();
int join = s.readInt();
float miterlimit = s.readFloat();
float[] dash = (float[])s.readObject();
float dash_phase = s.readFloat();
this.style = new BasicStroke(width,cap,join,miterlimit,dash,dash_phase);
}catch(ClassNotFoundException ioe){System.err.println(ioe.getMessage());}

Similar Messages

  • Serialization of Vector Object

    I have an Message class that is something like
    public class Messsage implements Serializable{
    int messageCode;
    Object payload;
    public class dataObject implements Serializable{
    int code;
    Object referenceObject;
    Object other refObject;
    The payload is
    Vector<Object> testPayload = new Vector<Object> ();
    testPayload.add(payloadDescriptionString);
    testPayload.add(datadataObject);
    msgCode =1;
    msg.payload = testPayload;
    I am trying to send a vector of different object types in a message through socket streams. I was able to send the Message object through sockets when I didn't set the payload to the vector. Now, I get a NotSerializableExcpetion. Are Vectors not serializable? Is it because my Object Vector has Objects of two or more class types like String and my class? In short what would make a class unserializable? What are the requirements for making it serializable? Any help would greatly appreciated.

    Just a footnote. I may have inadvertently solved my problem. I still don't understand it though. In the constructor of my dataObject I instantiated the object to a new object ie
    referenceObject = new Object();
    otherrefObject = new Object();
    Originally, I instantiated them so I could extend this class. I changed the code in the constructor to.
    referenceObject = null;
    otherrefObject = null;
    Serialization appears to be working now. Why does it not serializable in the first place?

  • How to copy objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution?

    I recently have bought a new Macbook Pro (Version 10.10.1) with the OS X Yosemite. The computer comes with the new Pages (version 5.5.1).
    Here is the problem: I like to create artwork using the shapes on Pages. Previously, on my old mac, I used Pages 4.3 to create objects, which I would copy then paste to Photoshop and it would become a vector smart object. However, in the new Pages (version 5.5.1), when I copy objects, they would appear on Photoshop as instead, a layer and it would not be in full resolution.
    Also, I know there is nothing wrong with the Pages file itself because I have converted the document to PDF form and it is high resolution when inserted into Photoshop that way.
    Does anyone know how I can copy individual objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution as I have done before?
    Thanks!

    ghotiz wrote:
    copy the image and have it in a high-quality PNG format that does not include the background from the Pages document.
    Oh, well if you don't actually need vector objects then it looks like this is possible. As I said earlier, Pages is putting a PNG on the clipboard. I tested it and it does paste into Photoshop as a transparent layer, because I can see the transparent background of the pasted PNG graphic if I either turn off all layers behind it in Photoshop, or if I start a new Photoshop document to paste into but make sure I choose Transparent for the Background Contents in the New Document dialog.

  • PS opens vector smart object all pixilated

    I have this problem when using graphics from Illustrator as vector smart objects in Photoshop. I have followed tones of heated discussions on this but I haven't got any further. So here is what I do following the steps on the PS help: I copy graphics in AI and paste them in PS as smart object. A layer will be added that even has the name vector smart object but the graphic itself is all pixilated. Now the size of my PS-file is 150X150 Pixels with a resolution of 300. I need this size because I want to implement the file into my website and the layout requires this size for all my graphics. I would say it doesn't matter much what size the file is anyway since according to the PS help whatever vector smart object I place in Photoshop it won't change image quality when transformed. Therefor I'd say that not even the small file should be a problem here. But obviously there is something not working... because even when, to compare, I paste the graphic as pixel it shows the same result. Strange enough that I have used this vector smart objects before and it worked just fine... So I tried to paste the graphic in different ways, saving it as pdf in AI and then placing it in PS, insert it directly as smart object, making sure the file handling and clipboard references are adjusted, and finally after no success trashing the preferences in both applications. Still not closer to a satisfying result. I attach the graphics (first the AI graphic, then the vector smart object from PS) to show the difference and maybe there is someone out there that can tell what I am doing wrong. By the way I just converted the files to jpegs to post them here so the sizes might not match on the screen...

    One other thing to check...
    Are you viewing the display at 100%?
    Photoshop's OpenGL-based image resizing algorithms are smoother and fuzzier than they used to be (or than they are with OpenGL disabled).  What I'm getting at is that you may be perceiving fuzziness in the display that's not really there in the image.
    How does the fuzziness look if you zoom in a lot?
    -Noel

  • Export a PDF and convert the vector-graphics to pixel-graphics

    Hey,
    i want to export a PDF out of indesign CS3 and convert all vector-graphics to pixel-graphics.
    Is there any solution, maybe a plugin, to do this?
    Thanks!!!!

    You could apply a transparency effect to your vector objects that doesn't effect their appearance and make a flattener preset which forces everything to rasters—then export a flattened PDF using that preset. Why do need rasters?

  • Using a vector graphic for a button

    Adobe Photoshop, Illustrator, and Encore CS5, everything is patched, Windows 7 64-bit
    I have been reading various posts, and either not seeing or not understanding something about using a vector graphic as a button on a menu.
    I drew a one-color shape in Illustrator, saved it as EPS and PNG and used it in a menu designed in Photoshop. When I preview it in Encore or burn a DVD, the graphic looks awful. And I'd like to use highlighting with it so it changes color when selected but that is another problem....
    To start the menu, I used the Photoshop preset NTSC DV Widescreen which has a pixel aspect ratio of 1.21. Then I added background graphics and so on. Each button is contained in a layer group named (+)PlayAll, etc. In each layer group is a text layer that doesn't have a prefix (e.g., Play All) and another layer with the vector or PNG named (=1)kv, which is the name of the EPS or PNG file.
    The behavior is fine. The graphic moves to indicate which menu item is selected, the text is constant, never changes.
    In Photoshop, the graphic looks fine but when I preview it in Encore it looks crappy and pixelated. What do I do?

    Part of the problem is I have no idea what some of these terms mean ... "2-bit indexed", ... The first one might mean an object that has one color,
    It is not the same as one color, and yes, it probably means more than any of us intend.  See  Encore help regarding button subpictures, in particular the part regarding using Photoshop to create button subpictures.
    The latter includes "(Technically, the subpicture overlay is a two‑bit indexed image.)," but you don't need to understand the technical meaning (they don't explain it anyway).  You do need to understand the liimitations they explain there,  For example, under "solid colors only," they say "Elements on these layers must use solid colors and sharp edges. Use one solid color per layer. Do not use gradients, feathering, or anti-aliasing on the subpicture layers. Color gradations are not possible in subpictures."
    "sub-picture highlight" ... the second one is probably made up.
    Heh, heh.  Searching that in Encore help (which I often find lacking) finds the page on Button Subpictures.  I agree that some of the terms, whether they are from the DVD specs or Sonic's applications (on which Encore is based), can make it difficult to look things up.
    "vector layer".... I searched Photoshop help for "vector layer" and got nothing. There is such a thing as a vector mask on a layer but I have no clue what a vector layer is.
    You're correct - vector mask.  Within a button group, the vector mask will be part of a layer, so I think of it as the button group "vector mask" layer.  That's part of why I pointed to using a library menu and editing in photoshop so you could compare what you have to what a template looks like.
    Please suggest which Encore library menu I can try. I opened a couple and couldn't figure out how they worked.
    In the General set, pick the Sunset menu.  Edit in Photoshop.  Expand the "(+) play movie" layer.  The "button vector mask" (the dark area) is in the layer called "button."  Notice that it does not have a (=1) or other indicator that it is a highlight.  In other words, it will just sit there, in whatever color is defined, and will not be a highlight.  If you put it in a layer that has one of the highlight indicators (the =1, =2 etc), it will then be subject to the subpicture highlight limitations.
    You might try your graphic in such a non-subpicture layer, and compare its appearance to putting it in a subpicture layer.
    Jeff Bellune's book (he's a moderator here) is still very applicable.  While some things have change, the basics haven't.
    But, hey, Jeff.  Why haven't you updated your book yet?  Inquiring minds want to know!

  • JHeadstart & (Scalable Vector) Graphics - From the AMIS JHeadstart Cookbook

    A picture can tell more than a thousand words. Adding meaningful graphics to our web-application can enhance the visual attractiveness s well as the functional effectiveness. Simple, data-drive graphics such as progress indicators, status ‘traffic lights’, gauge and speedometer like indicators can all represent data-values in a explicit, obvious way. Charts such as line-graphs, bar-charts and pie-charts facilitate quick interpretation of multiple values and trends.
    Using SVG in JHeadstart Applications - Scalable Vector Graphics are a technology for describing graphics in a structured, XML-based definition that can be rendered in browsers using a (free) plugin. Because of their XML-foundation, SVG objects can be generated by XML/XSL-T Transformations from dynamic datasources. That in turn makes it quite straightforward to generate graphics that are data-driven: the overall layout of the graphic is defined in an XSLT file while the dynamic data is fed into the SVG generation process in an XML document.
    In this recipe, we look at the use of SVG technology together with the JHeadstart architecture for incorporating data-driven graphics in our web-application. See: http://www.amis.nl/technology/Cookbook/Recipe%20for%20GeneratingSVGObjects.htm
    The Dutch Oracle partner AMIS has a 10-person JHeadstart team, currently involved in 4 JHeadstart-projects in The Netherlands. Their experiences and ideas are compiled in the AMIS JHeadstart Cookbook that is published on the internetsite (http://www.amis.nl) for other JHeadstart developers to share.
    I hope the recipes are of use to you.
    best regards,
    Lucas Jellema

    As a result of reorganizing (and re-providing) our website, some of the URLs stopped working. I apologize for any inconvencience.
    The JHeadstart Cookbook can now be found at: http://www.amis.nl/files/technology/Cookbook/AMISJHeadstartCookbook.htm and the Recipe on Generating SVG is located at: http://www.amis.nl/files/technology/Cookbook/RecipeforGeneratingSVGObjects.htm.
    Note that the AMIS Demo Application (AMIS Library System) created along with our Cookbook is now shipped as part of JHeadstart 9.0.5.1 to demonstrate the use of Oracle Toplink. This will make it easier for you all to apply our recipes - since you have the ALS application already available when using JHeadstart 9.0.5.1.
    best regards,
    Lucas Jellema, AMIS JHeadstart team

  • Working with labelled vector graphics (CS4)

    I've working with a rather large set of simple geometric vectors.
    They've all been created in illustrator, but need to be scaled in InDesign and flow with the text.
    The only method I've come up with is somewaht convoluted, so I thought I'd share and see if anyone had any suggestions on how I might improve the workflow.
    - vector graphic is pasted (not placed) into InDesign and ungrouped
    - strokes are converted (manually) to object styles (graphic styles created in illustrator are lost)
    - graphis is regrouped and roughly scaled
    - labels are added and paragraph styles applied
    - labels are grouped with graphic, cut, and "paste into" anched text box
    - re-scaling and label edits are done with select content/container/next object
    More complicated graphics will be linked and rescaled in illustrator and relabelled and placed as above.
    Is there a better/easier way to do this?
    (Maybe CS5 will have a container isolation mode...)

    I want to keep the labels out of illustrator, but there are a few graphics with more detail that percentage scaling is the way to go.
    It would be far easier if InDesign would respect (i.e. import, map) Illustrator's graphic styles.

  • Can Flash do true vector graphics?

    I created a drawing in Flash with the pen tool and paint
    bucket. Some of the drawing I may have used the line segment tool
    and connected the points. Other parts of the drawing I may have
    started with a circle, added points, and strecthed parts to make my
    desired shape. I exported the file to an .eps format.
    I want a drawing to be transcribed to a T-shirt.
    Unfortunately the two shops I've worked with know CorelDraw
    and not Flash. One lady knows Illustrator and I have also
    exported to an .ai format for Illustrator. However when
    they open those formats of my drawings come as individual
    vectors with outlines around each piece. They said they would have
    redraw the artwork in CorelDraw at a major expense. Can Flash do
    true vector graphics such that a drawing of a figure, for example,
    with many different colors so that the exported .eps or .ai file is
    a true vector graphic and not all in pieces? Or should I go with
    Illustrator CS3? I have used both programs and most of the drawing
    tools and methods seem to be the same, does Illustrator create true
    vector graphics?

    While your code might be correctly written, a 1009 error is not about incorrect code.  The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
    - is declared but not instantiated
    - doesn't have an instance name (or the instance name is mispelled)
    - does not exist in the frame where that code is trying to talk to it
    - is animated into place but is not assigned instance names in every keyframe for it
    - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
    If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

  • Printing graphics object in Landscape or portrait mode

    Hello,
    I have a graphics 2d object (a Tree Diagram) which is inside a JScrollPane,and the JSCrollPane is on a JPanel. it's length and width is more than one page. I am using a printable object to print the object. The task I need to do is,
    (1). compress the width and length of the diagram, so that if can fit into one page, else split the diagram into pages, so that each part of it can be printed on different pages(page size A4) and then later those pages can be merged accordingly.
    I am not able to find, how to split the graphic object(the tree diagram into pages), shoul d I try doing it using x and y co ordinate of the graphic object.

    * PrintUtilities.java
    * Created on January 17, 2007, 7:25 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package action.vector.bam;
    * @author serjith
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    /** A simple utility class that lets you very simply print
    * an arbitrary component. Just pass the component to the
    * PrintUtilities.printComponent. The component you want to
    * print doesn't need a print method and doesn't have to
    * implement any interface or do anything special at all.
    * <P>
    * If you are going to be printing many times, it is marginally more
    * efficient to first do the following:
    * <PRE>
    * PrintUtilities printHelper = new PrintUtilities(theComponent);
    * </PRE>
    * then later do printHelper.print(). But this is a very tiny
    * difference, so in most cases just do the simpler
    * PrintUtilities.printComponent(componentToBePrinted).
    * 7/99 Marty Hall, http://www.apl.jhu.edu/~hall/java/
    * May be freely used or adapted.
    public class PrintUtilities implements Printable {
    private Component componentToBePrinted;
    public static void printComponent(Component c) {
    new PrintUtilities(c).print();
    public PrintUtilities(Component componentToBePrinted) {
    this.componentToBePrinted = componentToBePrinted;
    public void print() {
    PrinterJob printJob = PrinterJob.getPrinterJob();
    PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
    PageFormat pgFormat = printJob.pageDialog(set);
    printJob.setPrintable(this,pgFormat);
    //printJob.setPrintable(this);
    if (printJob.printDialog())
    try {
    printJob.print();
    } catch(PrinterException pe) {
    System.out.println("Error printing: " + pe);
    public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
    if (pageIndex > 0) { // requires change since it is bigger than a single page
    return(NO_SUCH_PAGE);
    } else {
    Graphics2D g2d = (Graphics2D)g;
    g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    disableDoubleBuffering(componentToBePrinted);
    int W = componentToBePrinted.getWidth();
    int H = componentToBePrinted.getHeight();
    //Component newComp = componentToBePrinted.getGraphics().clipRect();
    System.out.println("WorkSpace Height "+H+" Width "+W);
    pageFormat.getHeight();
    pageFormat.getWidth();
    pageFormat.setOrientation(PageFormat.LANDSCAPE);
    //componentToBePrinted.paint(g2d);
    componentToBePrinted.printAll(g2d);//.paintAll(g2d);
    enableDoubleBuffering(componentToBePrinted);
    return(PAGE_EXISTS);
    /** The speed and quality of printing suffers dramatically if
    * any of the containers have double buffering turned on.
    * So this turns if off globally.
    * @see enableDoubleBuffering
    public static void disableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(false);
    /** Re-enables double buffering globally. */
    public static void enableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(true);
    =============================================================
    Please find this code, which I am trying to use, here I am passing the JPanel
    try{                   
    PrintUtilities.printComponent(actWorkSpace);
    }catch(Exception ex){
    ex.printStackTrace();
    the actWorkSpace is a JPanel with graphics as mentioned above, which is being passes to PrintUtilities.printComponent();
    the output is only just a single page with just a portion of the graphics on the JPanel, pls help...... it is urgent....

  • Vector graphics in DW

    Dear Friends,
    I would like to showcase some of my vector graphics on an
    html page built with DW. Can you pls advise if there is any format
    - other than rasterizing & optmizing the vector files - that I
    could use to load these vectors so that they could remain scalable
    - for viewing purposes, by means of something like zoomify - and
    retain their vector appearance?
    As usual, your advice is greatly appreciated.
    Jvmonteiro

    You could embed them in flash objects. SVG may be another
    option, but I'm not sure that the support is wide enough yet.
    http://www.adobe.com/svg/

  • Copying AICC vector smart objects to PSCC

    We just upgraded from CS6 to CC (yes I know we're a little behind the times). Our workflow relies on copy a lot of graphics from Illustrator into Photoshop as Vector Smart Objects. In CS when I copied an object to the clipboard and went to PS to open a new doc, it defaulted to RGB at 72dpi. If I changed it to 300dpi, clicked OK, closed the file and hit Cmd-N again, I would get a 300dpi document at the same dimensions as the object I copied from AI.
    This is not the case in CC. Hitting Cmd-N over and over just keeps generating a 72dpi RGB file.
    Sean

    I don't know - but what you describe is the clipboard overriding the last used settings in the new document dialog. So there is something on the clipboard that says it is 72 dpi.  Possibly Illustrator is placing a raster version of the artwork on the clipboard?

  • Vector Smart Object inside another smart object losing quality after scale

    Hi,
    I have 6 icons created on Illustrator and imported as vector smart objects.
    Then, I select all 6 and create another Smart Object from then.
    If I scale this smart object now, it will loose it´s quality, as if the icons were raster in the first place.
    This was not what happend in in PS CS5.
    It´s a bug or new "feature"?
    Rodrigo C.

    You need to realize that Photoshop renders pixels for the embedded object  then when you scale the smart object layer it scale like and raster layer through interpolation not scaled with vector graphics. Its the way smart object layers work. Hers is a very old thread on the subject
    smart objects pixelized | Adobe Community

  • Opening FWCS6 vector graphics in Adobe Illustrator

    Hi,
    I have 2 questions regarding vector graphics created in FW CS6. I have created some logos as vector graphics using the pen tool in FW CS6. The files are in png format.
    1.- Can I open them in Illustrator cc 2014 and save them as svg format?
    2.- Does Illustrator use the same technology as FW CS6 in order to create vector graphics? I mean .. Is it the same to use the pen tool in FWC6 as it is in Illustrator? I am not familiar with Illustrator.
    Thanks for your answer.

    When dealing with ai files, I will often import them as smart objects in
    Photoshop (embedded or linked if you have the latest version of PS CC) and use the roundtripping with Photoshop available in Captivate.
    That way I keep link with original AI-file, let CP convert the layer to PNG on importing.

  • Vector graphics

    Hi all,
    Have a bit of a problem here, I'm trying to create a vector graphic of this motif in Illustrator (CS5 Win 7) just can't figure it out. Tried using the pen tool but can't get one complete fill area like this image.
    I want to be able to have a gradient fill for all of the coloured area and maintain the open space in the centre as you see here, it's a bit of a curly one if you will pardon the pun.
    Any words of wisdom would be appreciated, thank you.

    gofer,
    You have to create two separate paths, for the outer and inner shapes, and you may Object>Compound Path>Make (or do it with one of the Pathfinders).
    The gradientlike appearance may be created in different ways.

Maybe you are looking for

  • Flash player installed in wrong folder?

    Ok I have this poker program that uses flash player to run, but the program cant seem to find flash play since in 64 bit windows it is installed in syswow64 file instead of sys32 file. Flash player works fine except with this one program. how can I p

  • My photo books in iPhoto are GONE

    I recently upgraded my operating system and this may be the problem.  I made 2 photo books in iPhoto, I have ordered them and jsut went back to order some more for fmaily/firends.  When you make photo books they save as I am sure you are aware.  The

  • How to resolve this weired JRE 1.8 Upgrade Error?

    **Below is the Java Console log from JRE 1.8.u45** *The applet fails to load and run itself*     basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@145fa52     basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter

  • Keine Erweiterungen in Photoshop?

    Moin, ich habe eben Adobe Exchange installiert. Leider sind in Photoshop immer noch die "Erweiterungen" ausgegraut. In Premiere beispielsweise funktionieren sie aber. Was mache ich falsch?? Grüße!

  • Problem in activating ODS

    Hello Friends, I have loaded data into New Table of ODS with out any Errors , When I tried to activate ODS,I am getting an error as below  ERROR : Main Process : Time limit exceeded. No return of the split processes Resource error. No batch process a