layers := TBGRALayeredBitmap.Create(640,480); layers.AddLayer(someBmp,128); layers.AddLayerFromFile('filename1'); layers.LayerOpacity[layers.AddLayerFromFile('filename1')] := 128; ... layers.Draw(bmp,0,0); ... layers.free;
..bsHot: begin FBGRA.PutImage(0, 0, FBGRAUp, dmDrawWithTransparency); FBGRA.PutImage(0, 0, FBGRAHot, dmDrawWithTransparency, FTimerStep); end; ..
procedure CustomReplace(var Destination: TBGRACustomBitmap; Temp: TObject);begin Destination.Free; Destination := Temp as TBGRACustomBitmap;end;var TBmp: TBGRABitmap;begin if csLoading in ComponentState then exit; if (Bitmap = nil) or (Bitmap.Width < 1) and (Bitmap.Height < 1) then exit; FBmpHeight := Bitmap.Height div 4; FBGRA.SetSize(Width, Height); TBmp := TBGRABitmap.Create(FBmp); //get pointer bitmaps FreeAndNil(FBGRAUp); FBGRAUp := TBmp.GetPtrBitmap(0,FBmpHeight); FBGRAUp.ResampleFilter:= rfBestQuality; FreeAndNil(FBGRAHot); FBGRAHot := TBmp.GetPtrBitmap(FBmpHeight,FBmpHeight*2); FBGRAHot.ResampleFilter:= rfBestQuality; FreeAndNil(FBGRADown); FBGRADown := TBmp.GetPtrBitmap(FBmpHeight*2,FBmpHeight*3); FBGRADown.ResampleFilter:= rfBestQuality; FreeAndNil(FBGRADisabled); FBGRADisabled := TBmp.GetPtrBitmap(FBmpHeight*3,FBmpHeight*4); FBGRADisabled.ResampleFilter:= rfBestQuality; if BitmapOptions.Enable then begin CustomReplace(FBGRAUp,CustomResizeBitmap(FBGRAUp,BitmapOptions.BorderWidth,BitmapOptions.BorderHeight,Width,Height,BitmapOptions.DrawMode,BitmapOptions.ResampleMode,BitmapOptions.ResampleFilter)); CustomReplace(FBGRADown,CustomResizeBitmap(FBGRADown,BitmapOptions.BorderWidth,BitmapOptions.BorderHeight,Width,Height,BitmapOptions.DrawMode,BitmapOptions.ResampleMode,BitmapOptions.ResampleFilter)); CustomReplace(FBGRAHot,CustomResizeBitmap(FBGRAHot,BitmapOptions.BorderWidth,BitmapOptions.BorderHeight,Width,Height,BitmapOptions.DrawMode,BitmapOptions.ResampleMode,BitmapOptions.ResampleFilter)); CustomReplace(FBGRADisabled,CustomResizeBitmap(FBGRADisabled,BitmapOptions.BorderWidth,BitmapOptions.BorderHeight,Width,Height,BitmapOptions.DrawMode,BitmapOptions.ResampleMode,BitmapOptions.ResampleFilter)); end else begin //needed even if same size in order to make a real copy CustomReplace(FBGRAUp, FBGRAUp.Resample(Width, Height)); CustomReplace(FBGRADown, FBGRADown.Resample(Width, Height)); CustomReplace(FBGRAHot, FBGRAHot.Resample(Width, Height)); CustomReplace(FBGRADisabled, FBGRADisabled.Resample(Width, Height)); end; TBmp.Free; InvalidatePreferredSize; AdjustSize; if Sender is TBitmap then Invalidate; {$IFDEF DEBUG} Inc(FUpdateCount); {$ENDIF}end;
FBGRAUp := nil; FBGRADown := nil; FBGRADisabled := nil; FBGRAHot := nil;
In fact, it seems that the error I found in BGRABitmap is causing the error you mentionned. Anyway here is a new version of BGRABitmap (5.5) :- new blend operations : boNiceGlow and boDarkOverlay- merged boMultiply and boLinearMultiply because it looked the same- css colors : CSSBlue, CSSRed etc.- TBGRAColorList : CSSColors.ByName[...]- StrToBGRA handles CSS color names- alpha PutImage fixhttp://sourceforge.net/projects/lazpaint/files/src/