|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Mon Dec 22, 2014 6:33 pm Post subject: Image class issues again |
|
|
Hey, so I have this script.
Code: | local f = createForm();
local bgr = createImage(f);
bgr.width = 120
bgr.height = 25
bgr.Canvas.gradientFill(0,0,bgr.width,bgr.height,0x0090FF,0x00CCCC,1);
PaintBox = createPaintBox(f)
PaintBox.width = 120
PaintBox.height = 25
local Bitmap = createBitmap(PaintBox.width, PaintBox.height);
Bitmap.TransparentColor = 0x800080
Bitmap.Transparent = true
Bitmap.Canvas.Font.Name = 'Terminal'
Bitmap.Canvas.Font.CharSet= 255;
Bitmap.Canvas.Font.Color = 0x800080;
Bitmap.Canvas.Brush.Color = 0xFFFFFF;
local function updateBM()
Bitmap.Canvas.clear();
Bitmap.Canvas.fillRect(0,0,PaintBox.width, PaintBox.height);
local data = os.clock();
local width,height = Bitmap.Canvas.getTextWidth(data),Bitmap.Canvas.getTextHeight(data);
Bitmap.Canvas.textOut(math.ceil((Bitmap.width-width)/2),math.ceil((Bitmap.height-height)/2),data);
end
PaintBox.onPaint = function ()
updateBM();
PaintBox.Canvas.draw(0,0,Bitmap);
-- local r = PaintBox.Canvas.getClipRect();
-- PaintBox.Canvas.drawWithMask(r.Left,r.Top,r.Right, r.Bottom,Bitmap,r.Left, r.Top,r.Right,r.Bottom);
end
PaintBox.onClick = function ()
PaintBox.repaint();
end |
I'm trying to create colorful text (based on mgr.inz.Player NFOwindow).
Like the text the bitmap is white, and I write on it a text (which is becoming transparent), then just draw into the paintbox, under it there is colorful image.
The first run of the script get's the wanted results.
But when you click on it (should replace text and update bitmap and draw again), the original text is not being cleared, and the text under has the defined color.
What am I doing wrong?
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Dec 22, 2014 7:05 pm Post subject: |
|
|
Transparency is a bitch to work with and I usually opt for not using it at all
here is a script that does something similar to what you wish: (it copies the background into the bitmap instead)
Code: |
local f = createForm();
local bgr = createBitmap() --createImage(f);
bgr.width = 120
bgr.height = 25
bgr.Canvas.gradientFill(0,0,bgr.width,bgr.height,0x0090FF,0x00CCCC,1);
PaintBox = createPaintBox(f)
PaintBox.width = 120
PaintBox.height = 25
Bitmap = createBitmap(PaintBox.width, PaintBox.height);
--Bitmap.TransparentColor = 0x800080
--Bitmap.Transparent = true
Bitmap.Canvas.Font.Name = 'Terminal'
Bitmap.Canvas.Font.CharSet= 255;
Bitmap.Canvas.Font.Color = 0x800080;
Bitmap.Canvas.Brush.Color = 0xFF0000;
Bitmap.Canvas.Brush.Style=1
local function updateBM()
--Bitmap.Canvas.clear();
-- Bitmap.Canvas.fillRect(0,0,PaintBox.width, PaintBox.height);
Bitmap.Canvas.Draw(0,0, bgr)
local data = os.clock();
local width,height = Bitmap.Canvas.getTextWidth(data),Bitmap.Canvas.getTextHeight(data);
Bitmap.Canvas.textOut(math.ceil((Bitmap.width-width)/2),math.ceil((Bitmap.height-height)/2),data);
end
PaintBox.onPaint = function ()
updateBM();
PaintBox.Canvas.clear()
PaintBox.Canvas.draw(0,0,Bitmap);
-- local r = PaintBox.Canvas.getClipRect();
-- PaintBox.Canvas.drawWithMask(r.Left,r.Top,r.Right, r.Bottom,Bitmap,r.Left, r.Top,r.Right,r.Bottom);
end
PaintBox.onClick = function ()
PaintBox.repaint();
end
|
Note that it makes use of the undocumented and not defined Brush.style property
this is bsClear, which means it doesn't use the brush at all when writing text
here's a list of other brush styles:
Code: |
bsSolid=0 --default
bsClear=1 --don't use
bsHorizontal=2
bsVertical=3
bsFDiagonal=4
bsBDiagonal=5
bsCross=6
bsDiagCross=7
bsImage=8
bsPattern=9
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Mon Dec 22, 2014 7:40 pm Post subject: |
|
|
Edit after playing around, it seems that I cannot my wanted result.
I'm trying to hide the colorful background anywhere it's not text (paint as white) and only in text area display the colorful background (the image under it);
(colors don't matter, just want to randomize text colors.)
Description: |
|
Filesize: |
643 Bytes |
Viewed: |
6508 Time(s) |
|
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Dec 22, 2014 8:20 pm Post subject: |
|
|
I really suck at graphics, but here's a hackish implementation
First it draws the colorful background color, and then the text gets rendered to another bitmap with transparency, where the background will be visible, but the text itself is transparent.
Then that temporary bitmap gets drawn into the final bitmap which will overwrite the colorful background with the exception of the pixels of the text, which are transparent
Code: |
local f = createForm();
local bgr = createBitmap() --createImage(f);
bgr.width = 120
bgr.height = 25
bgr.Canvas.gradientFill(0,0,bgr.width,bgr.height,0x0090FF,0x00CCCC,1);
PaintBox = createPaintBox(f)
PaintBox.width = 120
PaintBox.height = 25
Bitmap = createBitmap(PaintBox.width, PaintBox.height);
--Bitmap.TransparentColor = 0
--Bitmap.Transparent = true
Bitmap.Canvas.Font.Name = 'Terminal'
Bitmap.Canvas.Font.CharSet= 255;
Bitmap.Canvas.Font.Color = 0xffff00
Bitmap.Canvas.Brush.Color = 0xFF0000;
--Bitmap.Canvas.Brush.Style=0
--Bitmap.Canvas.Pen.Style=7
--Bitmap.Canvas.Pen.Mode=4
local function updateBM()
--Bitmap.Canvas.clear();
-- Bitmap.Canvas.fillRect(0,0,PaintBox.width, PaintBox.height);
Bitmap.Canvas.Draw(0,0, bgr)
local t=createBitmap()
t.Canvas.Brush.Color=0xffffff
t.Canvas.Pen.Color=0xffffff
t.transparent=true
t.TransparentColor=0xffff00
t.Width=120
t.Height=25
t.Canvas.Font.Name = 'Terminal'
t.Canvas.Font.CharSet= 255;
t.Canvas.Font.Color = 0xffff00
t.Canvas.Brush.Color = 0xFF0000;
t.Canvas.fillRect(0,0,PaintBox.width, PaintBox.height);
local data = os.clock();
local width,height = t.Canvas.getTextWidth(data),Bitmap.Canvas.getTextHeight(data);
t.Canvas.textOut(math.ceil((t.width-width)/2),math.ceil((t.height-height)/2),data);
--print("yes")
Bitmap.Canvas.Draw(0,0,t)
t.destroy()
end
PaintBox.onPaint = function ()
updateBM();
PaintBox.Canvas.clear()
PaintBox.Canvas.draw(0,0,Bitmap);
-- local r = PaintBox.Canvas.getClipRect();
-- PaintBox.Canvas.drawWithMask(r.Left,r.Top,r.Right, r.Bottom,Bitmap,r.Left, r.Top,r.Right,r.Bottom);
end
PaintBox.onClick = function ()
PaintBox.repaint();
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Mon Dec 22, 2014 9:19 pm Post subject: |
|
|
Perfect thanks.
_________________
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|