HMG Graph based on Bos Taurus

HMG Samples and Enhancements

Moderator: Rathinagiri

EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: HMG Graph based on Bas Taurus

Post by EduardoLuis »

Hi Andy:

Wow!!!!!! Excelent.- ;)
Thanks for share your code.-
Eduardo
User avatar
Steed
Posts: 427
Joined: Sat Dec 12, 2009 3:40 pm

Re: HMG Graph based on Bas Taurus

Post by Steed »

Thanks a lot
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG Graph based on Bas Taurus

Post by andyglezl »

BT_DrawText( hDC, Row, Col, cText, cFontName, nFontSize, aFontColor, aBackColor, nTypeText, nAlingText, nOrientation)
Hola

No he podido que un texto tenga un fondo de un cierto color según la sintaxis.
Sera algún Bug, alguna idea ?
--------------------------------------------------------------------------------------------
Hello

I could not have a text a background of a certain color according to the syntax.
Will be a Bug, any ideas?

Code: Select all

#include "hmg.ch"


FUNCTION MAIN

   DEFINE WINDOW Win1 AT 0,0 WIDTH  600 HEIGHT 400 MAIN	ON PAINT Proc_ON_PAINT () BACKCOLOR { 47, 79, 79 }  TITLE "Prueba  BT_DrawText()"
	   
   END WINDOW
   CENTER WINDOW Win1
   ACTIVATE WINDOW Win1

RETURN Nil
PROCEDURE Proc_ON_PAINT
	LOCAL nTypeText, cText
	LOCAL hDC, BTstruct
	LOCAL i1, nRen := 0, nCol := 0
		
	hDC = BT_CreateDC( "Win1", BT_HDC_INVALIDCLIENTAREA, @BTstruct)
	
*	BT_DrawText( hDC, Row, Col, cText, cFontName, nFontSize, aFontColor, aBackColor, nTypeText, nAlingText, nOrientation)
	nTypeText  := BT_TEXT_TRANSPARENT + BT_TEXT_BOLD // + BT_TEXT_ITALIC + BT_TEXT_UNDERLINE 
	BT_DrawText( hDC, 100, 100, "Valor"     , "Verdana", 10, BLUE,  WHITE, nTypeText, BT_TEXT_LEFT )
	BT_DrawText( hDC, 150, 100, "Otro Valor", "Verdana", 10, BLACK, WHITE, BT_TEXT_OPAQUE, BT_TEXT_LEFT )
	BT_DrawText( hDC, 200, 100, "Otro más"  , "Verdana", 10, WHITE,,, )
	DrawTextInBitmap( hDC, 250, 100, "Otro más", 'Arial', 10 , WHITE, 0, { 70, 130, 180 } )	

	BT_DeleteDC (BTstruct)
RETURN
function DrawTextInBitmap( hDC, Row, Col, cText, cFontName, nFontSize, aColor, nAlign, aColor2 )
   default nAlign := 0
   do case
   case nAlign == 0
      BT_DrawText( hDC, Row, Col, cText, cFontName, nFontSize, aColor, aColor2 )
   case nAlign == 1
      BT_DrawText( hDC, Row, Col, cText, cFontName, nFontSize, aColor, aColor2, BT_TEXT_RIGHT )
   case nAlign == 2
      BT_DrawText( hDC, Row, Col, cText, cFontName, nFontSize, aColor, aColor2, BT_TEXT_CENTER )
   endcase   
return nil 
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG Graph based on Bas Taurus

Post by srvet_claudio »

Eliminar BT_TEXT_TRANSPARENT de nTypeText
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG Graph based on Bas Taurus

Post by andyglezl »

Gracias Dr. Claudio

Esto significa que si existe la variable "nTypeText",
tiene prioridad sobre lo que se indique como parametro en la función

Porque existiendo "nTypeText" con "BT_TEXT_TRANSPARENT", lo siguiente no pone el BackColor...
-------------------------------------------------------------------------------------------------------------------------
Thanks Dr. Claudio

