4
我完全在這個問題上難住,它應該是如此簡單,它使我瘋狂。梯度方向從左到右
我正在使用這個蘋果反射教程。
他們有圖像梯度從上到下顯示出來。
- 我怎樣才能使一個梯度從左至右
- 我怎麼能水平翻轉圖像。在他們的例子中,他們垂直翻轉圖像。
有幫助嗎?
//The gradient code is here but I don't know what should be the gradient start/end points
CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh)
{
.....
gradientStartPoint = CGPointZero;
gradientEndPoint = CGPointMake(0, pixelsHigh);
}
//similarly I know the image flip happens here but for life of me I cannot make it flip horizontally
- (UIImage *)reflectedImage:(UIImageView *)fromImage withHeight:(NSUInteger)height
{
.....
CGContextTranslateCTM(mainViewContentContext, 0.0, height);
CGContextScaleCTM(mainViewContentContext, 1.0, -1.0);
}
感謝您的代碼。水平翻轉完美地工作,但從左到右的梯度不起作用。它顯示了圖像上的漸變,而不是從中間的某個地方開始,一直走到正確的位置 –
ok,正在工作 – LuisEspinoza
我在我的帖子中附加了一個圖像,當我輸入漸變gradientStartPoint = CGPointZero; gradientEndPoint = CGPointMake(pixelsWide,0); –