Page 1 of 1

Resource Bitmap for Fivewin

Posted: Thu Oct 27, 2022 12:10 pm
by Jimmy
hi,

i often have "Problem" with BMP as Resource under Fivewin (work with Xbase++ and HMG)

now i have figure out that those BMP have no DPI Setting (most i "save" from Windows PAINT)
Image

when change to 96 x 96 DPI and "save" it work with Fivewin without Problem
but i have to change it manual using InfanView ...

Question : is there a API Way to change DPI of BMP :idea:

Re: Resource Bitmap for Fivewin

Posted: Thu Oct 27, 2022 12:16 pm
by Enrico Maria Giordano
Good to know, thank you.

Re: Resource Bitmap for Fivewin

Posted: Fri Oct 28, 2022 6:13 pm
by nageswaragunupudi
Can you please send me a few sample bmp files for testing here?

nageswaragunupudi [at] gmail [dot] com

Re: Resource Bitmap for Fivewin

Posted: Sun Oct 30, 2022 4:17 am
by nageswaragunupudi
Thanks for sending the bmp files.
This is the way we can use these bmp files directly or as resource as it is, without any modifications.

jimmybmp.prg

Code: Select all | Expand

#include "fivewin.ch"

function Main()

   local oDlg, oBar

   DEFINE DIALOG oDlg SIZE 700,300 PIXEL TRUEPIXEL RESIZABLE
   DEFINE BUTTONBAR oBar OF oDlg SIZE 48,48 2007 HEIGHT 68

   DEFINE BUTTON OF oBar FILE "c:\jimmy\bitmaps\no_dpi\about.bmp" ;
      GROUP LABEL "FILE" COLORS CLR_BLACK,CLR_YELLOW
   DEFINE BUTTON OF oBar FILE "c:\jimmy\bitmaps\no_dpi\clean32.bmp"
   DEFINE BUTTON OF oBar FILE "c:\jimmy\bitmaps\no_dpi\cleanup.bmp"
   DEFINE BUTTON OF oBar FILE "c:\jimmy\bitmaps\no_dpi\clipboard.bmp"
   DEFINE BUTTON OF oBar FILE "c:\jimmy\bitmaps\no_dpi\cloud.bmp"
   DEFINE BUTTON OF oBar FILE "c:\jimmy\bitmaps\no_dpi\colors.bmp"
   //
   DEFINE BUTTON OF oBar RESOURCE "ABOUT" ;
      GROUP LABEL "RESOURCE" COLORS CLR_BLACK, CLR_HGREEN
   DEFINE BUTTON OF oBar RESOURCE "CLEAN32"
   DEFINE BUTTON OF oBar RESOURCE "CLEANUP"
   DEFINE BUTTON OF oBar RESOURCE "CLIPBOARD"
   DEFINE BUTTON OF oBar RESOURCE "CLOUD"
   DEFINE BUTTON OF oBar RESOURCE "COLORS"

   ACTIVATE DIALOG oDlg CENTERED

return nil
 
jimmybmp.rc

Code: Select all | Expand

ABOUT     10 "c:\jimmy\bitmaps\no_dpi\about.bmp"
CLEAN32   10 "c:\jimmy\bitmaps\no_dpi\clean32.bmp"
CLEANUP   10 "c:\jimmy\bitmaps\no_dpi\cleanup.bmp"
CLIPBOARD 10 "c:\jimmy\bitmaps\no_dpi\clipboard.bmp"
CLOUD     10 "c:\jimmy\bitmaps\no_dpi\cloud.bmp"
COLORS    10 "c:\jimmy\bitmaps\no_dpi\colors.bmp"
 
Image

Re: Resource Bitmap for Fivewin

Posted: Sun Oct 30, 2022 5:18 am
by Jimmy
hi,
nageswaragunupudi wrote: This is the way we can use these bmp files directly or as resource as it is, without any modifications.
GREAT, this reduce my work :D

Re: Resource Bitmap for Fivewin

Posted: Sun Oct 30, 2022 10:24 am
by Jimmy
hi,

i like to know how to find out to use 10 instead of BITMAP in RC File to work :?:
is there a Constant for 10 like BITMAP for RC :?:

thx for your work

Re: Resource Bitmap for Fivewin

Posted: Sun Oct 30, 2022 3:28 pm
by nageswaragunupudi
RCDATA is 10

For AlphaBitmaps we have to use RCDATA. (better 10)

If your resource compiler complains that BITMAP file is not of a valid format, then change BITMAP to 10 (RCDATA) and try again.

When we specify RCDATA (10), the resource compiler reads the file and stores the contents as a string,

When FWH reads the resource, what all it gets is a string, which can be a pure text or binary data.
FWH ReadImage function checks if the data is a binary data and then if it is an image type and then what image type it is (bmp,ico,cur,jpeg,png,tiff,etc) and then reads it as an image and converts into hBitmap (in some cases it can be meta or other types.) We just leave all that headache to FWH and get back hBitmap (or pImage) or nil.

Re: Resource Bitmap for Fivewin

Posted: Mon Oct 31, 2022 4:51 am
by Jimmy
hi,

thx for Information