mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 18:58:12 +02:00
LCL: fixed TLazIntfImage setting DataDescription, updated example for scanline
git-svn-id: trunk@12267 -
This commit is contained in:
parent
622c1cea5a
commit
8f193ce68e
@ -12,7 +12,7 @@
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="Fade In - Example for TLazIntfImage"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
</General>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
@ -39,7 +39,7 @@
|
||||
<UnitName Value="FadeIn1"/>
|
||||
<CursorPos X="8" Y="11"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
|
@ -40,7 +40,7 @@ unit Unit1;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
FPImage, GraphType, IntfGraphics, StdCtrls;
|
||||
|
||||
type
|
||||
@ -70,6 +70,7 @@ var
|
||||
IntfImage: TLazIntfImage;
|
||||
ScanLineImage: TLazIntfImage;
|
||||
y: Integer;
|
||||
ImgFormatDescription: TRawImageDescription;
|
||||
begin
|
||||
MyBitmap:=TBitmap.Create;
|
||||
|
||||
@ -77,14 +78,17 @@ begin
|
||||
// keep in mind that you access it in bytes, not words or dwords
|
||||
// For example PowerPC uses another byte order (endian big)
|
||||
ScanLineImage:=TLazIntfImage.Create(0,0);
|
||||
ScanLineImage.Set_BPP32_B8G8R8_A1_BIO_TTB(30,20);
|
||||
ImgFormatDescription.Init_BPP32_B8G8R8_BIO_TTB(30,20);
|
||||
ScanLineImage.DataDescription:=ImgFormatDescription;
|
||||
|
||||
// call the very fast and very specific drawing function
|
||||
// call the pf24bit specific drawing function
|
||||
for y:=0 to ScanLineImage.Height-1 do
|
||||
PaintToRGB32bitScanLine(y,ScanLineImage.Width,
|
||||
ScanLineImage.GetDataLineStart(y));
|
||||
|
||||
// create IntfImage with the format of the current LCL interface
|
||||
MyBitmap.Width:=ScanLineImage.Width;
|
||||
MyBitmap.Height:=ScanLineImage.Height;
|
||||
IntfImage:=MyBitmap.CreateIntfImage;
|
||||
// convert the content from the very specific to the current format
|
||||
IntfImage.CopyPixels(ScanLineImage);
|
||||
@ -114,8 +118,8 @@ var
|
||||
begin
|
||||
// fill line with gray
|
||||
for i:=0 to (ImgWidth*4)-1 do
|
||||
PByte(LineStart)[i]:=128; // set red, green and blue to 128
|
||||
// set one pixel to red
|
||||
PByte(LineStart)[i]:=0; // set red, green and blue to 128 (i.e. gray)
|
||||
// set one pixel to red (this creates a red line)
|
||||
PByte(LineStart)[(Row mod ImgWidth)*4+2]:=255;
|
||||
end;
|
||||
|
||||
|
@ -197,7 +197,7 @@ type
|
||||
public
|
||||
Positions: array of TRawImagePosition;
|
||||
|
||||
// don't use a contructor here, it will break compatebility with a record
|
||||
// don't use a contructor here, it will break compatibility with a record
|
||||
procedure Init(AWidth, AHeight: cardinal; ABitsPerPixel: Byte; ALineEnd: TRawImageLineEnd; ALineOrder: TRawImageLineOrder);
|
||||
function GetPosition(x, y: cardinal): TRawImagePosition;
|
||||
end;
|
||||
|
@ -291,7 +291,7 @@ type
|
||||
|
||||
|
||||
{ TLazAVLPalette }
|
||||
{ This descendent of TFPPalette uses a AVL tree for speed up. }
|
||||
{ This descendent of TFPPalette uses an AVL tree for speed up. }
|
||||
|
||||
TLazAVLPalette = class(TFPPalette)
|
||||
protected
|
||||
@ -1106,7 +1106,7 @@ procedure TLazIntfImage.SetDataDescription(const ADescription: TRawImageDescript
|
||||
begin
|
||||
if CompareMem(@FRawImage.Description, @ADescription, SizeOf(TRawImageDescription))
|
||||
then Exit;
|
||||
|
||||
|
||||
CheckDescription(ADescription, True);
|
||||
BeginUpdate;
|
||||
try
|
||||
@ -1114,7 +1114,6 @@ begin
|
||||
FRawImage.Description := ADescription;
|
||||
ChooseGetSetColorFunctions;
|
||||
SetSize(ADescription.Width, ADescription.Height);
|
||||
FCreateAllDataNeeded := False;
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
@ -2888,9 +2887,9 @@ begin
|
||||
if FUpdateCount > 0 then Exit;
|
||||
|
||||
if FCreateAllDataNeeded then
|
||||
CreateData;
|
||||
CreateData;
|
||||
if FGetSetColorFunctionsUpdateNeeded then
|
||||
ChooseGetSetColorFunctions;
|
||||
ChooseGetSetColorFunctions;
|
||||
end;
|
||||
|
||||
procedure TLazIntfImage.SetSize(AWidth, AHeight: integer);
|
||||
|
Loading…
Reference in New Issue
Block a user