Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TMufasaBitmap.DrawText(txt:String; pt:TPoint; font:TFont;
- color:Int32; align:Int32=0; shadow:Boolean=False; shadowDir:Byte=0); overload;
- var
- bit:TBitmap;
- muf:TMufasaBitmap;
- W,H:Int32;
- begin
- bit.Init();
- bit.GetCanvas().SetFont(font);
- bit.GetCanvas().GetBrush().SetStyle(bsClear);
- W := bit.GetCanvas().TextWidth(txt);
- H := bit.GetCanvas().TextHeight(txt);
- bit.SetWidth(W+1);
- bit.SetHeight(H+1);
- if align then
- pt := Point(pt.x-W, pt.y);
- muf := self.Copy(pt.x,pt.y,pt.x+W,pt.y+H);
- muf.DrawToCanvas(0,0,bit.GetCanvas());
- if Shadow then
- begin
- bit.GetCanvas().GetFont().SetColor(1);
- case ShadowDir of
- 0:bit.GetCanvas().TextOut(0,0,txt);
- 1:bit.GetCanvas().TextOut(1,0,txt);
- 2:bit.GetCanvas().TextOut(2,0,txt);
- 3:bit.GetCanvas().TextOut(2,1,txt);
- 4:bit.GetCanvas().TextOut(2,2,txt);
- 5:bit.GetCanvas().TextOut(1,2,txt);
- 6:bit.GetCanvas().TextOut(0,2,txt);
- 7:bit.GetCanvas().TextOut(0,1,txt);
- end;
- bit.GetCanvas().GetFont().SetColor(color);
- bit.GetCanvas().TextOut(1,1,txt);
- end else
- begin
- bit.GetCanvas().GetFont().SetColor(color);
- bit.GetCanvas().TextOut(0,0,txt);
- end;
- muf.LoadFromTBitmap(bit);
- muf.DrawTransparent(pt.x,pt.y,self);
- muf.Free();
- bit.Free();
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement