Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Michael Van Canneyt


On Mon, 27 Oct 2008, Luiz Americo Pereira Camara wrote:

> Michael Van Canneyt escreveu:
> > All I need is to display a text at a 90° angle. Since GTK 1 doesn't
> > support rotated text (hint hint), I draw the text on a bitmap, rotate 
> > that 90 degrees and display the bitmap, when I detect GTK1 as a widget 
> > set :-)
> >   
> 
> 
> Take a look at the unit i pointed. It has a class that does specifically 
> this.

Indeed it does. Thanks for the hint. 

I'll use my implementation since it uses the built-in rotated font if available.
(and it was ready anyway :-) )

Michael.___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Luiz Americo Pereira Camara
Michael Van Canneyt escreveu:
> All I need is to display a text at a 90° angle. Since GTK 1 doesn't
> support rotated text (hint hint), I draw the text on a bitmap, rotate 
> that 90 degrees and display the bitmap, when I detect GTK1 as a widget 
> set :-)
>   


Take a look at the unit i pointed. It has a class that does specifically 
this.

Luiz

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Michael Van Canneyt


On Mon, 27 Oct 2008, Reenen Laurie wrote:

> I had a similar problem... Eventually I moved on to GLscene...
> 
> Though obviously it's probably not at all what you want to do, but it's
> pretty easy to rotate things there. :-)
> 
> obj.rollangle := obj.rollangle + 90;
> 
> You can use an orthogonal camera if you don't want / need the perspective.
> 
> You can even let it "slowly" rotate using a cadencer, but let's not jump the
> gun here.

All I need is to display a text at a 90° angle. Since GTK 1 doesn't
support rotated text (hint hint), I draw the text on a bitmap, rotate 
that 90 degrees and display the bitmap, when I detect GTK1 as a widget 
set :-)

Requiring OpenGL for this would be slightly over the top, I'm sure you'll agree 
:-)

Michael.___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Reenen Laurie
I had a similar problem... Eventually I moved on to GLscene...

Though obviously it's probably not at all what you want to do, but it's
pretty easy to rotate things there. :-)

obj.rollangle := obj.rollangle + 90;

You can use an orthogonal camera if you don't want / need the perspective.

You can even let it "slowly" rotate using a cadencer, but let's not jump the
gun here.

Regards,
-Reenen

2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>

>
>
> On Mon, 27 Oct 2008, Vincent Snijders wrote:
>
> > 2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>:
> > > Hi,
> > >
> > > How can I rotate a bitmap 90° counterclockwise ?
> > >
> > > Alternatively, how can I read/write the pixels in the bitmap ?
> > > I found ReadChannels/WriteChannels from RawImage, but they
> > > use a strange kind of position object which I don't understand :(
> >
> > Maybe the lazintf example
> > (http://svn.freepascal.org/svn/lazarus/trunk/examples/lazintfimage/)
> > can help. It rotates an image.
>
> Exactly what I needed. TLazIntfImage is the missing link :-)
>
> Thanks to everyone for the links !
>
> Michael.
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>


-- 
o__
,_.>/ _
(_)_\(_)___
...speed is good
___
I believe five out of four people have a problem with fractions.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Michael Van Canneyt


On Mon, 27 Oct 2008, Vincent Snijders wrote:

> 2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>:
> > Hi,
> >
> > How can I rotate a bitmap 90° counterclockwise ?
> >
> > Alternatively, how can I read/write the pixels in the bitmap ?
> > I found ReadChannels/WriteChannels from RawImage, but they
> > use a strange kind of position object which I don't understand :(
> 
> Maybe the lazintf example
> (http://svn.freepascal.org/svn/lazarus/trunk/examples/lazintfimage/)
> can help. It rotates an image.

Exactly what I needed. TLazIntfImage is the missing link :-)

Thanks to everyone for the links ! 

Michael.___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Michael Van Canneyt


On Mon, 27 Oct 2008, Graeme Geldenhuys wrote:

> 2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>:
> > Hi,
> >
> > How can I rotate a bitmap 90° counterclockwise ?
> 
> 
> To save you the trouble... :-)
> 
> http://www.efg2.com/Lab/ImageProcessing/RotateScanline.htm
> http://www.delphi-central.com/tutorials/RotateBitmapBitBlt.aspx
> http://delphi.about.com/cs/adptips2001/a/bltip1201_4.htm

Thank you, but I already saw those prior to asking my questions.
None of the techniques described there work in Lazarus.

Michael.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Vincent Snijders
2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>:
> Hi,
>
> How can I rotate a bitmap 90° counterclockwise ?
>
> Alternatively, how can I read/write the pixels in the bitmap ?
> I found ReadChannels/WriteChannels from RawImage, but they
> use a strange kind of position object which I don't understand :(

Maybe the lazintf example
(http://svn.freepascal.org/svn/lazarus/trunk/examples/lazintfimage/)
can help. It rotates an image.

Vincent

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Vincent Snijders
2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>:
> Hi,
>
> How can I rotate a bitmap 90° counterclockwise ?
>
> Alternatively, how can I read/write the pixels in the bitmap ?
> I found ReadChannels/WriteChannels from RawImage, but they
> use a strange kind of position object which I don't understand :(
>
> (an alternate answer is to implement rotated fonts in GTK1 ;))
>
> Michael.
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Graeme Geldenhuys
2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>:
> Hi,
>
> How can I rotate a bitmap 90° counterclockwise ?

Wouldn't a rotation matrix do the trick?  I remember the old fpGUI
code (gfxbase.pas) unit used a 3x3 matrix to do translations and
scalations calculations. I would imagine the same could be applied for
rotation.

Wikipedia has some articles on rotation matrix, but the formulas look
scary.  ;-)  Google revealed a lot of links on rotation matrix.


> Alternatively, how can I read/write the pixels in the bitmap ?

The TFPCustomCanvas.Colors[] array?



Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotating a bitmap

2008-10-27 Thread Graeme Geldenhuys
2008/10/27 Michael Van Canneyt <[EMAIL PROTECTED]>:
> Hi,
>
> How can I rotate a bitmap 90° counterclockwise ?


To save you the trouble... :-)

http://www.efg2.com/Lab/ImageProcessing/RotateScanline.htm
http://www.delphi-central.com/tutorials/RotateBitmapBitBlt.aspx
http://delphi.about.com/cs/adptips2001/a/bltip1201_4.htm



Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Rotating a bitmap

2008-10-27 Thread Michael Van Canneyt
Hi,

How can I rotate a bitmap 90° counterclockwise ?

Alternatively, how can I read/write the pixels in the bitmap ?
I found ReadChannels/WriteChannels from RawImage, but they 
use a strange kind of position object which I don't understand :(

(an alternate answer is to implement rotated fonts in GTK1 ;))

Michael.___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus