MCPcopy Create free account
hub / github.com/KLayout/klayout / get_bitmaps

Method get_bitmaps

src/laybasic/laybasic/layMarker.cc:305–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void
306MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay::CanvasPlane *&fill, lay::CanvasPlane *&contour, lay::CanvasPlane *&vertex, lay::CanvasPlane *&text)
307{
308 double resolution = canvas.resolution ();
309 int basic_width = int(0.5 + 1.0 / resolution);
310
311 // obtain bitmaps
312 tl::Color color = m_color;
313 if (! color.is_valid ()) {
314 color = mp_view->default_marker_color ();
315 }
316 if (! color.is_valid ()) {
317 color = canvas.foreground_color ();
318 }
319
320 tl::Color frame_color = m_frame_color;
321 if (! frame_color.is_valid ()) {
322 frame_color = color;
323 }
324
325 int line_width = m_line_width < 0 ? mp_view->default_marker_line_width () : m_line_width;
326 int vertex_size = m_vertex_size < 0 ? mp_view->default_marker_vertex_size () : m_vertex_size;
327 bool halo = m_halo < 0 ? mp_view->default_marker_halo () : (m_halo != 0);
328 int dither_pattern = m_dither_pattern < 0 ? mp_view->default_dither_pattern () : m_dither_pattern;
329 int line_style = m_line_style < 0 ? mp_view->default_line_style () : m_line_style;
330
331 if (halo) {
332
333 std::vector <lay::ViewOp> ops;
334 ops.resize (2);
335
336 if (dither_pattern >= 0) {
337 ops[0] = lay::ViewOp (canvas.background_color ().rgb (), lay::ViewOp::Copy, 0, (unsigned int) dither_pattern, 0, lay::ViewOp::Rect, 3 * basic_width, 0);
338 ops[1] = lay::ViewOp (color.rgb (), lay::ViewOp::Copy, 0, (unsigned int) dither_pattern, 0, lay::ViewOp::Rect, basic_width, 1);
339 fill = canvas.plane (ops);
340 } else {
341 fill = 0;
342 }
343
344 ops[0] = lay::ViewOp (canvas.background_color ().rgb (), lay::ViewOp::Copy, (unsigned int) line_style, (unsigned int) m_frame_pattern, 0, lay::ViewOp::Rect, line_width > 0 ? (line_width + 2) * basic_width : 0, 0);
345 ops[1] = lay::ViewOp (frame_color.rgb (), lay::ViewOp::Copy, (unsigned int) line_style, (unsigned int) m_frame_pattern, 0, lay::ViewOp::Rect, line_width * basic_width, 1);
346 contour = canvas.plane (ops);
347
348 if (! m_text_enabled) {
349 text = 0;
350 } else if (line_width == 1) {
351 text = contour;
352 } else {
353 ops[0] = lay::ViewOp (canvas.background_color ().rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, 3 * basic_width, 0);
354 ops[1] = lay::ViewOp (frame_color.rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, basic_width, 1);
355 text = canvas.plane (ops);
356 }
357
358 if (m_vertex_shape == lay::ViewOp::Rect) {
359 ops[0] = lay::ViewOp (canvas.background_color ().rgb (), lay::ViewOp::Copy, 0, 0, 0, m_vertex_shape, vertex_size > 0 ? (vertex_size + 2) * basic_width : 0, 0);
360 ops[1] = lay::ViewOp (frame_color.rgb (), lay::ViewOp::Copy, 0, 0, 0, m_vertex_shape, vertex_size * basic_width, 1);
361 vertex = canvas.plane (ops);
362 } else {

Callers

nothing calls this directly

Calls 6

planeMethod · 0.80
resolutionMethod · 0.45
is_validMethod · 0.45
foreground_colorMethod · 0.45
resizeMethod · 0.45
background_colorMethod · 0.45

Tested by

no test coverage detected