How is the rasterization function used to read a GDS file based on the C++ API?

I referred to the functions in klayout-master/src/layview/unit_tests/layLayoutViewTests.cc and wrote the following code, but I was unable to read the GDS file successfully. The error occurs in the Reader::Reader function in dbReader.cc (throw db::ReaderUnknownFormatException (tl::to_string (tr ("Stream has unknown format: ")) + stream.source (), head, has_more);)

lay::LayoutView lv(0, false, 0);
lv.set_drawing_workers(2);
lv.cell_box_color(tl::Color(0, 0, 0));

lv.load_layout("D:/vs2017/klayout/build/collect_basic_bg.gds", true);

tl::PixelBuffer img;
img = lv.get_pixels_with_options(500, 500, 1, 1, 1.0, 1.0, tl::Color(255, 255, 255), tl::Color(0, 0, 0), tl::Color(128, 128, 128), db::DBox());

Comments

  • edited January 11

    Hi @leo_cy,

    I don't know what's in your file, so I can't say. The problem may also due to issues when the core tries to locate the stream reader plugins. Building the C++ system is not straightforward. You have to use the build script to do things properly.

    I intentionally don't give support on C++ level. The code is "as is" and the API is very likely to change. Please also note that using C++ API has license implications - the GPL requires you to license all derived code under GPL as well.

    Matthias

  • Hi @Matthias
    Thank you! I am just learning about and understanding the test units in the code, but I still cannot grasp the overall logic of the code. If I end up using it, I will comply with the GPL and open source the code.

Sign In or Register to comment.