|
-
Aug 13th, 2005, 12:25 PM
#1
Thread Starter
Supreme User
[DELPHI] - TImage Effects
Ok, ive just begun a new project the other day, and have been working out how to implement some effects features. Using some online sample code the below function can invert the colours of a bitmap in a TImage. Works fine too:
function InvertBitmap(MyBitmap: TBitmap): TBitmap;
var
x, y: Integer;
ByteArray: PByteArray;
begin
MyBitmap.PixelFormat := pf24Bit;
for y := 0 to MyBitmap.Height - 1 do
begin
ByteArray := MyBitmap.ScanLine[y];
for x := 0 to MyBitmap.Width * 3 - 1 do
begin
ByteArray[x] := 255 - ByteArray[x];
end;
end;
Result := MyBitmap;
end;
imgMain.Picture.Bitmap := InvertBitmap(imgMain.Picture.Bitmap);
imgMain.Refresh;
Problem: Im not using a TImage control but an external component which handles more filetypes, such as JPG. Because of this, the above function will only invert the image if its a bitmap, any other file type is converted to white.
Question: How can i invert ANY image type?
My idea was to convert the image, say JPG to BMP, invert it, then convert it back. But it seems a lot of hassle for just inverting an image.
Appreciate any help or solutions to such an easy problem
-
Aug 15th, 2005, 11:41 AM
#2
Re: [DELPHI] - TImage Effects
Moved to Other Programming Languages.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 15th, 2005, 11:59 AM
#3
Thread Starter
Supreme User
Re: [DELPHI] - TImage Effects
Thanks, any logical answers anyone?
-
Aug 22nd, 2005, 04:51 AM
#4
Thread Starter
Supreme User
Re: [DELPHI] - TImage Effects
I was right in saying you never get a response back, decided to find an external VCL library instead
-
Aug 29th, 2005, 12:23 AM
#5
Re: [DELPHI] - TImage Effects
 Originally Posted by RobDog888
Moved to Other Programming Languages. 
 Originally Posted by Madboy
Thanks, any logical answers anyone?
it is logical, Image.FromFile() in .NET, all formats
-
Aug 29th, 2005, 04:37 PM
#6
Thread Starter
Supreme User
Re: [DELPHI] - TImage Effects
and that was a useful reply because...?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|