constructor TBGRAAnimatedGif.Create(filenameUTF8: string);
property TimeUntilNextImageMs: integer read GetTimeUntilNextImage;
It returns the time in milliseconds before the next frame will be rendered. The value zero means that the Gif should be updated immedialty.function DetectFileFormat(AFilenameUTF8: string): TBGRAImageFormat;
function DetectFileFormat(AStream: TStream; ASuggestedExtensionUTF8: string = ''): TBGRAImageFormat;
function SuggestImageFormat(AFilenameOrExtensionUTF8: string): TBGRAImageFormat;
function CreateBGRAImageReader(AFormat: TBGRAImageFormat): TFPCustomImageReader;
function CreateBGRAImageWriter(AFormat: TBGRAImageFormat; AHasTransparentPixels: boolean): TFPCustomImageWriter;
- DefaultBGRAImageReader, DefaultBGRAImageWriter: if you want to specify a reader for a specific file format.function BGRAToStr(c: TBGRAPixel; AColorList: TBGRAColorList = nil; AMaxDiff: Word= 0): string;
function StrToBGRA(str: string): TBGRAPixel; //full parse
function StrToBGRA(str: string; const DefaultColor: TBGRAPixel): TBGRAPixel; //full parse with default when error or missing values
function PartialStrToBGRA(str: string; const fallbackValues: TBGRAPixel; out error: boolean): TBGRAPixel; //partial parse allowed
procedure TryStrToBGRA(str: string; var parsedValue: TBGRAPixel; out missingValues: boolean; out error: boolean);
procedure ForEachVertex(ACallback: TVertex3DCallback);
procedure ForEachFace(ACallback: TFace3DCallback);
Added the possibility to set custom flags on vertex/faces with the property CustomFlag. procedure LoadFromFileUTF8(const filenameUTF8: string); virtual;
procedure LoadFromFileUTF8(const filenameUTF8: string; AHandler: TFPCustomImageReader); virtual;
procedure SaveToFileUTF8(const filenameUTF8: string); virtual; overload;
procedure SaveToFileUTF8(const filenameUTF8: string; Handler:TFPCustomImageWriter); virtual; overload;
procedure Assign(ARaster: TRasterImage); override; overload;
procedure FillMask(x,y: integer; AMask: TBGRACustomBitmap; color: TBGRAPixel; ADrawMode: TDrawMode); override;
procedure FillMask(x,y: integer; AMask: TBGRACustomBitmap; texture: IBGRAScanner; ADrawMode: TDrawMode); override;
procedure CrossFade(ARect: TRect; Source1, Source2: IBGRAScanner; AFadePosition: byte; mode: TDrawMode = dmDrawWithTransparency); override;
procedure CrossFade(ARect: TRect; Source1, Source2: IBGRAScanner; AFadeMask: IBGRAScanner; mode: TDrawMode = dmDrawWithTransparency); override;
procedure StretchPutImage(ARect: TRect; Source: TBGRACustomBitmap; mode: TDrawMode; AOpacity: byte = 255); override;
function GetImageAffineBounds(Origin,HAxis,VAxis: TPointF; Source: TBGRACustomBitmap): TRect;
function GetImageAngleBounds(x,y: single; Source: TBGRACustomBitmap; angle: single; imageCenterX: single = 0; imageCenterY: single = 0; ARestoreOffsetAfterRotation: boolean = false): TRect;
You should transmit these bounds to the drawing function you use after that. procedure ApplyMask(mask: TBGRACustomBitmap; ARect: TRect; AMaskRectTopLeft: TPoint); override;
To specify the area and an offset for the mask. ApplyMask do not care about the clipping rectangle either. procedure DrawCheckers(ARect: TRect; AColorEven,AColorOdd: TBGRAPixel);
About noise filter, yes it is possible to add it. For now, you can do it using the Function filter, by writing "random" in the expression. I reckon it is not very simple.
uses BGRABitmap, BGRABitmapTypes, BGRAGradientScanner;
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var bmp: TBGRABitmap;
scan: TBGRARandomScanner;
begin
bmp := TBGRABitmap.Create(ClientWidth,ClientHeight);
scan := TBGRARandomScanner.Create(False,255);
bmp.Fill(scan);
scan.Free;
bmp.Draw(Canvas,0,0);
bmp.Free;
end;
Uses BGRABitmap, BGRABitmapTypes, BGRASVG, BGRAUnits;
var svg: TBGRASVG;
begin
bmp := TBGRABitmap.Create(500,500, BGRAWhite);
//it is recommended to initialise the SVG with size and unit
//otherwise, the size is kind of undefined
svg := TBGRASVG.Create(10,6,cuCentimeter);
svg.Content.AppendPath('M1,1 L9,1 9,5 1,5 z', cuCentimeter).fillColor := CSSGreen;
svg.Content.AppendRect(2,2,6,2, cuCentimeter).fillColor:= BGRA(255,255,0,192);
with svg.Content.AppendRect(0,0,svg.Units.ConvertWidth(1,cuCentimeter,cuPixel),
svg.Units.ConvertHeight(1,cuCentimeter,cuPixel), cuPixel) do
begin
fillColor := CSSBlue;
fillOpacity:= 0.2;
end;
svg.Content.AppendRoundRect(3,3,4,1, 0.3,0.3, cuCentimeter).fillColor := CSSOrange;
with svg.Content.AppendLine(150,150,450,250, cuPoint) do
begin
strokeColor := BGRABlack;
strokeOpacity:= 0.8;
end;
svg.Content.AppendLine(svg.ViewBox.min,svg.ViewBox.min+svg.ViewBox.size).strokeColor := CSSRed;
with svg.Content.AppendCircle(5,3,3,cuCentimeter) do
begin
strokeColor := CSSRed;
strokeWidth := FloatWithCSSUnit(2,cuPoint);
fillNone;
end;
//SVG needs to be drawn on a Canvas2D surface
svg.Draw(bmp.Canvas2D,50,50,cuPoint);
//SVG can be saved in a file that can be viewed in
//a web browser or in InkScape for example
svg.SaveToFile('test.svg');
svg.Free;
//you can display the bitmap or save it to a file
bmp.Free;
end;
function TBGRABitmap.GetPixel256(x, y, fracX256,fracY256: int32or64; AResampleFilter: TResampleFilter = rfLinear; smoothBorder: boolean = true): TBGRAPixel; virtual; abstract;
function TBGRABitmap.GetPixelCycle256(x, y, fracX256,fracY256: int32or64; AResampleFilter: TResampleFilter = rfLinear): TBGRAPixel; virtual; abstract; overload;
function TBGRABitmap.GetPixelCycle256(x, y, fracX256,fracY256: int32or64; AResampleFilter: TResampleFilter; repeatX: boolean; repeatY: boolean): TBGRAPixel; virtual; abstract; overload;
function Html5ArcTo(const p0, p1, p2: TPointF; radius: single): TArcDef;
function SvgArcTo(const p0: TPointF; rx, ry, xAngleRadCW: single; largeArc,
anticlockwise: boolean; const p1: TPointF): TArcDef;
function ArcStartPoint(const arc: TArcDef): TPointF;
function ArcEndPoint(const arc: TArcDef): TPointF;
function IsLargeArc(const arc: TArcDef): boolean;
procedure TBGRABitmap.DrawPath(APath: IBGRAPath; c: TBGRAPixel; w: single); virtual; abstract;
procedure TBGRABitmap.DrawPath(APath: IBGRAPath; texture: IBGRAScanner; w: single); virtual; abstract;
procedure TBGRABitmap.FillPath(APath: IBGRAPath; c: TBGRAPixel); virtual; abstract;
procedure TBGRABitmap.FillPath(APath: IBGRAPath; texture: IBGRAScanner); virtual; abstract;
uses BGRABitmap, BGRABitmapTypes, BGRAVectorize;
var bmp: TBGRABitmap;
begin
bmp := TBGRABitmap.Create;
bmp.Canvas2D.fontRenderer := TBGRAVectorizedFontRenderer.Create; //here we supply an adequate font renderer
bmp.Canvas2D.font := '20px Arial';
bmp.Canvas2D.fillStyle(BGRABlack);
bmp.Canvas2D.textBaseline := 'top'; //we can align the text to baseline, top, bottom...
bmp.Canvas2D.translate(50,50);
bmp.Canvas2D.scale(10,10);
bmp.Canvas2D.rotate(-30*Pi/180);
bmp.Canvas2D.fillText('Test1',0,0);
end;
- Text hint / placeholder on all platforms (Qt, Gtk, Windows). This is a hint which is showed when edit text is empty. Normally only Gtk (ver 3+) and Qt has it, but due that windows edit doesn't, LCL is not publishing this propertyhttp://msdn.microsoft.com/en-us/library/windows/desktop/bb761701%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/bb761701%28v=vs.85%29.aspx)
My mistake. It is on windows and Qt but not on Gtk2 (added in Gtk3). I made a mistake with button in tabsheets (available on Gtk and Qt but not on Windows)- Text hint / placeholder on all platforms (Qt, Gtk, Windows). This is a hint which is showed when edit text is empty. Normally only Gtk (ver 3+) and Qt has it, but due that windows edit doesn't, LCL is not publishing this propertyhttp://msdn.microsoft.com/en-us/library/windows/desktop/bb761701%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/bb761701%28v=vs.85%29.aspx)
My mistake. It is on windows and Qt but not on Gtk2 (added in Gtk3).
function RectWithSize(left,top,width,height: integer): TRect;
- GDK offset fix (Linux)uses BGRABitmap, BGRABitmapTypes;
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
const w=9;
var bmp:TBGRABitmap;
begin
bmp := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRAWhite);
bmp.ArrowStartAsTail;
bmp.ArrowStartRepeat := 2;
bmp.ArrowEndAsTriangle(0.25,False,True);
bmp.DrawPolyLineAntialias(
bmp.ComputeOpenedSpline([PointF(80,80),PointF(ClientWidth-160,ClientHeight div 2),PointF(ClientWidth-80,ClientHeight-20)],ssCrossingWithEnds),
BGRABlack,w);
bmp.ArrowStartRepeat := 1; //restore default value
bmp.ArrowStartAsClassic(True,True,3);
bmp.ArrowStartOffset := -8;
bmp.ArrowEndAsClassic(False,True);
bmp.DrawPolyLineAntialias(
bmp.ComputeOpenedSpline([PointF(40,60),PointF(ClientWidth div 3,20),PointF(ClientWidth-80,40)],ssCrossingWithEnds),
BGRABlack,w);
bmp.ArrowStartOffset := 0; //restore default value
bmp.ArrowStartAsClassic(True,True);
bmp.ArrowStartSize := PointF(1,2);
bmp.ArrowStartOffset := -5.5;
bmp.ArrowStartRepeat := 3;
bmp.ArrowEndAsTriangle(0.75);
bmp.DrawLineAntialias(20,90, 80,ClientHeight-40,
BGRABlack,w);
bmp.ArrowStartSize := PointF(2,2); //restore default values
bmp.ArrowStartOffset := 0;
bmp.ArrowStartRepeat := 1;
bmp.ArrowStartAsClassic;
bmp.ArrowEndAsClassic(False,False,2);
bmp.DrawLineAntialias(ClientWidth-40,40,ClientWidth-40,ClientHeight-80,BGRABlack,w);
bmp.Draw(Canvas,0,0);
bmp.Free;
end;
materialFilename := ChangeFileExt(objectFilename,'.mtl')
uses BGRAColorQuantization, BGRABitmapTypes, BGRABitmap;
var
quant : TBGRAColorQuantizer;
sourceBmp: TBGRABitmap;
begin
sourceBmp := TBGRABitmap.Create('picture_in_32_bits.bmp');
quant := TBGRAColorQuantizer.Create(sourceBmp, acFullChannelInPalette);
quant.SaveBitmapToFile(daFloydSteinberg, sourceBmp, 'picture_in_8_bits.png');
quant.Free;
sourceBmp.Free;
end;
uses BGRAColorQuantization, BGRABitmapTypes, BGRABitmap;
var
quant : TBGRAColorQuantizer;
sourceBmp: TBGRABitmap;
begin
sourceBmp := TBGRABitmap.Create('picture.jpg');
quant := TBGRAColorQuantizer.Create(sourceBmp, acIgnore);
quant.ReductionColorCount := 16;
quant.SaveBitmapToFile(daFloydSteinberg, sourceBmp, 'picture_in_4_bits.bmp');
quant.Free;
sourceBmp.Free;
end;
{ Draws the UTF8 encoded string, with color c.
If align is taLeftJustify, (x,y) is the top-left corner.
If align is taCenter, (x,y) is at the top and middle of the text.
If align is taRightJustify, (x,y) is the top-right corner.
The value of FontOrientation is taken into account, so that the text may be rotated. }
procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment); override; overload;
{ Same as above functions, except that the text is filled using texture.
The value of FontOrientation is taken into account, so that the text may be rotated. }
procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment); override; overload;
{ Same as above, except that the orientation is specified, overriding the value of the property FontOrientation. }
procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment); override; overload;
procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment); override; overload;
{ Draw the UTF8 encoded string at the coordinate (x,y), clipped inside the rectangle ARect.
Additional style information is provided by the style parameter.
The color c or texture is used to fill the text. No rotation is applied. }
procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; c: TBGRAPixel); override; overload;
procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; texture: IBGRAScanner); override; overload;
{ Returns the total size of the string provided using the current font.
Orientation is not taken into account, so that the width is along the text. }
function TextSize(sUTF8: string): TSize; override;
procedure LoadFromDevice(DC: THandle);
procedure LoadFromDevice(DC: THandle; ARect: TRect);
procedure TakeScreenshotOfPrimaryMonitor;
procedure TakeScreenshot(ARect: TRect);
bmp.TakeScreenShot(Screen.Monitors[numMonitor].BoundsRect);
bmp.TakeScreenShot(Screen.DesktopRect);
Well yes and no. It works if a truetype font file is provided as far as I remember. One could parse the font directory of the system, but that would take some time, and would be complicated to port. And still only TrueType fonts would be handled.QuoteThere is some challenge here, to do text rendering without LCL. For now, BGRABitmap uses TBitmap to render text.AggPas accomplishes that without problem. The code is there if you want to take a peek. ;)
- average level tree (the unit AvgLvlTree is in LCL)
- reading DOM/XML (the units laz2_DOM, laz2_XMLRead, laz2_XMLWrite are in LCL)
- to get a canvas to draw on a TfpgImage like on a window (this could be used to render text)fpGUI's TfpgCanvas is not a TFPCustomCanvas descendant and doesn't surface the internal image buffer, so not all functionality is the same as FCL or LCL. Saying that, when I've needed that (probably twice in the last 10 years), I've used TAggPas to attach to a TfpgImage, do my painting using the AggPas API. Alternatively, I've also used FPImgCanv from FCL, then convert the fpImage to a TfpgImage.
- to get an image from any canvas (not essential however)Same as the above answer - as a work-around you could Canvas.Pixels[], but probably not the fastest workaround. ;)
- to draw data directly from data (opaque or transparent) : this can be achieved of course by creating an imageI've always used an image for this. You have direct access to the image data via the TfpgImage.ImageData and .ImageDataSize properties.
- to read an icon file (the type TIcon is in LCL)Use FCL's FPImage and convert it to a TfpgImage - I saw no need to reinvent the wheel. See the fpg_imgfmt_png.pas unit for an example.
About UTF8 classes, it is ok as there as some functions in Free Pascal to do that.Indeed, fpGUI has supported Unicode (UTF-8) for years without depending on LCL. ;-) The fpg_utils.pas unit shows how fpGUI accomplishes file access - mostly via the fpgToOSEncoding() and fpgFromOSEncoding() functions.
Thanks. I will try that.- average level tree (the unit AvgLvlTree is in LCL)
- reading DOM/XML (the units laz2_DOM, laz2_XMLRead, laz2_XMLWrite are in LCL)
All these are in lazutils for quite a while, which are parts that used to be LCL that are not LCL dependent.
So most logically, use lazutils package.
Yes but the operating system provides ways to draw on a window and to draw on a bitmap, so you could provide a TBitmap with a Canvas.- to get a canvas to draw on a TfpgImage like on a window (this could be used to render text)fpGUI's TfpgCanvas is not a TFPCustomCanvas descendant and doesn't surface the internal image buffer, so not all functionality is the same as FCL or LCL.
Nope that would be too slow. So how to retrieve an image, a screenshot, etc. ?Quote- to get an image from any canvas (not essential however)Same as the above answer - as a work-around you could Canvas.Pixels[], but probably not the fastest workaround. ;)
It is slower than a DIB section because creating the bitmap takes time. Also it seems that the image is always drawn as opaque.Quote- to draw data directly from data (opaque or transparent) : this can be achieved of course by creating an imageI've always used an image for this. You have direct access to the image data via the TfpgImage.ImageData and .ImageDataSize properties.
Yes but I would like to provide support for ICO format.Quote- to read an icon file (the type TIcon is in LCL)Use FCL's FPImage and convert it to a TfpgImage - I saw no need to reinvent the wheel. See the fpg_imgfmt_png.pas unit for an example.
RunError(211)
t := TBGRABitmap.Create(fPbx.Width, fPbx.Height, bc);
...
t.Draw(fPbx.Canvas, 0, 0, False);
function TBGRADefaultBitmap.GetBitmap: TBitmap;
begin
if FAlphaCorrectionNeeded and CanvasAlphaCorrection then
LoadFromBitmapIfNeeded;
if FDataModified or (FBitmap = nil) then
begin
RebuildBitmap;
FDataModified := False; // <-------------------
end;
Result := FBitmap;
end;
Here is a new version of BGRABitmap 8.3 that can be used with fpgui_toolkit.
No no, bgrabitmappack4fpgui does not depend on LCL. It depends on LazUtils, fpgui_toolkit and FCL. And fpgui_toolkit does not depend on LCL.QuoteHere is a new version of BGRABitmap 8.3 that can be used with fpgui_toolkit.
Hello.
Wow, thanks for your demo LCL-fpGUI toolkit and BGRABitmap. ;)
Hum, do you have plan for Pure-fpGUI toolkit and BGRABitmap ?
Pure fpGUI toolkit is autonomous and does not depend on LCL.
But BGRABitmap has LCL dependencies...
Nice wiki :)Happy you find it nice :)
It looks like the c# declarations for .net source files in visual studio.
No no, bgrabitmappack4fpgui does not depend on LCL. It depends on LazUtils, fpgui_toolkit and FCL. And fpgui_toolkit does not depend on LCL.
paswstring.pas(379,43) Error: Incompatible types: got "<address of procedure(PWideChar;var AnsiString;Int64);Register>" expected "TUnicodeStringManager.<procedure variable type of procedure(PWideChar;var RawByteString;Word;Int64);Register>"
Maybe it is because i use last fpc 3.0.1 ?
Oh I may have forgotten something.
Would it fix the problem to replace "BGRADefaultBitmap" by "BGRALCLBitmap", and "TBGRADefaultBitmap" by "TBGRALCLBitmap" in BGRABitmap.pas ?
Is LazUtils absolutely necessary, does it not exist something else more flexible ?It is necessary to render FreeType fonts.
I am interested if you have an idea on how to make it work with both compilers. What function has changed?QuoteMaybe it is because i use last fpc 3.0.1 ?Yep, with fpc 2.4 it works ;)
Huh, Circular, what a perfect work you have done. ;DThanks. :)
It works perfectly and it is pure-fpGUI => incredible. :o
Where are you with your plan to do a BGRABitmap library ?Of course, you are welcome to help. I am writing the documentation. Basically the tasks consists in adding comments in the source code. Then this is transformed into a beautiful wiki. Would you like to hear more about this task?
If you agree, it will be a pleasure to help you for that.
BGRABitmap is fantastic, thanks for all your work on this.You're welcome.
P.S. Maybe we will see the day when BGRAControls will be a complete widget set for Lazarus? :)Ahah maybe. :D
To be honest I have no idea how to do that.Leave that to me! ;) I'll make it happen with fpGUI Toolkit, or at least try and make it so the software renderer for fpGUI is configurable at compile time between AggPas and BGRABitmap. If I complete one, the other shouldn't be too difficult to add. [last famous worlds]
I am interested if you have an idea on how to make it work with both compilers. What function has changed?=>
Quote
Where are you with your plan to do a BGRABitmap library ?
If you agree, it will be a pleasure to help you for that.
Of course, you are welcome to help. I am writing the documentation. Basically the tasks consists in adding comments in the source code. Then this is transformed into a beautiful wiki. Would you like to hear more about this task?
Yes I saw that in your previous response, but that does not give me a name. Hmm, oh I see, it is a unit in LazUtils. I suppose it is about Ansi2WideMoveProc or Wide2AnsiMoveProc.QuoteI am interested if you have an idea on how to make it work with both compilers. What function has changed?=>
paswstring.pas(379,43) Error: Incompatible types: got "<address of procedure(PWideChar;var AnsiString;Int64);Register>" expected "TUnicodeStringManager.<procedure variable type of procedure(PWideChar;var RawByteString;Word;Int64);Register>"
Hum, i was taking to transform BGRABitmap unit into a library... :-[Ah ok. Well I don't intend to do that for now so I don't need help there. Are you unsure that I would not authorize you to do so? Would it entail something regarding the structure of BGRABitmap?
Like i did for fpGUIlib => https://github.com/fredvs/fpGUIlib (https://github.com/fredvs/fpGUIlib)
or uoslib => https://github.com/fredvs/uoslib (https://github.com/fredvs/uoslib)
Are you unsure that I would not authorize you to do so?Hum, BGRABitmap is yours, i think normal to ask it to you... :-[
Would it entail something regarding the structure of BGRABitmap?Not the global structure but each procedure/function will be adapted if the library is classical native or Java native.
QuoteAre you unsure that I would not authorize you to do so?Hum, BGRABitmap is yours, i think normal to ask it to you... :-[QuoteWould it entail something regarding the structure of BGRABitmap?Not the global structure but each procedure/function will be adapted if the library is classical native or Java native.
Posted by: 007
I've started the library some time ago (with circular help), is in bgracontrols package, but left it since I will not use it as is, but if you're interested check it out.
bgracontrols\test\test_bgrabitmap_library test project
bgracontrols\bgra_pascalscript_library the library is based on the bgrabitmap pascal script implementation (that of course is limited to the declared functions in BGRAPascalScript.pas), because that is the name I choose...
library BGRABitmap;
uses
BGRABitmap
,BGRABitmapTypes;
function getBlue(AColor: TBGRAColor): byte; cdecl;
begin
Result := getBlue(aColor);
end;
....
exports
getBlue name 'getblue',
...
begin
end.
And also I must ask you If you know if you can get it working with visual studio and c# for example...
And also I must ask you If you know if you can get it working with visual studio and c# for example...
Just quickly made Windows 7 fpGUI style using BGRABitmap. Antyalias, effects, rounding, everything is working fine. It is amazing. Something is wrong with scrollbars but it is probably my mistake with coordinates. Draw speed seems to be faster than LCL version, probably that it omit Gtk/Qt level and draw directly on X11. Well done circular :)Wow it looks great Dibo :)
Suggestion: Missing handy method for color convertion from TfpgColor to TBGRAPixel. For now I need to use fpgColorToRGBTriple and then its RED GREEN BLUE property in BGRA(red, green, blue)I suppose you can use ColorToBGRA()
Just quickly made Windows 7 fpGUI style using BGRABitmap. Antyalias, effects, rounding, everything is working fine. It is amazing. Something is wrong with scrollbars but it is probably my mistake with coordinates. Draw speed seems to be faster than LCL version, probably that it omit Gtk/Qt level and draw directly on X11. Well done circular :)
Suggestion: Missing handy method for color convertion from TfpgColor to TBGRAPixel. For now I need to use fpgColorToRGBTriple and then its RED GREEN BLUE property in BGRA(red, green, blue)
Attached screenshot and source. Tested on Kubuntu 64 bit
function rgb(red, green, blue: byte): longword; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
begin
Result := BGRAPascalScript.rgb(red, green, blue);
end;
procedure bgra_SaveToFile(id: integer; filename: PChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
begin
BGRAPascalScript.bgra_SaveToFile(id, filename);
end;
exports
bgra_GetHighestID name 'bgragethighestid',
...
So it would be possible to customize the appearance of controls with fpGUI? Or do you think about compiling the current BGRAControls with fpGUI?Once done, fpGUI's TfpgCanvas class will use AggPas or BGRAControls to render everything. This is already possible with AggPas, but it needs some more improvements. I also plan to extend the TfpgCanvas class's interface so it is easier to take advantage of the features AggPas and BRGABitmap provides.
Maybe replace all TBGRAColor with longword => example =>Code: [Select]function rgb(red, green, blue: byte): longword; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
begin
Result := BGRAPascalScript.rgb(red, green, blue);
end;
And replace all String with PChar => example =>Code: [Select]procedure bgra_SaveToFile(id: integer; filename: PChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
begin
BGRAPascalScript.bgra_SaveToFile(id, filename);
end;
"_" character in exports-name is interpreted as sub-class in some language (Java,..).
Also, to avoid mangle-name =>Code: [Select]exports
bgra_GetHighestID name 'bgragethighestid',
...
TMedianOption = (moNone, moLowSmooth, moMediumSmooth, moHighSmooth);
enum TMedianOption : byte {moNone, moLowSmooth, moMediumSmooth, moHighSmooth};
The thing is I will change it with PWideChar, it works too in Java?For a Java native library it is a other story... =>
Library javaBGRABitmap;
uses
Jni,
BGRABitmap
,BGRABitmapTypes;
procedure bgra_SaveToFile(PEnv: PJNIEnv; Obj: JObject; id: integer; filename: JString); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
begin
BGRAPascalScript.bgra_SaveToFile(id, (PEnv^^).GetStringUTFChars(PEnv, filename, nil));
(PEnv^^).ReleaseStringUTFChars(PEnv, filename, nil); /// to free memory
end;
...
exports
bgra_GetHighestID name 'Java_bgra_gethighestid',
...
begin
end.
So, you will create another library, or want access to keep improving this?No, no, you did it perfectly, i do not want to create a new one, i only proposed my help ( i did not knew that you have already done it ). :-[
Well you have sourceforge account?
exports
...,
rgb name 'rgb', // why not => rgb name 'bgrargb' ?
rgba name 'rgba',
getBlue name 'getblue',
getGreen name 'getgreen',
getRed name 'getred',
getAlpha name 'getalpha',
setBlue name 'setblue',
setGreen name 'setgreen',
setRed name 'setred',
setAlpha name 'setalpha',
...
QuoteWell you have sourceforge account?
Yes => fredvs
PS: You may avoid mangle-name problems for all exported methods => those too =>Code: [Select]exports
...,
rgb name 'rgb', // why not => rgb name 'bgrargb' ?
rgba name 'rgba',
getBlue name 'getblue',
getGreen name 'getgreen',
getRed name 'getred',
getAlpha name 'getalpha',
setBlue name 'setblue',
setGreen name 'setgreen',
setRed name 'setred',
setAlpha name 'setalpha',
...
Fre;D
Added. Add all the stuff you need to work in java and new functions. You have complete access so you can upload files releasing the .dll .so and headers when you want.
uses
Interfaces,
I dont know.. also i have the same problem with c# (no idea of c# graphics at all, i know that xamarin studio uses gtk and visual studio the windows native stuff)..
ok... i have no idea right now im not in the code pc but try removing it and see what happens.
If you can just make it works as is now with java will be ok too.
removed interfaces and working.
.../bgrabitmap/bgragtkbitmap.pas(191,24) Error: Identifier not found "TBGRAPtrBitmap"=>
/usr/bin/ld: ../bgrabitmap/lib/x86_64-linux/2.6.4/bgrabitmaptypes.o: relocation R_X86_64_32S against `TC_BGRABITMAPTYPES_RESAMPLEFILTERSTR' can not be used when making a shared object; recompile with -fPIC
..there is a new version that works with fpGUI only but never used it...
bgrapath.pas(2526,32) Error: Call by var for arg no. 1 has to match exactly: Got "LongInt" expected "Int64"
function ComputeLength(AAcceptedDeviation: single = 0.1): single;
function ToPoints(AAcceptedDeviation: single = 0.1): ArrayOfTPointF;
procedure SetPoints(const APoints: ArrayOfTPointF);
procedure stroke(ABitmap: TBGRACustomBitmap; AColor: TBGRAPixel; AWidth: single; AAcceptedDeviation: single = 0.1);
procedure stroke(ABitmap: TBGRACustomBitmap; ATexture: IBGRAScanner; AWidth: single; AAcceptedDeviation: single = 0.1);
procedure fill(ABitmap: TBGRACustomBitmap; AColor: TBGRAPixel; AAcceptedDeviation: single = 0.1);
procedure fill(ABitmap: TBGRACustomBitmap; ATexture: IBGRAScanner; AAcceptedDeviation: single = 0.1);
- added cursor to browse a path (TBGRAPathCursor) : you can go forward, backward, set position, choose if the cursor can jump from one shape to another Path.stroke(bmp, BGRABlack, 2);
PathCursor := Path.CreateCursor;
PathCursor.Position := PathPos*PathCursor.PathLength;
bmp.ArrowEndAsClassic;
pt := PathCursor.CurrentCoordinate;
tangent := PathCursor.CurrentTangent;
bmp.DrawLineAntialias(pt.x,pt.y,pt.x+tangent.x*40,pt.y+tangent.y*40,CSSFireBrick,3);
bmp.DrawLineAntialias(pt.x,pt.y,pt.x-tangent.y*40,pt.y+tangent.x*40,CSSFireBrick,3);
bmp.ArrowEndAsNone;
Cursor.Free;
//draw ellipses along the path, also a simple example on how to travel along a path
procedure DrawRings(ABitmap: TBGRABitmap;
APath: IBGRAPath; ACount: integer; ARadius: single);
var
step: single;
cursor: TBGRACustomPathCursor;
begin
cursor := APath.getCursor;
step := cursor.PathLength/ACount;
cursor.Position:= 0;
repeat
with cursor.CurrentCoordinate do
ABitmap.FillEllipseAntialias(x,y, ARadius,ARadius, CSSDarkSlateBlue);
until cursor.MoveForward(step) < 0.5*step;
cursor.Free;
end;
var background : TBGRABitmap;
procedure PrepareBackground(Width,Height: integer);
var
path2: TBGRAPath;
gradient: TBGRAGradientScanner;
fontRenderer: TBGRAVectorizedFontRenderer;
begin
background := TBGRABitmap.Create(Width,Height,CSSLightSteelBlue);
fontRenderer := TBGRAVectorizedFontRenderer.Create;
background.FontRenderer := fontRenderer; //assign text vectorial font renderer
background.FontHeight := round(size*0.09);
background.FontQuality := fqFineAntialiasing;
//half of a circle
path2 := TBGRAPath.Create;
path2.arc(width/2,height/2,size*0.4, Pi, 0, true);
DrawRings(background, path2, 20, size/150);
fontRenderer.OutlineColor := BGRABlack;
fontRenderer.OutlineWidth := size/600;
fontRenderer.OutlineVisible := true;
background.FontVerticalAnchor := fvaBaseline;
gradient := TBGRAGradientScanner.Create(CSSYellow, CSSOrange, gtLinear, PointF(0,height/2), PointF(0,height/2+size*0.5));
background.TextOutCurved(path2, ' Left ...', gradient, taLeftJustify, 0);
background.TextOutCurved(path2, 'Middle', gradient, taCenter, 0);
background.TextOutCurved(path2, '... Right ', gradient, taRightJustify, 0);
gradient.free;
fontRenderer.OutlineVisible := false;
background.FontVerticalAnchor := fvaTop;
path2.Free;
end;
procedure TextOutCurved(ACursor: TBGRACustomPathCursor; sUTF8: string; AColor: TBGRAPixel; AAlign: TAlignment; ALetterSpacing: single); virtual; abstract; overload;
procedure TextOutCurved(ACursor: TBGRACustomPathCursor; sUTF8: string; ATexture: IBGRAScanner; AAlign: TAlignment; ALetterSpacing: single); virtual; abstract; overload;
procedure TextOutCurved(APath: IBGRAPath; sUTF8: string; AColor: TBGRAPixel; AAlign: TAlignment; ALetterSpacing: single); virtual; overload;
procedure TextOutCurved(APath: IBGRAPath; sUTF8: string; ATexture: IBGRAScanner; AAlign: TAlignment; ALetterSpacing: single); virtual; overload;
When you specify a path as parameter, taLeftJustify means the text starts at the beginning of the path, and taRightJustify that it ends at the end of the path.Compilando paquete BGRABitmapPack 8.4: Exit code 1, Errors: 1, Hints: 1
bgrapath.pas(2595,32) Error: Call by var for arg no. 1 has to match exactly: Got "LongInt" expected "Int64"
bgrapath.pas(2035,20) Hint: Found declaration: TBGRAPath.GoToNextElement(var Int64):Boolean;
var pos: IntPtr;
Ah ok. If you replace the type of the variable Pos on line 2561 by the following?Code: [Select]var pos: IntPtr;
I have started to produce documentation generated from the code.
Here is it:
http://wiki.lazarus.freepascal.org/BGRABitmap_Pixel_types
http://wiki.lazarus.freepascal.org/BGRABitmap_Color_definitions
http://wiki.lazarus.freepascal.org/BGRABitmap_Geometry_types
Please tell me how you find it! :)
Yes. That works.Cool! I have replaced the zip file for version 8.4.
Thank you very much circular,Its very good.Thanks for the feedback. It gives me a reliable validation on how the documentation can be. :)
Just in few seconds I learn somethings that I didn't know they are exists!
Also consider making documentation and demo showing what BGRABitmap can do like your old demo in LazPaint,With that I learn how using BGRABitmap and what can it do.we talked about it before.
Thank you again ;)
Thanks for the feedback. It gives me a reliable validation on how the documentation can be.I'm always looking forward of BGRABitmap and trying to appreciate your work any how.
To be honest I have no idea how to do that.Leave that to me! ;) I'll make it happen with fpGUI Toolkit, or at least try and make it so the software renderer for fpGUI is configurable at compile time between AggPas and BGRABitmap. If I complete one, the other shouldn't be too difficult to add. [last famous worlds]
Regards,
Graeme
but it would be very cool to have a cross platform BGRABitmap widget set for Lazarus.
{ This file is part of BGRABitmap, drawing routines with alpha blending and antialiasing. These routines allow to manipulate 32bit images in BGRA format.
This code is under modified LGPL (see COPYING.modifiedLGPL.txt). This means that you can link this library inside your programs for any purpose. Only the included part of the code must remain LGPL.
If you make some improvements to this library, please notify here:
http://www.lazarus.freepascal.org/index.php/topic,12037.0.html
Contact : circular at operamail.com }
Hi, why this is related with Code Typhoon thing
QuoteHi, why this is related with Code Typhoon thing
No, but it is better for everybody to know it when using it. :-X
Please stay close to me!I love this part!
bgrafreetype.pas(124,15) Error: There is no method in an ancestor class to be overridden: "TBGRAFreeTypeDrawer.DrawGlyph(LongInt,TFreeTypeRenderableFont,Single,Single,TFPColor);"
bgrafreetype.pas(566,7) Error: identifier idents no member "RenderGlyph"
bgrafreetype.pas(568,7) Error: identifier idents no member "RenderGlyph"
bgrafreetype.pas(581,54) Error: Incompatible type for arg no. 5: Got "TFPColor", expected "TBGRAPixel"
Hi 007!
Ah yes, there are compilation options in bgrabitmap.inc so that it is possible deactivate some features depending on the version. I noticed that testing version using LCL_FULLVERSION was not working so I've put directives in this file.
I guess most people have Lazarus 1.4 or lower, so I changed those directives so that by default functions of Lazarus 1.5 are not used.
I am trying to build "bgracontrols.lpk".
It throws an error in "BCToolBar.pas".
The error is:
bctoolbar.pas(84,10) Error: identifier idents no member "HorizLine"
All code is newly downloaded.
Why am I getting this error?
Thank you.
Dick Maley
if Empty then exit;in the procedure TBGRAWinBitmap.Draw, in the following block:
else?
begin
if Empty then exit; //add here
if LineOrder = riloTopToBottom then VerticalFlip;
LoadFromBitmapIfNeeded;
ACanvas.StretchDraw(Rect, Bitmap);
if LineOrder = riloTopToBottom then VerticalFlip;
end;
Hi Circular
I have done a quick test, and it appears to solve the problem with tbclabel.
AFter I made the change, I clean and built (delete all) the project I attached, the IDE form had not updated, but the exe file has changed.
If I copy Paste the tbclabel on the form and set caption to blank, the new label does update. But the Existing one does not.
Hope that makes sense.
So yes the exe is now fine, which is the main concern.
Cheers
Josh
uses
LCLType
procedure TBCCustomImageButton.LoadFromBitmapResource(Resource: string; ResourceType: PChar);
var
res: TResourceStream;
begin
res := TResourceStream.Create(HInstance, Resource, ResourceType);
if BitmapOptions.Bitmap <> nil then
BitmapOptions.Bitmap.Free;
BitmapOptions.Bitmap := TBGRABitmap.Create(res);
res.Free;
end;
Yes, that's a good idea.
It sounds good from the begining to the end. :)
Doing it every month, hmm, I am not convinced there will be enough people for that!
Hmm what are categories for? To make it easier to compare?
It could have all categories winner too.
Although I think we need a first run for estimation.
I would prefer a poll, that would be more democratic. 8-)Ok.
I guess we can suggest categories but let people do what they want. And in the end, we can consider multiple winners.Ok. The last thing is if we can upload only one or multiple software. For example If I choose to make an UI and a Photo manipulation, I can upload both or I must choose one? (for that was the main idea of categories, to participate in different ways).
What time do we let for people to do their software? One month? That would be up to the 12th of august. Two month? That would be up to the 12th of september? Maybe people do other things in september and would could say up to the 31th of august.
I think one month for example up to 13th august is a good start,after that when people wants more time then you can decide but one month is long enough I think.
Ok.
Here is the thread: http://forum.lazarus.freepascal.org/index.php/topic,29038.0.html
:)
bgrautf8.pas(91,22) Error: Identifier not found "UTF8ToSys"
bgrautf8.pas(96,22) Error: Identifier not found "SysToUTF8"
bgrautf8.pas(121,22) Error: Identifier not found "FileOpenUTF8"
bgrautf8.pas(126,22) Error: Identifier not found "FileCreateUTF8"
bgrautf8.pas(131,22) Error: Identifier not found "FileCreateUTF8"
bgrautf8.pas(136,22) Error: Identifier not found "FileExistsUTF8"
bgrautf8.pas(142,22) Error: Identifier not found "FindFirstUTF8"
bgrautf8.pas(147,22) Error: Identifier not found "FindNextUTF8"
bgrautf8.pas(152,12) Error: Identifier not found "FindCloseUTF8"
They are in LazFileUtils, LazUtf8, and maybe some other units of the LazUtils package (see Juha's mail to the mailing list of July 7 2015). There were wrappers all the time with "deprecated" warnings, but they were disabled recently.
You're welcome. I would say that one thing that is next on my list is antialiased drawing and pen width with OpenGL.Another happy news for me.
b:=TBGRABitmap.Create;I write this in opengltest1 and colors will be reversed but if you load it TBGLBitmap it will be OK.
b.TakeScreenshotOfPrimaryMonitor;
Tex:=BGLTexture(b);
You're welcome. I would say that one thing that is next on my list is antialiased drawing and pen width with OpenGL.Antialiased drawing including images drawings? Like when you use StretchPutImage?
Antialiased drawing including images drawings? Like when you use StretchPutImage?Well this antialiasing is already done by OpenGL, isn't it?
No really, I need both bgrabitmappack4lcl_opengl and bgracontrols package :|I suggest to try to go in BGRAControls and change its dependency to bgrabitmappack4lcl_opengl
I need both BGLVirtualScreen and BGRAVirtualScreen so I can switch in one app between them. I tried many ways but no success.
I write this in opengltest1 and colors will be reversed but if you load it TBGLBitmap it will be OK.Oh that's a bug. I fixed it on SVN for you.
Well this antialiasing is already done by OpenGL, isn't it?I dont know for sure but I know it is not smooth for sure, I just resize an image with BGRABitmap with high quality and another time with OpenGL and OpenGL version is not as smooth as BGRABitmap one.
I suggest to try to go in BGRAControls and change its dependency to bgrabitmappack4lcl_openglJust worked, Thanks.
Oh that's a bug. I fixed it on SVN for you.Works as it should. Thanks.
Oh I see what you're saying. For now basically you would need to call Resample to create a reduced image, and then display it, and then free it.QuoteWell this antialiasing is already done by OpenGL, isn't it?I dont know for sure but I know it is not smooth for sure, I just resize an image with BGRABitmap with high quality and another time with OpenGL and OpenGL version is not as smooth as BGRABitmap one.
Cool :)QuoteI suggest to try to go in BGRAControls and change its dependency to bgrabitmappack4lcl_openglJust worked, Thanks.
I want to try BGRABitmap with OS X, what problem we have with it and what can I test for help?That would be great. The problem is with LCL font rendering. So using the normal package, if you use TBGRABitmap.TextOut, it does not work. :'(
Oh I see what you're saying. For now basically you would need to call Resample to create a reduced image, and then display it, and then free it.But it is slow and yes there is tricks for better result but it will be very good to have it in BGL.
That would be great. The problem is with LCL font rendering. So using the normal package, if you use TBGRABitmap.TextOut, it does not work.Just font? I remember you talked about low speed with Lainz before.
Yes that's slow. The thing is that as far as I know OpenGL does not provide high quality resampling, apart from trilinear filtering, but in this case, you need to prepare the texture with different sizes.QuoteOh I see what you're saying. For now basically you would need to call Resample to create a reduced image, and then display it, and then free it.But it is slow and yes there is tricks for better result but it will be very good to have it in BGL.
Well basically it is the Canvas property that does not work. But this can be avoided most of the time, except when drawing text, because the default renderer depends on LCL rendering that is done on the Canvas. I am sometimes thinking about removing the Canvas property from TBGRABitmap, so that people would not be tempted to use it!QuoteThat would be great. The problem is with LCL font rendering. So using the normal package, if you use TBGRABitmap.TextOut, it does not work.Just font? I remember you talked about low speed with Lainz before.
OK I will check it.
I am thinking about switching to Git. I was able to install TortoiseGit and it works fine.
Maybe what I could do is to use the Git repository you created on GitHub, and when I release a new version, I would update the SVN on SourceForge. So on SourceForge there would only be releases, and on GitHub there would be all changes.
I am thinking about switching to Git.That would be a wise move. ;-)
I was able to install TortoiseGit and it works fine.I recommend you rather learn the command line, and use the GUI tools that come standard with Git (eg: git-gui, gitk). They are ALWAYS the most up-to-date tools. Plus when using the command line, it is consistent across any platforms, and you have the full power of Git at your fingertips. I switched to Git in 2009, and on occation try out various Git GUI's and none of them can do everything you can do from the command line. They are all slower, cumbersome and take up desktop space (compared to a small terminal window).
So on SourceForge there would only be releases, and on GitHub there would be all changes.I would ditch SourceForge completely. I'm actually thinking about doing the same thing with my projects. SourceForge supports Git (which is what I already use), but most of my projects are mirrored on Github too. Seeing that I frequently push and pull from both SourceForge and Github, I have immediately noticed that Github is so much faster. Plus, Github also supports project web pages, personal/author web pages, project binary releases, bug tracking, code review with inline comments etc.
Edit: also you can upload releases on GitHub, like in sourceforge upload the zip's.
I am thinking about switching to Git. I was able to install TortoiseGit and it works fine.There is also a handy git client written in Free Pascal:
Maybe what I could do is to use the Git repository you created on GitHub, and when I release a new version, I would update the SVN on SourceForge. So on SourceForge there would only be releases, and on GitHub there would be all changes.Another git project hosting option is GitLab (successor of Gitorious):
There is also a handy git client written in Free Pascal:Interesting.
https://sourceforge.net/projects/mseuniverse/
Another git project hosting option is GitLab (successor of Gitorious):Ok. As Lainz has already created a repository on GitHub, for this project I will switch to this one to avoid confusion. But thanks for the link.
https://about.gitlab.com/gitlab-com/
Indeed, I have found the release mechanism by clicking on the release counter and it works fine!Edit: also you can upload releases on GitHub, like in sourceforge upload the zip's.
Correct, every Tag made in your repository becomes an automatic release. You can then extend such a release with a description and alternative downloads. eg:
https://github.com/graemeg/xananews/releases (https://github.com/graemeg/xananews/releases)
I would ditch SourceForge completely. I'm actually thinking about doing the same thing with my projects.SourceForge has its drawbacks, however it is simpler in my opinion. The download button appears straight away, tabs are more visible, etc.
" ...fixed bugs and compilation on 64-bit..."
' bgraopengl3d.pas(719,1) Error: Internal error 2012090607 '
How about a port of BGRABitmap for web HTML/JS? Is just an idea.Sound interesting and very useful, how do you thing about it?
Of course to handle bitmaps you need them in a web server, they can't be loaded at local...
Other thing that can be done is create a new JSBGRABitmap pascal code that converts all the calling code into JS canvas. So you can change the type: TBGRABitmap to TJSBGRABitmap and instead of saving to bitmap saving to text format with all the code to run in a browser.You are right, problem is what it's use and I think it should go with CEF. and in the other hand we can reverse this idea and use power up using JS and HTML and it's canvas to be used in our native pascal so you can reuse so much codes out there in your app natively, think about it as using HTML and JS as a resource and show them with BGRABitmap. You can say people can use CEF and these recourse but it has it's own downside like needing a huge library and messing around with it.
Or a mix of both, having a class in JS and then another in pascal that creates the .js and html automatically.
But are just ideas, maybe is too complex to do it! And who will use it? There are a lot of graphical libs out there for JS, I don't know if worth the effort.
Hi Lainz!
I am not sure how to do that. I have the impression that the release thing is only available for the whole repository, and I use that for LazPaint.
Apparently there is a way to remove the SVN repository. But I am not sure how to do that. Instead I could remove all the files locally and commit that.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls,
BGRABitmap, BGRABitmapTypes;
type
{ TForm1 }
TForm1 = class(TForm)
PaintBox1: TPaintBox;
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
fBmp: TBGRABitmap;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
w, h: integer;
tsp: TBGRAPixel;
begin
tsp := BGRA($00, $00, $00, $00);
w := PaintBox1.Width;
h := PaintBox1.Height;
fBmp := TBGRABitmap.Create(w, h);
fBmp.FillRect(0, 0, w-1, h-1, cssWhite, dmSet);
fBmp.FillRect(0, 0, w-1, h-1, cssRed, dmDrawWithTransparency);
fBmp.Rectangle(0, 0, w-1, h-1, cssBlack, tsp, dmDrawWithTransparency);
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
fBmp.Draw(PaintBox1.Canvas, 1, 1, true);
end;
end.
fBmp.Rectangle(0, 0, w-1, h-1, cssBlack, BGRAPixelTransparent, dmDrawWithTransparency);
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
fbmp.Draw(PaintBox1.Canvas, 1, 1, true);
end;
//fBmp.FillRect(0, 0, w-1, h-1, cssWhite, dmSet);
//fBmp.FillRect(0, 0, w-1, h-1, cssRed, dmDrawWithTransparency);
fBmp.Rectangle(0, 0, w, h, cssBlack, cssRed, dmDrawWithTransparency); //<---
fBmp.Rectangle(0, 0, w, h,...
fbmp.Draw(PaintBox1.Canvas, 0, 0, true);
In my original program I get:
Warning: other unit files search path (aka unit path) of "MyProg" contains "/Users/.../bgrabitmap", which belongs to package "BGRABitmapPack"
Confused, maybe this is a problem?
when I hit the line:This is a problem I've had before. In my memory, it is related to the fact that when you assign a bitmap like that, it becomes a shared bitmap and that causes some problems. You can use TBGRABitmap.MakeBitmapCopy to have a bitmap you can safely assign.
BPR.Picture.Bitmap:=FBMPR.Bitmap;
I get:
Project project1 raised exception class 'FPImageException' with message:
Failed to create bitmap handle
Thank you very much for testing! :)
New version 9.2.3
- fixed opaque rendering on Canvas for MacOS
- avoiding some hints/warnings
https://github.com/bgrabitmap/bgrabitmap/releases
The latest Delphi has a free version. ;)
https://www.embarcadero.com/fr/products/delphi/starter/promotional-download
Sorry to interrupt. In Awesome Programmer's previous post, I suggested him (or maybe her) to update his Lazarus. But he didn't even try. His issue may not be an issue if he try to use the newer version of Lazarus. He was using a 4 years ago version of Lazarus.
Sorry I didn't read your reply to my other post.
use fpcupdeluxe https://github.com/newpascal/fpcupdeluxe/releases/tag/v1.2.0aSorry to interrupt. In Awesome Programmer's previous post, I suggested him (or maybe her) to update his Lazarus. But he didn't even try. His issue may not be an issue if he try to use the newer version of Lazarus. He was using a 4 years ago version of Lazarus.
Hi Handoko
Sorry I didn't read your reply to my other post. Maybe your are right. I need to upgrade my Lazarus to the latest and the greatest. The only thing is I am running Lazarus on Linux and Lazarus was installed from the Operating System's repository. Lazarus in the repository is old and I am guessing they only update their repository whenever they release a upgraded version of their OS. I think, I will have to download Lazarus and try to install it on my own. Thank you for your reply on my other post.
"no override" or some similar.Hmmm, override is not a new keyword. Does it say that there is nothing to override? In the case, it would not link this code with the more abstract class?
Ok. I've posted a message on OPM thread.
I am not sure how I can notify lazarus-ide.org about the new version of the package?
Ok cool
You mean to protected?
On MacOS, the OpenGL stuff works well? That's cool
Yes Lulu, outline and shadows are clipped as they are not included in the font size. I guess it is normal that shadows would not be included, but I have a doubt about outlines. I can see why it would make sense to include outlines, as the font is somewhat bolder. However i does not really change the width/height of the text. It is more like an effect around the text. I will leave it like that because that's how it works now, but I agree it could be different.I understand and that's fine like that !
I noticed that material design works really good, animations are smooth too.that's good ! :)
Well, let's start the thing!
@circular, I forget, to fix path issues just append: Application.Location + 'filename.someext'Ok.
I answered to one issue. I don't see another.
@lainz
Your dynamic_controls.zip includes several excellent techniques, but has a serious memory leak.
I attach a project adapted from your code, which is slightly simpler with fewer dependencies and no leaks.
Hi Lainz.
Attached In Progress package; which contains a simple demo.
It is not finished yet, but thought If I upload it you can have a look see.. ;)
IMPORTANT
ps You will need to move FSVG: TBGRASVG from protected to public in BCSVGViewer
attachment updated 2nd June 2018
Release very impressive.Glad you like it. That was a lot of work. :)
Thanks so much!!! :D
Again thanks for your help.Well you help me as well. 8-)
Compiler le paquet BGRABitmapPack 9.9 : Code de sortie 1 - Erreurs : 1 - Conseils : 2
bgracustombitmap.inc(1096,24) Error: Identifier not found "GetFirstStrongBidiClass"
generatedcolorspace.inc(4072,34) Hint: Mixing signed expressions and longwords gives a 64bit result
generatedcolorspace.inc(4075,34) Hint: Mixing signed expressions and longwords gives a 64bit result
All you need to do is create a new application and place a TBGRASHAPE component on it.Hmm maybe we can try to narrow down a bit the issue. It seems to be related to transparency. What if you put in the OnPaint event of the form something like:
You get a Blank Square, rather than a Black Lined Diamond shape.
TShape works fine.
I had thought about posting on bugtracker, do you post issue on bugtracker for lazarus whuch are 3rd party related?
uses BGRABitmap, BGRABitmapTypes;
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var
bmp: TBGRABitmap;
w: single;
begin
bmp := TBGRAbitmap.Create(ClientWidth,ClientHeight);
w := ClientWidth/10;
bmp.EllipseAntialias(ClientWidth/2-0.5,ClientHeight/2-0.5,ClientWidth/2-w/2,ClientHeight/2-w/2,CSSBlack,w,CSSRed);
bmp.Draw(Canvas,0,0,False);
bmp.Free;
end;
? FBGRA.FillTransparent;
by FBGRA.Fill(clRed);
?
If I change the code then It draws a Red Rectangle.That suggests that the problem would be with the Canvas2d thing, maybe in case of solid color.
I have done some further tests, It does not draw the border or fill the color, if I create the cradient and set the option to draw the border and fill with fradient then it renders.
Hmm I have no idea about XZM.Many many thanks for that circular, that no_install works :D
Well I suppose you can test it without installing it.
I have added the plain binaries in the release (see Assets and then no_install archives):
https://github.com/bgrabitmap/lazpaint/releases/tag/v7.0.1
Strange. I don't have this bug on Linux 64. @Lainz, do you have this as well?
Many many thanks for that circular, that no_install works :D:)
The toolbar icons are newer right or is my idea?Not really, upscaled a bit. New icons are only in Vector Edit.
I wonder, will be possible edit vectorized images later?That's planned for next version.
Or for that is "Vectot Edit" program?Well Vector Edit is not released officially though you can indeed edit vectorial things with it and open it with LazPaint.
The method to dock colors and layers is same ugly haha, anyway I know this was a quick solution :PI reckon. :-[ But that's not working well, so I need to do the real thing.
You know how to reach me.I don't see what you are referring to.
I don't see what you are referring to.A free Raspberry Pi :D Anyway, everybody should have a Raspbery Pi anyway.... :D
I think he means you can PM him to contact him in the forum.I was also guessing that. Though I prefer if it's clarified.
A free Raspberry Pi :D Anyway, everybody should have a Raspbery Pi anyway.... :DI hear you would like to share your love of the Raspberry. :D
I think using the library will be ok, no need to reinvent the wheel...Indeed. Not sure though how to plug that.
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
I think using the library will be ok, no need to reinvent the wheel...Indeed. Not sure though how to plug that.
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
Hi!That's the guy! Holy Cow have the years flown by. :D
I think you mean efg ! He is still at work but his continuous growing website needs to be reorganized. Thats what he is doing now. But he's is still at work since over 20 years. Yes, he was very early with cool sniplets for graphic algorithms for Delphi.
Here: http://www.efg2.com/ (http://www.efg2.com/)
Winni
I get it working, now is possible to load webP into BGRABitmap and save to webP from BGRABitmap on Win32, Win64Cool. I fixed a few things. I couldn't try to add the Free memory call as I can't run it on Linux. I guess on Windows, you can find a Free function for global allocation (that's not the FreeMem of Lazarus). In some places I saw they use WebPFree, though this function is not declared. Maybe it is in the Dll?
https://github.com/bgrabitmap/webp
Is missing testing it on linux and mac, but I don't know how to compile the .so files for these systems...Yes, that's a bit different. Also there is a package for webp on Linux (at least in my distro as far as I can see) so that you don't need to provide the library. But then the name of the shared library binary file may change. %)
Compile Project, Mode: Debug, Target: bgrawebptest: Exit code 1, Errors: 1, Hints: 3
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Verbose: Free Pascal Compiler version 3.0.4 [2018/10/29] for x86_64
Verbose: Copyright (c) 1993-2017 by Florian Klaempfl and others
Verbose: Target OS: Linux for x86-64
Verbose: Compiling bgrawebptest.lpr
Verbose: Compiling bgrawebp.pas
bgrawebp.pas(75,3) Note: Local variable "i" not used
bgrawebptest.lpr(10,17) Unit "bgrawebp" not used in bgrawebptest
Compiling resource /home/lainz/webp/bgrawebp/lib/x86_64-linux/bgrawebptest.or
Linking /home/lainz/webp/bgrawebp/bgrawebptest
linker: /usr/bin/ld: aviso: /home/lainz/webp/bgrawebp/link.res contiene secciones de salida. ¿Olvidó -T?
linker: /usr/bin/ld: /home/lainz/webp/bgrawebp/lib/x86_64-linux/libwebp.o: en la función `VP8INITIO':
/home/lainz/webp/bgrawebp//libwebp.pas:532: referencia a `VP8InitIoInternal' sin definir
bgrawebptest.lpr(21,1) Error: Error while linking
bgrawebptest.lpr(21,1) Verbose: There were 1 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: /usr/bin/ppcx64 returned an error exitcode
Oh, there seem to be interesting stuff about polygon clipping.Hi!That's the guy! Holy Cow have the years flown by. :D
I think you mean efg ! He is still at work but his continuous growing website needs to be reorganized. Thats what he is doing now. But he's is still at work since over 20 years. Yes, he was very early with cool sniplets for graphic algorithms for Delphi.
Here: http://www.efg2.com/ (http://www.efg2.com/)
Winni
You can keep it on a helper on a separate package, so people can choose to use it or not.Hmm yep, like the BGRAWebP unit would not be included be default.
Oh, there seem to be interesting stuff about polygon clipping.
Oh, there seem to be interesting stuff about polygon clipping.
Keep on BGRAing!:D Sure I think I will :)
I think we did it. fredvs did the dynamic loading and I did the search for the library on linux. So basically, on Linux, it uses the installed library libwebp and on Windows and MacOS one need to supply the library. I haven't tested it on MacOS though.
But main thing, it doesn't require to install libwebp-dev, so if I add this to BGRABitmap, people won't have to install this package to compile.
On Windows you can display .webp with out external library, check this Double Commander implementation:That's interesting. I wonder though from which version it is available and the resolution, as it is returned by a thumbnail function?
but its just to display, you can't save to .webpAh indeed, that's a bit limited. Though as a fallback, it could be better than nothing.
That's interesting. I wonder though from which version it is available and the resolution, as it is returned by a thumbnail function?Yes and the resolution you must to set it, can not get it :( , but maybe with some search in the winapi function ?
Ah indeed, that's a bit limited. Though as a fallback, it could be better than nothing.yeap
Edit: Another problem is that the new version does not compile with MSEide.
bgrafreetype.pas(31,57) Fatal: Can't find unit EasyLazFreeType used by BGRAFreeType
Fatal: Compilation aborted
Edit: Another problem is that the new version does not compile with MSEide.
bgrafreetype.pas(31,57) Fatal: Can't find unit EasyLazFreeType used by BGRAFreeType
Fatal: Compilation aborted
Please create a global macro LAZUTILSDIR that point to /the/directoryof/lazarus/components/lazutils/
And use that macro in Project - Options - Make - Directories
Hello Lainz.
OK, I will try your new commits now.
Write you later on BGRAgui Github.
Fre;D
I have EasyLazFreeType from lazarus\components\lazutils\easylazfreetype.pasThen the file is not up-to-date. Compare to:
And in that file nowhere is included CharKerning.
> Try compiling bgragui\examples\button with the IDE, I get these error messages.
Please, take a look at BGRAgui Github messages, all is solved there.
I have EasyLazFreeType from lazarus\components\lazutils\easylazfreetype.pasThen the file is not up-to-date. Compare to:
And in that file nowhere is included CharKerning.
https://svn.freepascal.org/svn/lazarus/trunk/components/lazutils/
The change was made very recently.
If you use svn on it you get can the update quickly.
db $66; mov ax, bx
would in fact bemov eax, ebx
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994
I had the biggest problem with the missdesign of the Intel 386: The maximum data chunk was 64k. So you were allways working with pointer lists to handle bigger amounts of data (pictures).I suppose you mean 8086. Indeed using the same segment you would have only 64k.
Yes, 32 bits were a big progress, but Win95 was awful slow on your old hardware. You had to buy some new.Indeed, at the time of Win95, you needed to have some time before it would boot up. Or try to optimize the system by deactivating services.
The 386 was widely used for Delphi 1 with 16 bit and Windows 3.1 / 3.11.
There you had the problem with the 64k chunks.
New version 11.4
https://github.com/bgrabitmap/bgrabitmap/releases
Important note : in the incoming version of Lazarus 2.2, in any BGRABitmap package, one will need to add a condition to use freetypelaz package. Indeed, FreeType support has been move from lazutils package to freetypelaz package.
Fixes and improvements for BGRAAnimatedGif
- display animated Gif in dialogs
- handle Assign
- OptimizeFrames function
- compatibility on various systems
Compilation fixes for fpGUI, noGUI and mseGUI.
Added sample project for ideU in test/test4ideu
Hi
Just loaded fresh fpc & Laz both trunk versions on MacOS, but getting error installing 11.4Compile package
BGRABitmapPack 11.4: Exit code 1, Errors: 3, Hints: 4
Hint: Start of reading config file /Users/josh/Documents/LazTrunkUse/fpc/bin/x86_64-darwin/fpc.cfg
Hint: End of reading config file /Users/josh/Documents/LazTrunkUse/fpc/bin/x86_64-darwin/fpc.cfg
Verbose: Free Pascal Compiler version 3.3.1-9412-g068f781c7a-dirty [2021/10/11] for x86_64
Verbose: Copyright (c) 1993-2021 by Florian Klaempfl and others
Verbose: Target OS: Darwin for x86_64
Hi Circular
I think that approach could resolve the uses section.
However as the unit is part of lazarus, should the check be directed towards the lazarus version not FPC?
Using the laz version check it could also be used to use the replacement function SameMethod as defined in lazmethodlist in
BCGameGrid.
Any ideas as to why BGRABitmap only compiling on fpc trunk when I set the BGRABitmap package options to enable rangechecking.?
However as the unit is part of lazarus, should the check be directed towards the lazarus version not FPC?Indeed.
Any ideas as to why BGRABitmap only compiling on fpc trunk when I set the BGRABitmap package options to enable rangechecking.?Looks like a compiler bug to me.
Hi, please try again with dev bgracontrols. I've removed the dependency on comparemethod.Yeah that's another way. Even better as the original function is deprecated.
Hi,
I am a bit confused. Are you saying that changing the number indicating the compression method shows the image perfectly? That would mean that in fact the bitmap is not compressed.
Can you provide the image as attachment?
It is possible to change the reader to handle new formats.
Regards
Yes, as I mentioned, you can call bmp.SwapRedBlue after loading the file where bmp is your TBGRABitmap object.
Thanks to DomingoGP for the pull request :)
Regarding it's gtk2 dependence, I would have thought that that would have been it's "foot of clay" but even today Slackware 15 delivers the first version (1.x) of gtk libraries alongside gtk2, 3 and 4. And as a tip, a pleasant way to use Slackware 15 is to install Salix (https://sourceforge.net/projects/salix/) 15 or Slackel (https://sourceforge.net/projects/slackel/) 7.5 distros... So, the future of gtk2 looks good!I am glad GTK2 is still on. :)
Congrats for the new release! ;DCool. Did you use the dev-bgrabitmap branch to overcome the compiler bug?
Tested with fpc-llvm 3.3.1. and works like charm ( WoW animations with -O4 on BGRABitmap/MSEgui apps).
Fre;D
You're welcome :)I am glad to have some people contributing, I am less alone maintaining the package :)
Congrats for the new release! ;DCool. Did you use the dev-bgrabitmap branch...
Tested with fpc-llvm 3.3.1. and works like charm ( WoW animations with -O4 on BGRABitmap/MSEgui apps).
Fre;D
... to overcome the compiler bug?
bgrasvgimagelist.pas(168,57) Error: Illegal qualifierpointing to "i.ToString"
bgrasvgimagelist.pas(181,35) Error: Illegal qualifier
bgrasvgimagelist.pas is rather in dev-bgracontrols.
The error is similar, a regression from the compiler regarding type helpers.
You can replace "i.ToString" by "IntToStr(i)". Does it fix the problem?
Not sure about BGRAControls, but personally I use stable FPC.
Using the development branch of FPC can cause some strange errors like this one.
Exactly. BGRABitmap was and is one of the best libraries I worked with.I am very much touched by your kind words. <3
Circular, can BGRABitmap be used in Delphi?Yes both bgrabitmap and bgracontrols
When I try to display Images, I just getting a black screen, what am I missing or do wrong?
procedure AssignBase64ToImage(const ABase64String: AnsiString; const AImage: TImage); var bytes: TBytes; graphic: TBGRABitmap; stream: TStream; bmp: TBitmap; begin AImage.Picture.Clear; bytes := Base64ToBytes(ABase64String); if IsBRGACompatible(bytes) then begin graphic := TBGRABitmap.Create; try stream := TBytesStream.Create(bytes); try graphic.LoadFromStream(stream); bmp := TBitmap.Create; try bmp.Assign(graphic.Bitmap); AImage.Picture.Assign(bmp); finally bmp.Free; end; finally stream.Free; end; finally graphic.Free; end; end; end;
Create a tbgrabitmap and load from stream. Then assign to picture bitmap the bgrabitmap.bitmap, no need to use a temporary tbitmap. Also notice that you're freeing the bgrabitmap, that causes the tbitmap to don't be available anymore...Same result. I try search forum okay.
Or search the forums this was discussed already
If I remember correctly there is a function called makeBitmapCopy that you can use to avoid this problem.Thank you lainz, later I try to investigate it deeper.
You're welcome :)Yeah, I didnt knew it better to help myself.
Hi KodeZwerg!
Indeed, what happens here is that the raster data of the bitmap is shared when assigning it.
In the end, it seems you've written something a bit similar to MakeBitmapCopy, except maybe with transparent background. It is probably not portable to other systems, but if that works for you that's all good.
Hello Alex,Sorry, No Problem!)
I am not sure to understand what you're saying. Can you explain?
Regards
EDIT: I suppose you've chosen bgrabitmappack4fpgui.lpk instead of bgrabitmappack.lpk
New version of BGRABitmap v11.5.7
https://github.com/bgrabitmap/bgrabitmap/releases
- added BGRAPapers unit (by maxm74)
- BGRABitmap package for Android
- compilation fix for assembler
- memory fix for SVG
- support for animated AVIF (by DomingoGP)
- added ResourceFile function (helpful for cross-platform with MacOS)
- data generation for GPT assistant
The package for Android bgrabitmappack4android.lpk avoids dependencies to OpenGL.
The ResourceFile function provided in BGRABitmapTypes finds a resource file near the binary (or in the parent folder on MacOS to make it more debugger friendly).
Another good one. I like the BGRAPapers, thanks!Hi Okoba,
Another good one. I like the BGRAPapers, thanks!Hi Okoba,
It is great to see you around. I hope all is well in your projects.
And long life to beloved pixels! :)
Hi
Yep compiled and all appears good.
thanks for your rapid fix :)
By the way would you be interested in having your testimony on the website?It will be my pleasure to add a testimonial (one caveat... I need to acquire more knowledge for my testimonial about BGRABitmap to be worth something)
I thought of this poem:
The world is unknown, but nonetheless
A conclusion is inescapable to anybody
The world is vast, very vast, we can guess.
A group of friends might number around twenty
But a medium-sized country contains 7 million.
We can't really grasp this scale.
It's akin to an ultra high definition
A 4K screen of which we are but a single pixel.
And the Earth contains billions of folks,
In other words, a thousand of these screens,
Arranged in a 32 by 32 box.
The color of a pixel cannot be seen,
Yet without it, these apparatus
would have no stories to tell us.