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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Chrupiter

Pages: [1]
1
Graphics / Re: Scale an image, what's wrong in this code?
« on: May 11, 2015, 06:59:50 pm »
I'll explain my situation. I've set a view(28x28) on a window(200x200).
In an image(28x28) I draw with the mouse.
Then I convert the image into a matrix of int, with 1 and 0(black and white).
What I fear is that by converting coordinates like this:
Code: [Select]
matrix[(int)posX*0.8][(int)posY*0.8]
I might lose too much quality

2
Graphics / Scale an image, what's wrong in this code?
« on: May 11, 2015, 06:25:02 pm »
So I want to scale an image, but the problem is that only sprites have a function for that.
I need to use the function getPixel from the resulting image, but I don't know how to convert the scaled sprite to an image.

I'd try something like this:

Code: [Select]
sf::Texture texture;
texture.loadFromImage(image);
sf::Sprite sprite;
sprite.setTexture(texture, true);
sprite.scale(0.5,0.5);
//backward
texture=sprite.getTexture(); //this isn't accepted by the compiler
image=texture.copyToImage();

3
General / Re: AW: Can I do this on a pc without OpenGL?
« on: May 06, 2015, 06:31:42 pm »
What OS do these PC run, because I doubt you have no OpenGL available.
Computers have win8 installed, but teachers never cared to check OpenGL drivers, they actually like it this way so that students can't play games.
The error is like "An internal OpenGL call failed in Texture.cpp".

4
General / Can I do this on a pc without OpenGL?
« on: May 06, 2015, 05:46:23 pm »
I'm preparing a school project, in this project I use sfml to draw with the mouse (like paint) on a 200x200 window, the problem is that school's computers don't have OpenGL, is it possible to do what I want to without it?

5
General / Re: Draw in a 200x200 display which actually is 32x32
« on: April 19, 2015, 09:49:45 pm »
It worked, thanks. I had already tried that but it didn't work, now it does.

6
General / Re: Draw in a 200x200 display which actually is 32x32
« on: April 19, 2015, 06:58:02 pm »
I can't fix this. Even if I set the view, I can't draw correctly in it.
This is what happens to me:
(click to show/hide)
I draw where the mouse is, and the result on the view is not where i'd like it to be. It still gets my mouse coordinates from the 32x32 image on the top-left.

7
General / Re: Draw in a 200x200 display which actually is 32x32
« on: April 19, 2015, 06:29:40 pm »
SFML doesn't crash when you draw outside the view. You do something else wrong.

It crashes because I draw outside the image like this:
Code: [Select]
//given image of 32x32
image.setPixel(mouse.x,mouse.y, color);

when x or y are bigger than 32 it crashes. Anyway, I'll try what you said, thanks.

8
General / [SOLVED]Draw in a 200x200 display which actually is 32x32
« on: April 19, 2015, 06:15:09 pm »
Here's the issue.
I've an image of 32x32 pixels on which I can draw. But drawing in such a small window is really hard.
So I want this image to be displayed as a 200x200 image, but actually it must be 32x32.
For example, if you in Paint create a new image 32x32, then you zoom in, you get what I'm talking about.
But I don't wanna zoom in dynamically, I want it to be fixed 200x200, so that I'll still be able to export the image in 32x32.
I found the class view, but it allows me only to see a region zoomed, then when i try to draw the program crashes because it's as if i were drawing outside the image.
Thanks.

Pages: [1]
anything