Getting ready to teach Bible Study. Finishing 1 Cor this week.
Month: April 2007
Heading to PA for Easter dinne…
Heading to PA for Easter dinner… late enough to be “fashionable”?
Soooo much for the pens…
Soooo much for the pens…
Capture an image to a fully paletted bitmap
This code does not look like it was mine originally, but I found it in a stray file on my hard drive. I decided I didn’t want to lose it.
It takes a picture of any component you pass in and populates a TBitmap with an image using a custom palette built from device context of the component you are capturing.
[Delphi]
{******************************************************************************
ComponentToImg
******************************************************************************}
procedure TForm1.ComponentToImg(CHandle: HWND; x: Integer; y: Integer; Width: Integer; Height: Integer; bm: TBitMap);
var
dc: HDC;
lpPal : PLOGPALETTE;
begin // ComponentToImg
// Test width and height
if ((Width = 0) OR (Height = 0)) then exit;
bm.Width := Width;
bm.Height := Height;
// Get the screen dc
dc := GetDc(CHandle);
try
// If the device doesn’t have a handle, we can’t do anything with it.
if (dc = 0) then exit;
// Do we have a palette device?
if (GetDeviceCaps(dc, RASTERCAPS) AND RC_PALETTE = RC_PALETTE)
then begin
// If so, allocate memory for a logical palette
GetMem(lpPal, sizeof(TLOGPALETTE) + (255 * sizeof(TPALETTEENTRY)));
try
// Zero it out to be neat
FillChar(lpPal^, sizeof(TLOGPALETTE) + (255 * sizeof(TPALETTEENTRY)), #0);
// Fill in the palette version
lpPal^.palVersion := $300;
// Grab the system palette entries
lpPal^.palNumEntries :=GetSystemPaletteEntries(dc,0,256,lpPal^.palPalEntry);
// Create the palette
if (lpPal^.PalNumEntries <> 0) then bm.Palette := CreatePalette(lpPal^);
finally
FreeMem(lpPal, sizeof(TLOGPALETTE) + (255 * sizeof(TPALETTEENTRY)));
end;
end;
// Copy from the screen to the bitmap}
BitBlt(bm.Canvas.Handle, 0, 0, Width, Height, Dc, x, y, SRCCOPY);
// Release the screen dc no matter what happened above.
finally
ReleaseDc(0, dc);
end
end; // ComponentToImg
procedure TForm1.Button1Click(Sender: TObject);
begin
ComponentToImg(self.Handle, 0, 0, 800, 600, Image1.Picture.Bitmap);
end;
[/Delphi]
In 3 hr part 2 meeting. pt1 wa…
In 3 hr part 2 meeting. pt1 was 4hr. 20min to go. @slide 76 of 115! ugggg
Lookin’ forward to new and exc…
Lookin’ forward to new and exciting times comin’ soon.
Listening for the phone.
Listening for the phone.
@Technosailor: Order one for …
@Technosailor: Order one for me to go, will ya?
Torchwood & PHP code – Perfect…
Torchwood & PHP code – Perfect together.
Techno-sailing through WordPress FAQs
Aaron Brazell is in the middle of a GREAT series on how to enhance WordPress. He’s been going through several of the questions that have been presented to b5media‘s support forum. I’ve found his solution for Category Based Themes very interesting because I expect the Google Summer of Code 2007 WordPress Project I am mentoring may build upon this and similar solutions.
Here’s his guide to this series as it exists today:
Series Guide
- WordPress FAQ: How Do I combine Blogs?
- WordPress FAQ: What’s up with the Amazon Plugin with WP 2.1.x?
- WordPress FAQ: How Do I Use Category Themes?
- WordPress FAQ: Where did my Preview Link Go?
- WordPress FAQ: How Do I Use Child Pages More Effectively?
- WordPress FAQ: How Do I Fix the Blogroll Category Issue in WordPress 2.1
I’m looking forward to seeing what else Aaron presents to us!