This means that if the variable "nTypeText"
has priority over what is indicated as a parameter in the function

Because there "nTypeText" with "BT_TEXT_TRANSPARENT", the following does not put the BackColor ...

nTypeText := BT_TEXT_TRANSPARENT + BT_TEXT_BOLD // + BT_TEXT_ITALIC + BT_TEXT_UNDERLINE
BT_DrawText( hDC, 100, 100, "Valor" , "Verdana", 10, BLUE, WHITE, nTypeText, BT_TEXT_LEFT )
BT_DrawText( hDC, 150, 100, "Otro Valor", "Verdana", 10, BLACK, WHITE, BT_TEXT_OPAQUE, BT_TEXT_LEFT )
BT_DrawText( hDC, 200, 100, "Otro más" , "Verdana", 10, WHITE,,, )
DrawTextInBitmap( hDC, 250, 100, "Otro más", 'Arial', 10 , WHITE, 0, { 70, 130, 180 } )


***************************************************************************************************************************************************************

Hice otra prueba, Invirtiendo el orden, si le pone el BackColor en las 3 primeras lineas, pero al minimizar o llamar otra ventana
se pierde el BackColor
-------------------------------------------------------------------------------------------------------------------------------------
I did another test, reversing the order, if you put the BackColor on the first 3 lines, but to minimize or call another window
you lose the BackColor


BT_DrawText( hDC, 150, 100, "Otro Valor", "Verdana", 10, BLACK, WHITE, BT_TEXT_OPAQUE, BT_TEXT_LEFT )
BT_DrawText( hDC, 200, 100, "Otro más" , "Verdana", 10, WHITE,,, )
DrawTextInBitmap( hDC, 250, 100, "Otro más", 'Arial', 10 , WHITE, 0, { 70, 130, 180 } )
nTypeText := BT_TEXT_TRANSPARENT + BT_TEXT_BOLD // + BT_TEXT_ITALIC + BT_TEXT_UNDERLINE
BT_DrawText( hDC, 100, 100, "Valor" , "Verdana", 10, BLUE, WHITE, nTypeText, BT_TEXT_LEFT )
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG Graph based on Bas Taurus

Post by srvet_claudio »

Is a bug,
please in function BT_DRAW_HDC_TEXTOUT (source/c_bostaurus.c, line 1417) change the original code:

Code: Select all

   if ((Type & BT_TEXT_TRANSPARENT) == BT_TEXT_TRANSPARENT)
       SetBkMode(hDC, TRANSPARENT);
   else
       SetBkColor(hDC, Back_Color);
for this code:

Code: Select all

   if ((Type & BT_TEXT_TRANSPARENT) == BT_TEXT_TRANSPARENT)
       SetBkMode(hDC, TRANSPARENT);
   else
   {   SetBkMode(hDC, OPAQUE);
       SetBkColor(hDC, Back_Color);
   }
and rebuild the lib.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG Graph based on Bas Taurus

Post by andyglezl »

Perfecto Dr. Soto, funciona OK.
Gracias.
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG Graph based on Bas Taurus

Post by andyglezl »

Hola Dr. Soto

Tenemos en BosTaurus (ó podríamos tener) una función que COPIE una región ( ren, col, ancho, alto ) de un hBitmap y crear otro hBitmap ?
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
We Bos Taurus (or could have) a function that copies a region (ren, col, width, height) of an HBITMAP and create another hBitmap?
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG Graph based on Bas Taurus

Post by srvet_claudio »

andyglezl wrote:Hola Dr. Soto

Tenemos en BosTaurus (ó podríamos tener) una función que COPIE una región ( ren, col, ancho, alto ) de un hBitmap y crear otro hBitmap ?
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
We Bos Taurus (or could have) a function that copies a region (ren, col, width, height) of an HBITMAP and create another hBitmap?
See:

Code: Select all

hBitmapNew := BT_BitmapClone (hBitmap, Row, Col, Width, Height)
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG Graph based on Bas Taurus

Post by andyglezl »

Gracias Dr. Soto !
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply