Seite 1 von 1

Bildobjekt vergrößern

Verfasst: Do, 02. Mär 2017 17:13
von Siggy
Servus Leute,

Hab eine Frage bezüglich eines Bildobjektes was ich in paint erstellt und als bmp in mein Programm lade und dies dann über einen Button lege.

Jetzt wollte ich aber die Buttons vergrößern und müsste somit auch die Größe der BMP-Datei ändern bzw. anpassen.

Hat jemand eine Ahnung wie ich die die Größe von BMP-Dateien ändern kann?

Danke schon mal im voraus;)

Viele Grüße ausm SchwabeLändle;)

Re: Bildobjekt vergrößern

Verfasst: Fr, 03. Mär 2017 0:21
von AUGE_OHR
Siggy hat geschrieben:Hat jemand eine Ahnung wie ich die die Größe von BMP-Dateien ändern kann?
anbei die Function BMP2BMP

Code: Alles auswählen

   // vergrössern oder verkleinern eines Bitmap
   oBMP := BMP2BMP(oBMP,{64,64})

FUNCTION BMP2BMP( oBMP, aXbpSize )
LOCAL oHuge
LOCAL oTiny
LOCAL oPS
LOCAL oRet
LOCAL nBits
LOCAL nPlanes

  IF aXbpSize[ 2 ] > 0
      oHuge    := oBMP
      nBits    := oBMP:bits
      nPlanes  := oBMP:planes

      oPS := XBPPRESSPACE() :new():Create()
     //Create a empty bitmap 
      oTiny := XBPBITMAP() :New() :Create()
      if nBits > 1 .or. nPlanes > 1
         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ], nPlanes, nBits )
      ELSE
         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ] )
      ENDIF
      // assign to Presspace
      oTiny:presSpace( oPS )
      //Copie and resize the huge bitmap to the small bitmap
      oHuge:Draw( oPS, { 0, 0, aXbpSize[1], aXbpSize[2] },,,GRA_BLT_BBO_IGNORE  )
      oRet := oTiny
   ELSE
      oRet := oBMP
   ENDIF

RETURN oRet
1.) man erstellt (o:Make) ein leeres Bitmap (oTiny) mit der gewünschten Grösse an.
2.) dann "malt" man das Original Bitmap mittels o:Draw in das leer Bitmap
3.) als Ergebniss bekommt man das vorher angelegte Bitmap in der gewünschten Grösse "ausgemalt"

Re: Bildobjekt vergrößern

Verfasst: Fr, 03. Mär 2017 10:38
von Siggy
Danke für die schnelle Antwort :blob8:

Hat direkt auf Anhieb geklappt! (y) Danke dir!

Viele Grüße