Просмотр исходного кода

Changed the Image::fill interface

It uses a color now, not 4 ints defining a color.
cib 12 лет назад
Родитель
Сommit
decbf1e0ef

+ 3 - 6
Core/Contents/Include/PolyImage.h

@@ -105,15 +105,12 @@ namespace Polycode {
 			* @param height Height of the image to create.			
 			*/ 						
 			void createEmpty(int width, int height);
-			
+
 			/**
 			* Fills the image with the specified color values.
-			* @param r Red value 0-1.
-			* @param g Green value 0-1
-			* @param b Blue value 0-1
-			* @param a Alpha value 0-1									
+			* @param color The color to fill it with.
 			*/ 									
-			void fill(Number r, Number g, Number b, Number a);
+			void fill(Color color);
 			
 			/**
 			* Sets a pixel at specified coordinates to specified color.

+ 2 - 3
Core/Contents/Source/PolyImage.cpp

@@ -174,7 +174,7 @@ void Image::createEmpty(int width, int height) {
 	this->width = width;
 	this->height = height;
 	
-	fill(0,0,0,0);
+	fill(Color(0,0,0,0));
 }
 
 void Image::perlinNoise(int seed, bool alpha) {
@@ -653,8 +653,7 @@ void Image::drawLine(int x0, int y0, int x1, int y1, Color col) {
 	}
 }
 
-void Image::fill(Number r, Number g, Number b, Number a) {
-	Color color = Color(r,g,b,a);
+void Image::fill(Color color) {
 	unsigned int val = color.getUint();
 	unsigned int *imageData32 = (unsigned int*) imageData;
 	for(int i=0; i< width*height; i++) {

+ 1 - 1
Core/Contents/Source/PolyMaterialManager.cpp

@@ -130,7 +130,7 @@ Texture *MaterialManager::createFramebufferTexture(int width, int height, int ty
 
 Texture *MaterialManager::createNewTexture(int width, int height, bool clamp, bool createMipmaps, int type) {
 	Image *newImage = new Image(width, height, type);
-	newImage->fill(1,1,1,1);
+	newImage->fill(Color(1,1,1,1));
 	Texture *retTexture = createTextureFromImage(newImage, clamp, createMipmaps);
 	delete newImage;
 	return retTexture;