Bitmap + binary
- arthursilvestre
- Posts: 32
- Joined: Thu Sep 20, 2012 7:29 pm
Bitmap + binary
Good morning everyone, is there any way I can create a bitmap trough of a binary code? follows a txt file with the code I have.
Link: https://mega.co.nz/#!aR8AmLJL!ce5fqX-IP ... 9pkOpO-X44
Link: https://mega.co.nz/#!aR8AmLJL!ce5fqX-IP ... 9pkOpO-X44
-
- Posts: 824
- Joined: Thu Oct 13, 2005 7:39 am
- Location: Germany
Re: Bitmap + binary
here is a sample to create small bitmaps on the fly
Code: Select all | Expand
DWORD orange2007s[23][26]={
{ 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde, 0xfffdde},
{ 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3, 0xfff9d3},
{ 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9, 0xfff6c9},
{ 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf, 0xfff3bf},
{ 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5, 0xfff0b5},
{ 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754, 0xffd754},
{ 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f, 0xfcd34f},
{ 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b, 0xf9d04b},
{ 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47, 0xf6cd47},
{ 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43, 0xf3ca43},
{ 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f, 0xf0c73f},
{ 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a, 0xedc43a},
{ 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136, 0xebc136},
{ 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32, 0xe8be32},
{ 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e, 0xe5bb2e},
{ 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a, 0xe2b82a},
{ 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425, 0xdfb425},
{ 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121, 0xdcb121},
{ 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d, 0xd9ae1d},
{ 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19, 0xd7ab19},
{ 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815, 0xd4a815},
{ 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g, 0xd1a50g},
{ 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c, 0xcea20c}
};
HB_FUNC( BRUSH2007ORANGES )
{
HBITMAP hBmp;
hBmp = CreateBitmap (26,23,1,sizeof(RGBQUAD)*8, orange2007s);
hb_retnl( (long) hBmp);
}
kind regards
Stefan
Stefan
- arthursilvestre
- Posts: 32
- Joined: Thu Sep 20, 2012 7:29 pm
Re: Bitmap + binary
Good morning, thank you for attention and now I apologize for not understanding how to work right. The code that returns FastReport for me this is the link I posted in the first topic q. It generates only one line, how should I fill the vector with these my data? just a vector or a matrix of various vectors? and how to add'll call this bitmap? The function that I have to add a Bitmap to FastReport is this:
FrPrn: AddPicture ("ReportTitle1", "Name", "C: \ test.bmp", 20, 20, 200, 200) / / ( Mirror: AddPicture (cParent, cName, cFileName, Nleft, NTOP, nWidth, nHeight) )
It's just the cFileName I wish not to use. How do I assimilate the function that you pass to cFileName? that will fill a variable with the result of the function work?
Thank you for your attention.
FrPrn: AddPicture ("ReportTitle1", "Name", "C: \ test.bmp", 20, 20, 200, 200) / / ( Mirror: AddPicture (cParent, cName, cFileName, Nleft, NTOP, nWidth, nHeight) )
It's just the cFileName I wish not to use. How do I assimilate the function that you pass to cFileName? that will fill a variable with the result of the function work?
Thank you for your attention.
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
Re: Bitmap + binary
Arthur,
arthur.prg

arthur.prg
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local cFile := MemoRead( "bitmap.txt" )
local nPos := 19
local cBytes := ""
local oWnd, hBitmap
while nPos < Len( cFile ) - 19
cBytes += Chr( HexToDec( SubStr( cFile, nPos, 2 ) ) )
nPos += 2
end
MemoWrit( "arthur.txt", cBytes )
hBitmap = BuildBitmap( SubStr( cBytes, 23 ) )
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd ;
ON PAINT DrawBitmap( hDC, hBitmap, 0, 0 )
MsgInfo( IsGdiObject( hBitmap ) )
DeleteObject( hBitmap )
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HBITMAP CreateMemBitmap3( void * cBitmap );
HB_FUNC( BUILDBITMAP )
{
hb_retnl( ( LONG ) CreateMemBitmap3( ( void * ) hb_parc( 1 ) ) );
}
#pragma ENDDUMP

- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
Re: Bitmap + binary
HBITMAP CreateMemBitmap3( void * cBitmap );
it is a new function included in FWH 13.07
it is a new function included in FWH 13.07
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bitmap + binary
Antonio,
Which is better between
and
?
EMG
Antonio Linares wrote:Code: Select all | Expand
ON PAINT DrawBitmap( hDC, hBitmap, 0, 0 )
Which is better between
Code: Select all | Expand
ON PAINT DrawBitmap( hDC, hBitmap, nTop, nLeft, nWidth, nHeight )
and
Code: Select all | Expand
ON PAINT PalBmpDraw( hDC, 0, 0, hBitmap, , nWidth, nHeight )
?
EMG
- arthursilvestre
- Posts: 32
- Joined: Thu Sep 20, 2012 7:29 pm
Re: Bitmap + binary
Antonio, I really liked it and this is exactly q I wish. I'm surprised, I have to confess, but would like to see if there is a possibility of doing something else. Upload this picture in FastReport. If you or someone you know I am extremely grateful. I tried but could not.
This is the syntax to add an image in FastReport:
AddPicture (cParent, cName, cFileName, Nleft, NTOP, nWidth, nHeight)
cParent = is the object where the image is affiliated (Ex: 'Page1')
cName = Name that the object of BMP will take the report
cFileName = Image path.
Here is exactly where I wanted to work. I thank you all.
This is the syntax to add an image in FastReport:
AddPicture (cParent, cName, cFileName, Nleft, NTOP, nWidth, nHeight)
cParent = is the object where the image is affiliated (Ex: 'Page1')
cName = Name that the object of BMP will take the report
cFileName = Image path.
Here is exactly where I wanted to work. I thank you all.
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bitmap + binary
Enrico Maria Giordano wrote:Antonio,Antonio Linares wrote:Code: Select all | Expand
ON PAINT DrawBitmap( hDC, hBitmap, 0, 0 )
Which is better betweenCode: Select all | Expand
ON PAINT DrawBitmap( hDC, hBitmap, nTop, nLeft, nWidth, nHeight )
andCode: Select all | Expand
ON PAINT PalBmpDraw( hDC, 0, 0, hBitmap, , nWidth, nHeight )
?
EMG
Up!

EMG
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
Re: Bitmap + binary
Enrico,
For a simple bitmap painting use DrawBitmap().
If you need transparency, or to specify a raster operation, or to use a palette, then use PalBmpDraw(), (sort of an extended DrawBitmap())
For a simple bitmap painting use DrawBitmap().
If you need transparency, or to specify a raster operation, or to use a palette, then use PalBmpDraw(), (sort of an extended DrawBitmap())
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
Re: Bitmap + binary
Arthur,
I don't use FastReport but I am sure that any FastReport user will be able to help you
I don't use FastReport but I am sure that any FastReport user will be able to help you

- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bitmap + binary
Antonio,
So, for simple painting as in
is DrawBitmap() the best option? Thank you!
EMG
Antonio Linares wrote:Enrico,
For a simple bitmap painting use DrawBitmap().
If you need transparency, or to specify a raster operation, or to use a palette, then use PalBmpDraw(), (sort of an extended DrawBitmap())
So, for simple painting as in
Code: Select all | Expand
ON PAINT DrawBitmap( hDC, hBitmap, nTop, nLeft, nWidth, nHeight )
is DrawBitmap() the best option? Thank you!

EMG
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
Re: Bitmap + binary
Enrico,
Yes, it is the simplest one
In fact it uses the source code proposed by Charles Petzold in his book "Programming Windows":
ftp://ftp.charlespetzold.com/ProgWin95/CHAP19/SHOWBIT.C
Yes, it is the simplest one

In fact it uses the source code proposed by Charles Petzold in his book "Programming Windows":
ftp://ftp.charlespetzold.com/ProgWin95/CHAP19/SHOWBIT.C
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bitmap + binary
Antonio,
Thank you!
I'm going to replace PalBmpDraw() with DrawBitmap().
EMG
Antonio Linares wrote:Enrico,
Yes, it is the simplest one
In fact it uses the source code proposed by Charles Petzold in his book "Programming Windows":
ftp://ftp.charlespetzold.com/ProgWin95/CHAP19/SHOWBIT.C
Thank you!

I'm going to replace PalBmpDraw() with DrawBitmap().

EMG
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bitmap + binary
Antonio,
FYI, I tried DrawBitmap() but the result quality is much worse than PalBmpDraw(). I reverted back to PalBmpDraw().
EMG
Enrico Maria Giordano wrote:I'm going to replace PalBmpDraw() with DrawBitmap().
FYI, I tried DrawBitmap() but the result quality is much worse than PalBmpDraw(). I reverted back to PalBmpDraw().
EMG
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact: