MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / drawColorSeparation

Method drawColorSeparation

src/core/renderables/renderable.cpp:418–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418void MapRenderables::drawColorSeparation(QPainter* painter, const RenderConfig& config, const MapColor* separation, bool use_color) const
419{
420 painter->save();
421
422 const QPainterPath initial_clip(painter->clipPath());
423 const QPainterPath* current_clip = nullptr;
424
425 // As soon as the spot color is actually used for drawing (i.e. drawing_started = true),
426 // we need to take care of knockouts.
427 bool drawing_started = false;
428
429 // For each pair of color priority and its renderables collection...
430 auto end_of_colors = rend();
431 auto color = rbegin();
432 while (color != end_of_colors && color->first >= map->getNumColors())
433 {
434 ++color;
435 }
436 for (; color != end_of_colors; ++color)
437 {
438 SpotColorComponent drawing_color(map->getColor(color->first), 1.0f);
439
440 // Check whether the current color [priority] applies to the current separation.
441 if (color->first > MapColor::Reserved)
442 {
443 if (separation->getPriority() == MapColor::Reserved)
444 {
445 // Don't process regular colors for the "Reserved" separation.
446 continue;
447 }
448
449 switch (drawing_color.spot_color->getSpotColorMethod())
450 {
451 case MapColor::UndefinedMethod:
452 continue;
453
454 case MapColor::SpotColor:
455 if (drawing_color.spot_color == separation)
456 {
457 ; // okay
458 }
459 else if (drawing_started && drawing_color.spot_color->getKnockout())
460 {
461 drawing_color.factor = 0.0f;
462 }
463 else
464 {
465 continue;
466 }
467 break;
468
469 case MapColor::CustomColor:
470 {
471 // First, check if the renderables draw color to this separation
472 // TODO: Use an efficient data structure to avoid reiterating each time a separation is drawn
473 const SpotColorComponents& components = drawing_color.spot_color->getComponents();
474 for (const auto& component : components)
475 {

Callers

nothing calls this directly

Calls 14

SpotColorComponentClass · 0.85
getNumColorsMethod · 0.80
getPriorityMethod · 0.80
getSpotColorMethodMethod · 0.80
getKnockoutMethod · 0.80
testFlagMethod · 0.80
isHelperSymbolMethod · 0.80
isHiddenMethod · 0.80
intersectsMethod · 0.80
activateMethod · 0.80
renderMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected