Well, these days I was trying to made (parting froms a part of e MACL Library method) a Script for Skew (i´m not sure if that´s the correct word, in spanish is "Sesgar") a Picture. Is the trasnformation to made, for example, a mode7.
And I did this:
As you can see, it´s a simple modification of the "Flip" method.
n is how much the image is skewed.
The problem is that, althougt I made wider the Sesgado Bitmap, (coz when the pictures is skewed, it becomes wider)
sesgado = Bitmap.new(width * n, height)
it doesen´t work. And its size remains with the original picture size.
So, the image is skewed, but cut.
I hope someone can help me.
And I did this:
Code:
def sesgar_horizontal!(n)
sesgado = Bitmap.new(width * n, height)
flip_rect = Rect.new(0, 0, width, 1)
height.times do |i|
flip_rect.y = i
sesgado.blt((i * (n/2)).to_i, i, self, flip_rect)
end
clear
blt(0, 0, sesgado, rect)
flipped.dispose
end
As you can see, it´s a simple modification of the "Flip" method.
n is how much the image is skewed.
The problem is that, althougt I made wider the Sesgado Bitmap, (coz when the pictures is skewed, it becomes wider)
sesgado = Bitmap.new(width * n, height)
it doesen´t work. And its size remains with the original picture size.
So, the image is skewed, but cut.
I hope someone can help me.