Recent

Author Topic: Image format in HBitmap  (Read 16712 times)

wile64

  • New Member
  • *
  • Posts: 19
    • http://wile64.neuf.fr/
Image format in HBitmap
« on: May 21, 2007, 03:38:22 pm »
Hello,

How are to store the images in HBitmap of TBitmap?
In what format?

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Image format in HBitmap
« Reply #1 on: May 21, 2007, 07:18:18 pm »
You create a bitmap (format: bitmap) at run time, set height and width and you can load from file, save to file, etc, or simply draw or write to it.

wile64

  • New Member
  • *
  • Posts: 19
    • http://wile64.neuf.fr/
Image format in HBitmap
« Reply #2 on: May 21, 2007, 09:13:50 pm »
I can use a bitmap, thank you ! :D

My question is, Which is the format of the data in HBitmap :!:

ex :
header, Image Data (rgb, bgr, rgba...) ?   :?:

antonio

  • Hero Member
  • *****
  • Posts: 605
Image format in HBitmap
« Reply #3 on: May 21, 2007, 10:45:18 pm »

wile64

  • New Member
  • *
  • Posts: 19
    • http://wile64.neuf.fr/
Image format in HBitmap
« Reply #4 on: May 21, 2007, 11:22:08 pm »
thank you,

I seek information on pointer of data HBITMAP not on the files Bitmap (bmp)

antonio

  • Hero Member
  • *****
  • Posts: 605
Image format in HBitmap
« Reply #5 on: May 21, 2007, 11:52:45 pm »

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Image format in HBitmap
« Reply #6 on: May 22, 2007, 10:46:40 am »
That info will be only for real HBITMAP handles returned by windows. There is no guarantee what so ever that it is compatible with lazarus.
A handle is an abstract pointer so some object. How it is internally structured is of no importance to a user of that handle.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

wile64

  • New Member
  • *
  • Posts: 19
    • http://wile64.neuf.fr/
Image format in HBitmap
« Reply #7 on: May 22, 2007, 11:19:14 am »
How to reach directly the data image in TBitmap ?  :twisted:

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1890
Image format in HBitmap
« Reply #8 on: May 22, 2007, 11:47:17 am »
You can access individual Pixels using TLazIntfImage.
See http://wiki.lazarus.freepascal.org/Developing_with_Graphics#A_fading_example .

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Image format in HBitmap
« Reply #9 on: May 22, 2007, 11:47:27 am »
What data do you mean ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

wile64

  • New Member
  • *
  • Posts: 19
    • http://wile64.neuf.fr/
Image format in HBitmap
« Reply #10 on: May 22, 2007, 12:00:36 pm »
it seems to me:
an image is to charge by the SetHandles procedure in FHandle

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Image format in HBitmap
« Reply #11 on: May 22, 2007, 06:17:47 pm »
the Handle of a TBitmap is only a "utility" for the LCL to communicate with the Widgetset. For normal usage you don't need to worry about it (like every other handle)
If you want to draw something, create a TBitmap, set its Width/Height and start drawing using a canvas.
If you want to load an image, use LoadFrom... functions.
If you want a TBitmap to display on a form, put a TImage on a form, and assign its picture property.
If you want the RawImagedata, use a TLazIntfImage.GetRawImage

This is why I ask what you want to do with the handle.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

wile64

  • New Member
  • *
  • Posts: 19
    • http://wile64.neuf.fr/
Image format in HBitmap
« Reply #12 on: June 15, 2007, 09:16:39 pm »
Thank Marc,

In me classes :

TFPReaderPCX = class (TFPCustomImageReader)

procedure InternalRead  (Stream:TStream; Img:TFPCustomImage); override;

Or go my image after on load in Img ?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Image format in HBitmap
« Reply #13 on: June 18, 2007, 10:32:16 am »
the imagereaders are used by FPImage (or LazIntfImage). For each pixel, FPImage.Setpixel is called. LazIntfImage writes those to memory, which you can retrieve/access using a rawimage.
This is internally used by bitmap to load some graphic formats.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

wile64

  • New Member
  • *
  • Posts: 19
    • http://wile64.neuf.fr/
Image format in HBitmap
« Reply #14 on: June 18, 2007, 12:06:12 pm »
Hello Marc,

I have to create units of loading of file image pass from there by from TFPCustomImageReader and TFPCustomImagewriter.

My question is to know if I can charge of the images more directly ?

One can like Delphi with scanline and of being able to reach it for the modifiers.

It also seems to to me that the pallets are not to support ?