Recent

Author Topic: LoadFromIntfImage - don't work?  (Read 4656 times)

konung

  • Newbie
  • Posts: 4
LoadFromIntfImage - don't work?
« on: December 24, 2012, 01:06:20 am »
I do the following:
Code: [Select]
...
graphtype, intfgraphics, lazcanvas, fpImage;   
...
var
  AImage : TLazIntfImage;
  lRawImage: TRawImage;
  i,j:integer;
begin
lRawImage.Init;
  lRawImage.Description.Init_BPP32_A8R8G8B8_BIO_TTB(100, 100);
  lRawImage.CreateData(true);
  AImage := TLazIntfImage.Create(0, 0);
  AImage.SetRawImage(lRawImage);
  for i:=0 to AImage.Width-1 do
    for j:=0 to AImage.Height-1 do
      AImage.Colors[i,j]:=FPColor(200, 0, 0, 255);

  Image1.Picture.Bitmap.LoadFromIntfImage(AImage);
...
but Image1 is black. what wrong?

winXP 32 bit, Lazarus 1.0.2
« Last Edit: December 24, 2012, 01:17:14 am by konung »

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: LoadFromIntfImage - don't work?
« Reply #1 on: December 24, 2012, 03:07:43 am »
Depending on the widget set you are using the alpha value is backwards reversed.
Windows and QT use the same values for opaque and transparent (if I remember correctly 0 = transparent 255 opaque) gtk works the other way around (255 transparent 0 opaque)
I'm not sure about the actual value so you need to test it for your self.

At least that was my problem a few months back when I was porting a color component suit.
« Last Edit: December 24, 2012, 03:10:44 am by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: LoadFromIntfImage - don't work?
« Reply #2 on: December 24, 2012, 07:36:33 am »
You are trying to load it into bitmap (special BMP format).

Can you do something like either of these?
Code: [Select]
Image1.Picture.LoadFromIntfImage(AImage);
Image1.Picture.Assign(AImage);

konung

  • Newbie
  • Posts: 4
Re: LoadFromIntfImage - don't work?
« Reply #3 on: December 24, 2012, 11:07:04 am »
... alpha value ...
I try different vlaues for Alpha. Result is same.

You are trying to load it into bitmap (special BMP format).
Yeah. 'couse it's manual example:
http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Working_with_TLazIntfImage.2C_TRawImage_and_TLazCanvas
Topic: "Working with TLazIntfImage, TRawImage and TLazCanvas" and "Loading a TLazIntfImage into a TImage".

Can you do something like either of these?

No. First - impossible. Second - the same result.

Does some one try the same code? Or it's unusable feature?
May be there is some another way? I need to do some manipulation with image. And then - show them in some TImage. As i understand - there isn't fast access to pixels in bitmap. And I mast use the way, that I write above.

In win7 64 bit - the same. in Linux (ubuntu 64 bit, lazarus 1.0) - nothing (blackbox is'n too)...
« Last Edit: December 24, 2012, 11:45:55 am by konung »

konung

  • Newbie
  • Posts: 4
Re: LoadFromIntfImage - don't work?
« Reply #4 on: December 24, 2012, 02:44:52 pm »
hum... problem solved.
I miss that R G B A is World type...  :-[

however there is one more problem. if i fill by pixel image with 32-bit mode - it does not work correct. it use image like 24-bit. but it's another problem.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: LoadFromIntfImage - don't work?
« Reply #5 on: December 25, 2012, 12:34:01 am »
Like i said, you are loading image to bitmap. BMP does not support alpha channel.

 

TinyPortal © 2005-2018