A METRO image-background without FREEIMAGE ?

A METRO image-background without FREEIMAGE ?

Postby ukoenig » Sat Sep 07, 2019 3:32 pm

Hello,

for windows without FREEIMAGE I use

// window without FREEIMAGE
aImage := oWnd:ReadImage( cImage, , .t. )
oWnd:DrawImage( aImage, aRect, nil, 1 )


it doesn't work for a METRO-image-background

DEFINE METROPANEL oMetro OF oWnd TITLE "Stammdaten" ;
COLOR aVal[8], CLR_BLUE
aRect := GETCLIENTRECT( oMetro:hWnd )
aImage := oMetro:ReadImage( cImage, , .t. )
oMetro:DrawImage( aImage, aRect, nil, 1 )


a working solution
// metro image-background ( FREEIMAGE needed )

DEFINE IMAGE oImage FILENAME cImage
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) ) // 1 = stretch, 2 : fitoutside, 3:fitinside
oImage:End()
oMetro:SetBrush( oBrush )
RELEASE BRUSH oBrush


is it possible to define a metro-image-background without using FREEIMAGE ?

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A METRO image-background without FREEIMAGE ?

Postby cnavarro » Sat Sep 07, 2019 6:56 pm

Uwe, try with this

Code: Select all  Expand view


#include "fivewin.ch"
#include "metropnl.ch"

Function Main()

   local oWnd

   DEFINE WINDOW oWnd TITLE "MetroPanel"


   Metro()

   ACTIVATE WINDOW oWnd MAXIMIZED //ON INIT Metro( oWnd )

Return nil


Function Metro( oWnd )

   local oMetro
   DEFINE METROPANEL oMetro OF oWnd TITLE "Stammdaten" COLOR CLR_WHITE, CLR_BLUE
   oMetro:bPainted := { || oMetro:DrawImage( "D:\Fwh\FwhTeam\bitmaps\hires\earth.bmp", , nil, 1 ) }
   oMetro:Show()

Return oMetro

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: A METRO image-background without FREEIMAGE ?

Postby ukoenig » Sat Sep 07, 2019 7:33 pm

Christobal,

thank You that works.
I added the image-background-painting to the defined brushed title-text-section

// on top
DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -60 BOLD ITALIC
aPalBmp := oWnd:ReadImage( c_Pfad1 + "Marble.bmp", nil, .t. )
pBrush := GDIP_IMAGEBRUSH( aPalBmp[ 1 ] )
--
--
oMetro:Show()
oMetro:bPainted := {|| oMetro:DrawImage( c_Pfad1 + "Sea.jpg", , nil, 1 ), ;
oMetro:SayText( "Stammdaten", { 30, 150, 120, 650 }, "L", oFontLarge, pBrush ) }


Image

regards
Uwe :D
Last edited by ukoenig on Sun Sep 08, 2019 8:33 am, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A METRO image-background without FREEIMAGE ?

Postby cnavarro » Sat Sep 07, 2019 8:42 pm

The following should be added to metropnel.ch:

#xcommand ACTIVATE METROPANEL <oMtr> => <oMtr>:Show()

or something similar
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: A METRO image-background without FREEIMAGE ?

Postby nageswaragunupudi » Mon Sep 09, 2019 4:19 am

ukoenig wrote:Hello,

for windows without FREEIMAGE I use

// window without FREEIMAGE
aImage := oWnd:ReadImage( cImage, , .t. )
oWnd:DrawImage( aImage, aRect, nil, 1 )


it doesn't work for a METRO-image-background

DEFINE METROPANEL oMetro OF oWnd TITLE "Stammdaten" ;
COLOR aVal[8], CLR_BLUE
aRect := GETCLIENTRECT( oMetro:hWnd )
aImage := oMetro:ReadImage( cImage, , .t. )
oMetro:DrawImage( aImage, aRect, nil, 1 )


a working solution
// metro image-background ( FREEIMAGE needed )

DEFINE IMAGE oImage FILENAME cImage
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) ) // 1 = stretch, 2 : fitoutside, 3:fitinside
oImage:End()
oMetro:SetBrush( oBrush )
RELEASE BRUSH oBrush


is it possible to define a metro-image-background without using FREEIMAGE ?

regards
Uwe :?:


Except the TImage() class, no other class requires freeimage.dll.
Your approach to create the resizable brush is round about.

You will get the correct results if you keep you code simple.

Use this one line code, which does everything for you
Code: Select all  Expand view

DEFINE BRUSH oBrush FILE <anyimagesource> RESIZE
 

Use RESIZE clause while creating the brush. This will automatically resize to fit the window (or panel).
It will keep resizing when the window is resized.
Avoid doing resize yourself in your application program
Code: Select all  Expand view

oMetro:SetBrush( oBrush )
 

While creating brush, you can use any image source, viz bmp,jpg,png,tiff, etc file on the disk, or resource, or from memory or from the web
Freeimage.dll is not required.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: A METRO image-background without FREEIMAGE ?

Postby ukoenig » Mon Sep 09, 2019 5:04 pm

Thank You very much,

it works fine with the changes.

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 42 guests