/** Auxiliary function for all Test Cases This method returns a TRgb colour which is a lighter tone of colour aColor. */ TRgb CSimpleControl::LightRgb(TRgb aColor) const { TInt value = aColor.Value(); TInt r = Min(255,((value & 0x000000ff) ) + 30); TInt g = Min(255,((value & 0x0000ff00) >> 8) + 30); TInt b = Min(255,((value & 0x00ff0000) >> 16) + 30); return TRgb(r,g,b); }
/** Auxiliary function for all Test Cases This method returns a TRgb colour which is a darker tone of colour aColor. */ TRgb CSimpleControl::DarkRgb(TRgb aColor) const { TInt value = aColor.Value(); TInt r = Max(0,((value & 0x000000ff) ) - 85); TInt g = Max(0,((value & 0x0000ff00) >> 8) - 85); TInt b = Max(0,((value & 0x00ff0000) >> 16) - 85); return TRgb(r,g,b); }
CGameSpriteFrame::CGameSpriteFrame(const TFileName& filename, TUint32 id, const CGameRect& r, CFbsBitmap* loader){ loader->Load(filename, id, 0); TInt i,j; TInt h = loader->SizeInPixels().iHeight; TInt w = loader->SizeInPixels().iWidth; h = (h<r.h)?h:r.h; w = (w<r.w)?w:r.w; TInt H = minor2Pot(h); TInt W = minor2Pot(w); if(H>W)W=H; else H=W; this->texDim = H; TRgb color; TPoint point; this->pixels = new TUint32[W*H]; for(i=0;i<w;i++){ for(j=0;j<h;j++){ point.SetXY(i,j); loader->GetPixel(color,point); this->pixels[i+j*W] = color.Value(); } } glGenTextures(1, &(this->texId)); glBindTexture(GL_TEXTURE_2D, this->texId); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); GLint format = GL_RGBA; glTexImage2D(GL_TEXTURE_2D, 0, format, W, H, 0, format, GL_UNSIGNED_BYTE, this->pixels); }