You've already forked lazarus-ccr
- implementation for Carbon interface
- fix compilation after graphics rewrite - improved example application git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@251 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
84
components/rgbgraphics/rgbgtkroutines.pas
Normal file
84
components/rgbgraphics/rgbgtkroutines.pas
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
/***************************************************************************
|
||||
RGBGTKRoutines.pas
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Tom Gregorovic (_tom_@centrum.cz)
|
||||
|
||||
Abstract:
|
||||
This unit contains routines for GTK interfaces.
|
||||
|
||||
}
|
||||
unit RGBGTKRoutines;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode objfpc}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, LCLType,
|
||||
{$IFDEF LCLgtk2}
|
||||
glib2, gdk2, gtk2,
|
||||
{$ENDIF}
|
||||
{$IFDEF LCLgtk}
|
||||
glib, gdk, gtk,
|
||||
{$ENDIF}
|
||||
gtkDef, gtkProc,
|
||||
RGBTypes, RGBUtils;
|
||||
|
||||
procedure WidgetSetDrawRGB32Bitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY, SrcWidth, SrcHeight: Integer;
|
||||
Bitmap: TRGB32BitmapCore);
|
||||
|
||||
procedure WidgetSetDrawRGB8Bitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY, SrcWidth, SrcHeight: Integer;
|
||||
Bitmap: TRGB8BitmapCore);
|
||||
|
||||
implementation
|
||||
|
||||
procedure WidgetSetDrawRGB32Bitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY, SrcWidth,
|
||||
SrcHeight: Integer; Bitmap: TRGB32BitmapCore);
|
||||
var
|
||||
P: TPoint;
|
||||
begin
|
||||
P := GetDCOffset(TDeviceContext(Dest));
|
||||
Inc(DstX, P.X);
|
||||
Inc(DstY, P.Y);
|
||||
|
||||
gdk_draw_rgb_32_image(TDeviceContext(Dest).Drawable, TDeviceContext(Dest).GC,
|
||||
DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE,
|
||||
Pguchar(Bitmap.GetPixelPtrUnsafe(SrcX, SrcY)), Bitmap.RowPixelStride shl 2);
|
||||
end;
|
||||
|
||||
procedure WidgetSetDrawRGB8Bitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY,
|
||||
SrcWidth, SrcHeight: Integer; Bitmap: TRGB8BitmapCore);
|
||||
var
|
||||
P: TPoint;
|
||||
begin
|
||||
P := GetDCOffset(TDeviceContext(Dest));
|
||||
Inc(DstX, P.X);
|
||||
Inc(DstY, P.Y);
|
||||
|
||||
gdk_draw_gray_image(TDeviceContext(Dest).Drawable, TDeviceContext(Dest).GC,
|
||||
DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE,
|
||||
Pguchar(Bitmap.Get8PixelPtrUnsafe(SrcX, SrcY)), Bitmap.RowPixelStride);
|
||||
end;
|
||||
|
||||
initialization
|
||||
gdk_rgb_init;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user