Skip to content
ExamplesOpen editor ↗

seeloSaMotswako

→ blendMode()

Sets the way a new colour combines with what is already on the canvas.

seeloSaMotswako(mokgwa) | seeloSaMotswako()

By default, drawing a shape puts its colour on top of whatever was there. seeloSaMotswako changes that rule: it decides how the new colour and the existing colour are worked out together, pixel by pixel, channel by channel — red with red, green with green, blue with blue.

The available modes are MOTSWAKO (the default), TLHAKANYA, LEFIFI, LESEDI, PHAROLOGANO, EXCLUSION, ATISA, SCREEN, EMISETSA, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN and TLOSA.

It asks as well as tells. Called with nothing — seeloSaMotswako() — it returns the mode in force right now, like seeloSaSekhutlo.

It throws on a word it does not know. This is unlike seeloSaKhutlonne and its siblings, which silently do nothing: seeloSaMotswako('banana') throws “Mode banana not recognized”. Throwing is the better behaviour, and it is stated here because it differs from the rest of the family.

NameTypeDescription
mokgwa (optional)tlhomamengThe blend mode — MOTSWAKO, ATISA, PHAROLOGANO and the rest.
Three circles multiplying into each other
tiro setaLoeto() {
  thalaKanefase(400, 260);
  bokamorago(255);
  tlogelaMothalo();

  seeloSaMotswako(ATISA);

  tlatsaMmala(255, 80, 80);
  thalaSediko(160, 120, 150);
  tlatsaMmala(80, 200, 120);
  thalaSediko(240, 120, 150);
  tlatsaMmala(90, 130, 255);
  thalaSediko(200, 190, 150);

  seeloSaMotswako(MOTSWAKO);
  tlhalosa('Didiko tse tharo — tse dikhibidu, tse ditala le tse di botala jwa loapi — tse di atisanang mo dikarolong tse di kopanang, mme mebala e nna lefifi teng.');
}

MOTSWAKO, ATISA, PHAROLOGANO, TLOSA, seeloSaMmala