Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Eliminating White Part From PNG Image

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Master Cheater
Reputation: 8

Joined: 10 Apr 2015
Posts: 425

PostPosted: Sun Mar 12, 2017 7:42 pm    Post subject: Eliminating White Part From PNG Image Reply with quote

Hi there,

When I add an PNG image type to a form, it show not clear. There are white part on image sharp. How to eliminating these white part ?

I remember old topic about Form Layered Attribute and also about Form Transparent, but that topics more about hoe to make transparent. What I need is just to clear and smooth display the PNG image.

Thank
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Sun Mar 12, 2017 8:30 pm    Post subject: Reply with quote

http://forum.cheatengine.org/viewtopic.php?p=5687756

Dark bytes example of form tht is an image with transparency.

formname.setLayeredAttributes(Color, Alpha, flags)

_________________
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 341

Joined: 09 May 2003
Posts: 19983
Location: The netherlands

PostPosted: Sun Mar 12, 2017 8:44 pm    Post subject: Reply with quote

check the png itself.
it's possible those white parts are actually in the png, but don't show when on a white background

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
Corroder
Master Cheater
Reputation: 8

Joined: 10 Apr 2015
Posts: 425

PostPosted: Mon Mar 13, 2017 2:57 am    Post subject: Reply with quote

Thanks akumakuja28 :

Yes I know this code to set form to transparent :

Code:
function FormLayeredAttributes(form,colorkey,alpha,flag)

  if form==nil then return false end

  colorkey = colorkey or 0xFFFFFF
  alpha = alpha or 0xFF
  flag = flag or 1

  if cheatEngineIs64Bit() then

    handle = readQwordLocal(userDataToInteger(form)+0x538)

    script = [[
    alloc(thread,128)
    createthread(thread)
    thread:
    lea rsp,[rsp-40]
    mov rcx,handle
    mov edx,FFFFFFEC
    call user32.GetWindowLongA
    mov r8d,eax
    or r8d,00080000
    mov rcx,handle
    mov edx,FFFFFFEC
    call user32.SetWindowLongA
    mov rcx,handle
    mov edx,colorkey
    mov r8d,alpha
    mov r9d,flag
    call user32.SetLayeredWindowAttributes
    lea rsp,[rsp+40]
    ret
    ]]

    script=script:gsub('handle', string.format('%X',handle)):gsub('colorkey', string.format('%X',colorkey))
    script=script:gsub('alpha', string.format('%X',alpha)):gsub('flag', string.format('%X',flag))

    autoAssemble(script,true)
  else

    handle = bAnd( readQwordLocal(userDataToInteger(form)+0x330) , 0xFFFFFFFF)

    script = [[
    alloc(thread,128)
    createthread(thread)
    thread:

    push -14
    push handle
    call user32.GetWindowLongA
    or eax,80000
    push eax
    push -14
    push handle
    call user32.SetWindowLongA
    push flag
    push alpha
    push colorkey
    push handle
    call user32.SetLayeredWindowAttributes

    ret
    ]]

    script=script:gsub('handle', string.format('%X',handle)):gsub('colorkey', string.format('%X',colorkey))
    script=script:gsub('alpha', string.format('%X',alpha)):gsub('flag', string.format('%X',flag))

    autoAssemble(script,true)
  end
end


LWA_COLORKEY = 1
LWA_ALPHA = 2




UDF1.CEImage1.OnMouseDown = function() UDF1.DragNow() end

function CEButton1Click(sender)
  closeCE()
end

UDF1.BorderStyle = 'bsNone'
UDF1.Visible=true
UDF1.Color = 0xFFFFFF
UDF1.Constraints.MinWidth = UDF1.CEImage1.Width
UDF1.Constraints.MinHeight = UDF1.CEImage1.Height

FormLayeredAttributes(UDF1, 0xFFFFFF, 240, LWA_COLORKEY + LWA_ALPHA)



Also we can use AlphaBlend = true amd set for Form.AlphaBlendValue = integer, to make form transparent, of if we doesn't care with image go to transparent too.

Any way, i have check what DB said and found conclusion, then PNG image will contain white part / blur part depending by image size. (image attached). Then, maybe there are a function which to adjusting image pixels when it resize. I just googling for it.

Regards



Capture2.JPG
 Description:
 Filesize:  25.19 KB
 Viewed:  4103 Time(s)

Capture2.JPG



Capture.JPG
 Description:
 Filesize:  14.46 KB
 Viewed:  4103 Time(s)

Capture.JPG


Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 23

Joined: 13 Sep 2011
Posts: 1393

PostPosted: Mon Mar 13, 2017 6:46 am    Post subject: Reply with quote

You're looking to resample the image, or apply anti aliasing to it, to blur the pixels.
This currently cannot be done easily, I did try to experiment with it but quite difficult.

You could replace the TBitmap with BGRABitmap library which contains some anti aliasing feaures and some other.
Another method is add a function to the bitmap class to return scanline pointer or access Pixels or raw image,then use cheat engine to modify or/and apply anti-aliasing manually in memory and invalidate the image.

All these require modification of C.E.


Another option would create the very same image in different dimensions after it's been resampled (by photoshop etc.) and use them instead.

_________________
www.flashacking.net/
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message Visit poster's website
Corroder
Master Cheater
Reputation: 8

Joined: 10 Apr 2015
Posts: 425

PostPosted: Mon Mar 13, 2017 8:24 am    Post subject: Reply with quote

DaSpamer wrote:
You're looking to resample the image, or apply anti aliasing to it, to blur the pixels.
This currently cannot be done easily, I did try to experiment with it but quite difficult.

You could replace the TBitmap with BGRABitmap library which contains some anti aliasing feaures and some other.
Another method is add a function to the bitmap class to return scanline pointer or access Pixels or raw image,then use cheat engine to modify or/and apply anti-aliasing manually in memory and invalidate the image.

All these require modification of C.E.


Another option would create the very same image in different dimensions after it's been resampled (by photoshop etc.) and use them instead.


Yes, no setPixelTo or Anti-Aliasing in CE for this time. Maybe shall use Lua-GD or Lua-CD, IUP or other lua lib for GUI. Meanwhile, I have used the option, by change image dimension and resizing to exact dimension value I need, using MS-Picture Manager and after resized image displaying clear and smooth.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites