Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Masking sprites.  (Read 3286 times)

0 Members and 1 Guest are viewing this topic.

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Masking sprites.
« on: September 15, 2009, 11:18:37 pm »
As topic, here is something like that? I really must use blending?

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Masking sprites.
« Reply #1 on: September 16, 2009, 06:53:25 am »
Are you speaking about transparent colors ? Yes, there are some :
- sf::Image : CreateMaskFromColor
- use an image with transparency
Mindiell
----

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Masking sprites.
« Reply #2 on: September 16, 2009, 08:37:00 am »
Thanks, blending is very hard for me(mask can make with paint) :>

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
Masking sprites.
« Reply #3 on: September 16, 2009, 10:20:30 am »
I would recommend using pngs with alpha blending ;) With masking you can get artifacts and no semi-transparency.
Listen to my band: pencilcase.bandcamp.com

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Masking sprites.
« Reply #4 on: September 16, 2009, 09:27:37 pm »
I have 2 more questions:
1. Is possible to make textured shapes
2. I can make hmm. Change palette of sprite? Ex. add to sprite +10 to red color(but w/o image manipulation); what will do void sf::Drawable::SetColor?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Masking sprites.
« Reply #5 on: September 16, 2009, 09:30:14 pm »
1. No

2. Yes, using Drawable::SetColor. The drawable's color is then modulated (multiplied) with the image's pixels.
So, actually you won't be able to add 10 to the red component directly. To achieve that you would have to draw a transparent red rectangle over the sprite, with Blend::Add as the blending mode.
Laurent Gomila - SFML developer

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Masking sprites.
« Reply #6 on: September 16, 2009, 10:20:45 pm »
So here's no way to get textured polygons like Soldat? hmm so...
But what u mean with sprites? Ex. Color(200, 255, 255) will change red(255) in image to 200?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Masking sprites.
« Reply #7 on: September 16, 2009, 11:14:50 pm »
Quote
But what u mean with sprites? Ex. Color(200, 255, 255) will change red(255) in image to 200?

Basically, yes.
Laurent Gomila - SFML developer

 

anything