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

Author Topic: Unify the images functions?  (Read 1456 times)

0 Members and 1 Guest are viewing this topic.

DevDavisNunez

  • Newbie
  • *
  • Posts: 1
    • View Profile
Unify the images functions?
« on: July 18, 2016, 04:14:59 am »
Hi good day!

I have been working for several weeks with SFML,

Everything is going great, I should mention, but I found inconvenient,

I require work almost all the features available in modules, sprites, texture, image, and according eh tested and researched, it is not convenient to be moving from one format to another in each cycle :P

Someone knows somehow that I can help unify formats?

For example in the sprite, I can do "smooth" I can access the pixels, also can apply effects "flip, vertical and horizontal" Knowing the size in pixels, and can scale the size.

Someone could help me or direct me?

Regards!

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: Unify the images functions?
« Reply #1 on: July 18, 2016, 05:16:11 am »
You should know that sf::Texture is not sf::Image .

sf::Texture is an OpenGL resource.
sf::Image is a matrix of uint8 (0~255) type.

If you need this functionality you can create a custom class with, Texture and Image, then define your owns methods.

Defines a method that whenever the image is modified the texture is (re)-loaded.

All drawables using the texture will be updated too if the texture is changed.
I would like a spanish/latin community...
Problems building for Android? Look here

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Unify the images functions?
« Reply #2 on: July 18, 2016, 02:51:04 pm »
it is not convenient to be moving from one format to another in each cycle :P
Which ones are you moving amongst in each cycle? Are you moving backwards and forwards from image and texture? If so, why, what are you trying to achieve?

For example in the sprite, I can do "smooth" I can access the pixels, also can apply effects "flip, vertical and horizontal" Knowing the size in pixels, and can scale the size.
You can't actually add smooth to a sprite but you can add smooth to the texture that it uses - a sprite is a just a way of stating how a texture (or part of a texture) should be displayed.
Flips are simple by setting the scale to negative values or setting the texture rectangle to negative sizes.
Scaling to a specific pixel size can be done by calculating the ratio of scale that you need (target size / original size).
Setting the scale using a target size can be useful sometimes and is why I included it in Selba Ward's Gallery Sprite  ;)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*