1
General chat / Re: Comercial software for free
« on: February 05, 2010 »
This offer is not available in your country.
US.
Still a great thread though.
SB
US.Still a great thread though.
SB
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.
US.void drawRotatedStar(buffer &buf, int centerX, int centerY, int radius, double angle, int rgb) {
line line1;
line line2;
line line3;
line line4;
line line5;
double matrix[2][2]; //Matrix of 2 * 2
double radians = angle*(PI/180);
matrix[0][0] = cos(angle);
matrix[1][0] = -sin(angle);
matrix[0][1] = sin(angle);
matrix[1][1] = cos(angle);
int oldX, oldY;
//Create our Stars
line1.x1 = centerX;
line1.y1 = centerY + radius;
line1.x2 = (centerX + sin(4*PI/5) * radius);
line1.y2 = (centerY + cos(4*PI/5) * radius);
line2.x1 = (centerX + sin(4*PI/5) * radius);
line2.y1 = (centerY + cos(4*PI/5) * radius);
line2.x2 = (centerX + sin(8*PI/5) * radius);
line2.y2 = (centerY + cos(8*PI/5) * radius);
line3.x1 = (centerX + sin(8*PI/5) * radius);
line3.y1 = (centerY + cos(8*PI/5) * radius);
line3.x2 = (centerX + sin(2*PI/5) * radius);
line3.y2 = (centerY + cos(2*PI/5) * radius);
line4.x1 = (centerX + sin(2*PI/5) * radius);
line4.y1 = (centerY + cos(2*PI/5) * radius);
line4.x2 = (centerX + sin(6*PI/5) * radius);
line4.y2 = (centerY + cos(6*PI/5) * radius);
line5.x1 = (centerX + sin(6*PI/5) * radius);
line5.y1 = (centerY + cos(6*PI/5) * radius);
line5.x2 = centerX;
line5.y2 = centerY + radius;
//Rotate our stars
oldX = line1.x1;
oldY = line1.y1;
line1.x1 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line1.y1 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line1.x2;
oldY = line1.y2;
line1.x2 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line1.y2 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line2.x1;
oldY = line2.y1;
line2.x1 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line2.y1 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line2.x2;
oldY = line2.y2;
line2.x2 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line2.y2 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line3.x1;
oldY = line3.y1;
line3.x1 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line3.y1 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line3.x2;
oldY = line3.y2;
line3.x2 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line3.y2 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line4.x2;
oldY = line4.y2;
line4.x2 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line4.y2 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line4.x1;
oldY = line4.y1;
line4.x1 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line4.y1 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line5.x1;
oldY = line5.y1;
line5.x1 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line5.y1 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
oldX = line5.x2;
oldY = line5.y2;
line5.x2 = (oldX * matrix[0][0]) + (oldY * matrix[0][1]) + centerX;
line5.y2 = (oldX * matrix[1][0]) + (oldY * matrix[1][1]) + centerY;
//Draw our stars
drawLine(buf, line1.x1, line1.x2, line1.y1, line1.y2, rgb);
drawLine(buf, line2.x1, line2.x2, line2.y1, line2.y2, rgb);
drawLine(buf, line3.x1, line3.x2, line3.y1, line3.y2, rgb);
drawLine(buf, line4.x1, line4.x2, line4.y1, line4.y2, rgb);
drawLine(buf, line5.x1, line5.x2, line5.y1, line5.y2, rgb);
}
bool loadPNG( std::string filename, int & width, int & height, int &bitdepth, vector<Pixel> & pixels){
unsigned int index = 0;
unsigned char *data = stbi_load((char *)filename.c_str(), &width, &height, &bitdepth, 0);
if (!data) return false;
// convert 24 bit image pixels to floating point color
pixels.resize( width * height );
for ( int y = 0; y < height; ++y )
{
for ( int x = 0; x < width; ++x )
{
Pixel & pixel = pixels[index];
pixel.r = data[index*3+0] * 1.0f / 255.0f;
pixel.g = data[index*3+1] * 1.0f / 255.0f;
pixel.b = data[index*3+2] * 1.0f / 255.0f;
pixel.a = data[index*3+3] * 1.0f / 255.0f;
++index;
}
}
return true;
}
And thank you for the welcome back.....
) of it all.