1. Graph Control and vertical text

I just submitted my new Graph control to The Archive. It uses
Win32Lib's custom control interface. I believe it's the first of its
kind, aside from GroupAdv. Also the first graphing control for
Euphoria period.

It currently only supports vertical graphs, since I've come across a
bit of a problem. How does one draw text vertically? I haven't found a
flag for drawText() that I can use or any other routine for drawing
text vertically. I was thinking I could draw it to a Pixmap, rotate
the Pixmap and draw that to the screen, but I'd like to do it in one
call, and avoid using the Pixmap buffer. If no such routine/flag
exists, the I'll go my Pixmap/rotate route.

~Greg

new topic     » topic index » view message » categorize

2. Re: Graph Control and vertical text

Hi there Greg,


Using my lib i did a nice plotter that allows several line attribs
and stuff like that.  I needed it for plotting waveforms.  I'm going
to add it to my scientific calculator as soon as i can, which will make
that thing quite interesting.

As far as printing text vertically, you normally do that by creating
a rotated font, then use textout or whatever as usual, although only
some versions of windows (i think only XP) allow you to BOTH orient
AND rotate at the same time.  If you're clever, you can rotate each
char and do your own alignment in case you need vertical yet rotated
for normal reading.


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

3. Re: Graph Control and vertical text

Greg Haberek wrote:
> 
> I just submitted my new Graph control to The Archive. It uses
> Win32Lib's custom control interface. I believe it's the first of its
> kind, aside from GroupAdv. Also the first graphing control for
> Euphoria period.
> 
> It currently only supports vertical graphs, since I've come across a
> bit of a problem. How does one draw text vertically? I haven't found a
> flag for drawText() that I can use or any other routine for drawing
> text vertically. I was thinking I could draw it to a Pixmap, rotate
> the Pixmap and draw that to the screen, but I'd like to do it in one
> call, and avoid using the Pixmap buffer. If no such routine/flag
> exists, the I'll go my Pixmap/rotate route.
> 
> ~Greg
> 
> 

Greg:

    You use GDI's MoveToEx() to move to a point.
    then use LineTo() to draw vertically up to that point.

BOOL MoveToEx(
  HDC hdc,          // handle to device context
  int X,            // x-coordinate of new current position
  int Y,            // y-coordinate of new current position
  LPPOINT lpPoint   // pointer to old current position
);

BOOL LineTo(
  HDC hdc,    // device context handle
  int nXEnd,  // x-coordinate of line's ending point
  int nYEnd   // y-coordinate of line's ending point
); 
   

Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.exw

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

4. Re: Graph Control and vertical text

> Greg:
> 
>     You use GDI's MoveToEx() to move to a point.
>     then use LineTo() to draw vertically up to that point.
> 
> BOOL MoveToEx(
>   HDC hdc,          // handle to device context
>   int X,            // x-coordinate of new current position
>   int Y,            // y-coordinate of new current position
>   LPPOINT lpPoint   // pointer to old current position
> );
> 
> BOOL LineTo(
>   HDC hdc,    // device context handle
>   int nXEnd,  // x-coordinate of line's ending point
>   int nYEnd   // y-coordinate of line's ending point
> ); 

Whoops !

    And to write vertical Text take a look at the
  code at the bottom of this site; it's in VB but
  you should be able to use euphoria and the GDI to do it.
  http://www.andreavb.com/forum/viewtopic_3714.html


Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.exw

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

5. Re: Graph Control and vertical text

Greg Haberek wrote:
> 
> I just submitted my new Graph control to The Archive. It uses
> Win32Lib's custom control interface. I believe it's the first of its
> kind, aside from GroupAdv. Also the first graphing control for
> Euphoria period.
> 
> It currently only supports vertical graphs, since I've come across a
> bit of a problem. How does one draw text vertically? I haven't found a
> flag for drawText() that I can use or any other routine for drawing
> text vertically. I was thinking I could draw it to a Pixmap, rotate
> the Pixmap and draw that to the screen, but I'd like to do it in one
> call, and avoid using the Pixmap buffer. If no such routine/flag
> exists, the I'll go my Pixmap/rotate route.

In the demo folder of Win32lib there is a file called "rotated_text.exw" that
shows how to draw text at any angle. Here is the code ...

include Win32Lib.ew
without warning

global procedure Paint_Prime (integer self, integer event, sequence params)
    -- Set angle to 45 degrees
	setFont( self, "Arial", 14, {Bold,0,450,450,DEFAULT_CHARSET,0,0,0,0} )
    -- Draw in text.
    setPenPosition(self, 100,100)
    wPuts(self, "Terima")

    -- Set angle to -45 degrees
setFont( self, "Times New Roman", 14,
{Bold,0,3600-450,3600-450,DEFAULT_CHARSET,0,0,0,0} )
    -- Draw in text.
    setPenPosition(self, 150,100)
    wPuts(self, "Kasih")

end procedure
registerRoutine("Paint_Prime", routine_id("Paint_Prime"))

global function main(sequence vArgs)
    createForm({"Window, Prime, at=(0,0), size=(300,300), bgcolor=brightwhite"})
	return 0
end function
include w32start.ew




-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view message » categorize

6. Re: Graph Control and vertical text

On Wed, 29 Jun 2005 06:05:09 -0400, Greg Haberek <ghaberek at gmail.com>
wrote:

>How does one draw text vertically?
include win32lib.ew
without warning
constant main=create(Window,"Vertical Text Test", 0,
100,100,600,600,0),
		 slope=900
procedure onPaintmain(integer self, integer event, sequence params)
setFont(main,"Tahoma",12,{0,0,slope,slope,ANSI_CHARSET,0,0,0,0})
wPuts({main,310,310},"Some Text")
end procedure
setHandler(main,w32HPaint,routine_id("onPaintmain"))

WinMain(main,Normal)


Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

7. Re: Graph Control and vertical text

Greg Haberek wrote:
> 
> I just submitted my new Graph control to The Archive.

Greg, that is a very cool control. One problem with it: if you minimize the
window vertically to its smallest point (that is, resize it to its smallest
dimension), it glitches. See if you can reproduce that...

I'm using Windows XP Pro.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

8. Re: Graph Control and vertical text

> Greg, that is a very cool control. One problem with it: if you minimize t=
he
> window vertically to its smallest point (that is, resize it to its smalle=
st
> dimension), it glitches. See if you can reproduce that...

Thanks! I figured it'd be rather useful. That probably has to do with
the math, I probably have to add a check for a client height of 0.

> I'm using Windows XP Pro.

Me too.

~Greg

new topic     » goto parent     » topic index » view message » categorize

9. Re: Graph Control and vertical text

> Thanks! I figured it'd be rather useful. That probably has to do with
> the math, I probably have to add a check for a client height of 0.

I was testing it out just now, and no matter how I resize the window,
I can't get it to crash or anything. What do you mean by glitch?

Have you downloaded v0.0.2 yet? I just updated it yesterday and it
includes a complete re-write of all the math involved to draw the
graph.

~Greg

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu