Skip to content

Commit

Permalink
fix: pixInof on top of cutMask
Browse files Browse the repository at this point in the history
  • Loading branch information
xland committed Jul 10, 2024
1 parent 966997f commit 8a9b395
Show file tree
Hide file tree
Showing 5 changed files with 427 additions and 416 deletions.
8 changes: 4 additions & 4 deletions res/res.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ IDI_LOGO ICON "logo.ico"
IDR_ICON_FONT ICON_FONT "icon.ttf"

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,9,0
PRODUCTVERSION 2,1,9,0
FILEVERSION 2,1,10,0
PRODUCTVERSION 2,1,10,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -26,12 +26,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub xland"
VALUE "FileDescription", "ScreenCapture"
VALUE "FileVersion", "2.1.9.0"
VALUE "FileVersion", "2.1.10.0"
VALUE "InternalName", "ScreenCapture.exe"
VALUE "LegalCopyright", "Copyright (C) LiuXiaolun 2023-2024"
VALUE "OriginalFilename", "ScreenCapture.exe"
VALUE "ProductName", "ScreenCapture"
VALUE "ProductVersion", "2.1.9.0"
VALUE "ProductVersion", "2.1.10.0"
END
END
BLOCK "VarFileInfo"
Expand Down
26 changes: 18 additions & 8 deletions src/PixelInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PixelInfo.h"
#include "PixelInfo.h"
#include "App.h"
#include "WindowBase.h"
#include "include/core/SkRegion.h"
Expand Down Expand Up @@ -28,24 +28,36 @@ PixelInfo* PixelInfo::Get()
return pixelInfo;
}

bool PixelInfo::OnMouseMove(const int& x, const int& y)
bool PixelInfo::OnMouseMove(const int& x, const int& y) {
auto win = App::GetWin();
if (win->IsMouseDown || win->state >= State::mask)
{
return false;
}
win->Refresh();
}

bool PixelInfo::OnPaint(SkCanvas* canvas)
{
auto win = App::GetWin();
if (win->IsMouseDown || win->state >= State::mask)
{
return false;
}
float width = 200.0f;
float height = 200.0f;
float width{ 200.0f },height{ 200.0f },x,y;
{
POINT mousePos;
GetCursorPos(&mousePos);
x = (float)mousePos.x;
y = (float)mousePos.y;
}
rect.setXYWH(x + 10, y + 10, width, height);
if (rect.fLeft + width > win->w) {
rect.offset(0 - width - 20, 0);
}
if (rect.fTop + height > win->h) {
rect.offset(0, 0 - height - 20);
}
auto canvas = win->surfaceFront->getCanvas();
canvas->clear(SK_ColorTRANSPARENT);
SkPaint paint;
paint.setColor(SkColorSetARGB(168, 0, 0, 0));
canvas->drawRect(rect, paint);
Expand Down Expand Up @@ -109,8 +121,6 @@ bool PixelInfo::OnMouseMove(const int& x, const int& y)

data = str.data();
canvas->drawSimpleText(data, str.size()*2, SkTextEncoding::kUTF16, rect.fLeft + 8, rect.fTop + 186, *font, paint);

win->Refresh();
return false;
}

Expand Down
39 changes: 20 additions & 19 deletions src/PixelInfo.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#pragma once
#include "include/core/SkSurface.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkRect.h"
#include "include/core/SkPoint.h"
#include "include/core/SkPath.h"
#include <vector>

class PixelInfo
{
public:
~PixelInfo();
static void Init();
static PixelInfo *Get();
bool OnMouseMove(const int &x, const int &y);

private:
PixelInfo();
SkRect rect;
#pragma once
#include "include/core/SkSurface.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkRect.h"
#include "include/core/SkPoint.h"
#include "include/core/SkPath.h"
#include <vector>

class PixelInfo
{
public:
~PixelInfo();
static void Init();
static PixelInfo *Get();
bool OnPaint(SkCanvas* canvas);
bool OnMouseMove(const int& x, const int& y);

private:
PixelInfo();
SkRect rect;
};
Loading

0 comments on commit 8a9b395

Please sign in to comment.